51 std::optional<float> width);
66 const int frame_number = scene.
r.
cfra;
82 const int orig_frame = scene.
r.
cfra;
83 for (
int frame_number = scene.
r.
sfra; frame_number <= scene.
r.
efra; frame_number++) {
89 scene.
r.
cfra = frame_number;
100 scene.
r.
cfra = orig_frame;
119 const Object *ob = info.object;
127 if (!layer->is_visible()) {
130 const Drawing *drawing = grease_pencil_eval->get_drawing_at(*layer, frame_number);
131 if (drawing ==
nullptr) {
155 const std::optional<float> width,
166 auto hpdf_error_handler = [](HPDF_STATUS error_no, HPDF_STATUS detail_no,
void * ) {
167 printf(
"ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no);
170 pdf_ = HPDF_New(hpdf_error_handler,
nullptr);
172 std::cout <<
"error: cannot create PdfDoc object\n";
182 std::cout <<
"error: cannot create PdfPage\n";
203 const std::optional<float> width)
206 HPDF_Page_SetLineJoin(
page_, HPDF_ROUND_JOIN);
207 HPDF_Page_SetLineWidth(
page_, std::max(*width, 1.0f));
210 const float total_opacity =
color.a * opacity;
212 HPDF_Page_GSave(
page_);
213 HPDF_ExtGState gstate = (total_opacity < 1.0f) ? HPDF_CreateExtGState(
pdf_) :
nullptr;
218 HPDF_Page_SetRGBFill(
page_, srgb.
r, srgb.
g, srgb.
b);
219 HPDF_Page_SetRGBStroke(
page_, srgb.
r, srgb.
g, srgb.
b);
221 HPDF_ExtGState_SetAlphaFill(gstate, std::clamp(total_opacity, 0.0f, 1.0f));
222 HPDF_ExtGState_SetAlphaStroke(gstate, std::clamp(total_opacity, 0.0f, 1.0f));
226 HPDF_Page_SetRGBFill(
page_, srgb.
r, srgb.
g, srgb.
b);
228 HPDF_ExtGState_SetAlphaFill(gstate, std::clamp(total_opacity, 0.0f, 1.0f));
232 HPDF_Page_SetExtGState(
page_, gstate);
238 HPDF_Page_MoveTo(
page_, screen_co.x, screen_co.y);
241 HPDF_Page_LineTo(
page_, screen_co.x, screen_co.y);
245 HPDF_Page_ClosePath(
page_);
249 HPDF_Page_Stroke(
page_);
252 HPDF_Page_Fill(
page_);
255 HPDF_Page_GRestore(
page_);
266 std::wstring wstr(filepath_16);
Low-level operations for grease pencil.
bool BKE_scene_camera_switch_update(Scene *scene)
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
void BLI_kdtree_nd_ free(KDTree *tree)
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
constexpr IndexRange index_range() const
constexpr const char * c_str() const
float4x4 to_world_space(const Object &object) const
GreasePencilExporter(const IOContext &context, const ExportParams ¶ms)
blender::Bounds< float2 > screen_rect_
std::optional< float4x4 > camera_persmat_
const ExportParams params_
blender::Bounds< float2 > camera_rect_
void prepare_render_params(Scene &scene, int frame_number)
void foreach_stroke_in_layer(const Object &object, const bke::greasepencil::Layer &layer, const bke::greasepencil::Drawing &drawing, WriteStrokeFn stroke_fn)
Vector< ObjectInfo > retrieve_objects() const
bool is_selected_frame(const GreasePencil &grease_pencil, int frame_number) const
float2 project_to_screen(const float4x4 &transform, const float3 &position) const
GreasePencilExporter(const IOContext &context, const ExportParams ¶ms)
void export_grease_pencil_objects(int frame_number)
void write_stroke_to_polyline(const float4x4 &transform, const Span< float3 > positions, const bool cyclic, const ColorGeometry4f &color, const float opacity, std::optional< float > width)
void export_grease_pencil_layer(const Object &object, const bke::greasepencil::Layer &layer, const bke::greasepencil::Drawing &drawing)
bool export_scene(Scene &scene, StringRefNull filepath)
bool write_to_file(StringRefNull filepath)
bool export_pdf(const IOContext &context, const ExportParams ¶ms, Scene &scene, StringRefNull filepath)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
wchar_t * alloc_utf16_from_8(const char *in8, size_t add)