49 std::optional<float> width);
64 const int frame_number = scene.
r.
cfra;
80 const int orig_frame = scene.
r.
cfra;
81 for (
int frame_number = scene.
r.
sfra; frame_number <= scene.
r.
efra; frame_number++) {
87 scene.
r.
cfra = frame_number;
98 scene.
r.
cfra = orig_frame;
117 const Object *ob = info.object;
125 if (!layer->is_visible()) {
128 const Drawing *drawing = grease_pencil_eval->get_drawing_at(*layer, frame_number);
129 if (drawing ==
nullptr) {
150 const std::optional<float> width,
161 auto hpdf_error_handler = [](HPDF_STATUS error_no, HPDF_STATUS detail_no,
void * ) {
162 printf(
"ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no);
165 pdf_ = HPDF_New(hpdf_error_handler,
nullptr);
167 std::cout <<
"error: cannot create PdfDoc object\n";
177 std::cout <<
"error: cannot create PdfPage\n";
198 const std::optional<float> width)
201 HPDF_Page_SetLineJoin(
page_, HPDF_ROUND_JOIN);
202 HPDF_Page_SetLineWidth(
page_, std::max(*width, 1.0f));
205 const float total_opacity =
color.a * opacity;
207 HPDF_Page_GSave(
page_);
208 HPDF_ExtGState gstate = (total_opacity < 1.0f) ? HPDF_CreateExtGState(
pdf_) :
nullptr;
213 HPDF_Page_SetRGBFill(
page_, srgb.
r, srgb.
g, srgb.
b);
214 HPDF_Page_SetRGBStroke(
page_, srgb.
r, srgb.
g, srgb.
b);
216 HPDF_ExtGState_SetAlphaFill(gstate, std::clamp(total_opacity, 0.0f, 1.0f));
217 HPDF_ExtGState_SetAlphaStroke(gstate, std::clamp(total_opacity, 0.0f, 1.0f));
221 HPDF_Page_SetRGBFill(
page_, srgb.
r, srgb.
g, srgb.
b);
223 HPDF_ExtGState_SetAlphaFill(gstate, std::clamp(total_opacity, 0.0f, 1.0f));
227 HPDF_Page_SetExtGState(
page_, gstate);
233 HPDF_Page_MoveTo(
page_, screen_co.x, screen_co.y);
236 HPDF_Page_LineTo(
page_, screen_co.x, screen_co.y);
240 HPDF_Page_ClosePath(
page_);
244 HPDF_Page_Stroke(
page_);
247 HPDF_Page_Fill(
page_);
250 HPDF_Page_GRestore(
page_);
261 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)