PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
graphics.h
1// Copyright (c) 2009-2025 Avanquest Software. All rights reserved.
2
3#ifndef PDFSDK_CXX_GRAPHICS_H_INCLUDED_
4#define PDFSDK_CXX_GRAPHICS_H_INCLUDED_
5
6#include <filesystem>
7#include <functional>
8#include <optional>
9#include <string>
10
11#include <pdfsdk/cxx/callback.h>
12#include <pdfsdk/cxx/helpers.h>
13#include <pdfsdk/cxx/math.h>
14#include <pdfsdk/cxx/read_stream.h>
15#include <pdfsdk/graphics.h>
16
17#include "wrapper_base.h"
18
19namespace PDF {
20namespace Graphics {
21
26class Palette : public detail::RefCountedHandle<GXPalette> {
27public:
28 static Palette New(const GXColorValue* colors, size_t num_colors) {
29 Palette palette;
30 auto ec = GXCreatePalette(colors, num_colors, &palette);
31 PDF_CHECK_SUCCESS(ec, "Failed to create a palette");
32 return palette;
33 }
34
35 const GXColorValue* GetColorsPtr() const {
36 const GXColorValue* colors = nullptr;
37 auto ec = GXPaletteGetColors(m_handle, &colors);
38 PDF_CHECK_SUCCESS(ec, "Failed to get palette colors");
39 return colors;
40 }
41
42 size_t GetNumColors() const {
43 size_t num_colors = 0;
44 auto ec = GXPaletteGetNumColors(m_handle, &num_colors);
45 PDF_CHECK_SUCCESS(ec, "Failed to get the number of palette colors");
46 return num_colors;
47 }
48
49 GXColorValue GetColor(size_t index) const {
50 GXColorValue color = 0;
51 auto ec = GXPaletteGetColor(m_handle, index, &color);
52 PDF_CHECK_SUCCESS(ec, "Failed to get palette color by index");
53 return color;
54 }
55
56 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Palette, GXPalette)
57};
58
63class Bitmap : public detail::RefCountedHandle<GXBitmap> {
64public:
65 static Bitmap New(const SizeI& size, GXPixelFormat format, float dpiX = 96, float dpiY = 96) {
66 Bitmap bitmap;
67 GXBitmapAttrs attrs = {size, format, dpiX, dpiY};
68 auto ec = GXCreateBitmap(&attrs, &bitmap);
69 PDF_CHECK_SUCCESS(ec, "Failed to create a bitmap");
70 return bitmap;
71 }
72
73 static Bitmap LoadFromFile(const std::filesystem::path& path, uint32_t frame_index = 0, uint32_t* ptotal_frames = nullptr) {
74 Bitmap bitmap;
75 auto path_string = path.wstring();
76 auto ec = GXCreateBitmapFromFileFrame(path_string.c_str(), frame_index, ptotal_frames, &bitmap);
77 PDF_CHECK_SUCCESS(ec, "Failed to load a bitmap from file");
78 return bitmap;
79 }
80
81 static Bitmap LoadFromMemory(const void* data, size_t size, uint32_t frame_index = 0, uint32_t* ptotal_frames = nullptr) {
82 Bitmap bitmap;
83 auto ec = GXCreateBitmapFromMemoryFrame(data, size, frame_index, ptotal_frames, &bitmap);
84 PDF_CHECK_SUCCESS(ec, "Failed to load a bitmap from memory");
85 return bitmap;
86 }
87
88#if defined(WIN32)
89 static Bitmap NewFromHBITMAP(void* hbitmap) {
90 Bitmap bitmap;
91 auto ec = GXCreateBitmapFromHBITMAP(hbitmap, &bitmap);
92 PDF_CHECK_SUCCESS(ec, "Failed to create a bitmap from HBITMAP");
93 return bitmap;
94 }
95#endif
96
97 void SaveToFile(const std::filesystem::path& path) const {
98 auto path_string = path.wstring();
99 auto ec = GXBitmapSaveToFile(m_handle, path_string.c_str());
100 PDF_CHECK_SUCCESS(ec, "Failed to save the bitmap to file");
101 }
102
103#if defined(WIN32)
104 void* SaveToHBITMAP() const {
105 void* hbitmap = NULL;
106 auto ec = GXBitmapSaveToHBITMAP(m_handle, &hbitmap);
107 PDF_CHECK_SUCCESS(ec, "Failed to save the bitmap to HBITMAP");
108 return hbitmap;
109 }
110#endif
111
112 GXPixelFormat GetPixelFormat() const {
114 auto ec = GXBitmapGetPixelFormat(m_handle, &format);
115 PDF_CHECK_SUCCESS(ec, "Failed to get the bitmap pixel format");
116 return format;
117 }
118
119 SizeI GetSize() const {
120 SizeI size;
121 auto ec = GXBitmapGetSize(m_handle, &size);
122 PDF_CHECK_SUCCESS(ec, "Failed to get the bitmap size");
123 return size;
124 }
125
126 float GetDpiX() const {
127 float dpix = 0.f;
128 auto ec = GXBitmapGetDpiX(m_handle, &dpix);
129 PDF_CHECK_SUCCESS(ec, "Failed to get the bitmap horz dpi");
130 return dpix;
131 }
132
133 float GetDpiY() const {
134 float dpiy = 0.f;
135 auto ec = GXBitmapGetDpiY(m_handle, &dpiy);
136 PDF_CHECK_SUCCESS(ec, "Failed to get the bitmap vert dpi");
137 return dpiy;
138 }
139
140 int GetBitsPerPixel() const {
141 GXPixelFormat format = GetPixelFormat();
142
143 switch (format) {
145 return 24;
146
150 return 32;
151
152 case kGXPixelFormatA8:
153 case kGXPixelFormatP8:
154 case kGXPixelFormatL8:
155 return 8;
156
157 case kGXPixelFormatA1:
158 case kGXPixelFormatP1:
159 case kGXPixelFormatL1:
160 return 1;
161
162 default:
163 return 32;
164 }
165 }
166
167 void SetPalette(const Palette& palette) {
168 auto ec = GXBitmapSetPalette(m_handle, palette.get());
169 PDF_CHECK_SUCCESS(ec, "Failed to set the bitmap palette");
170 }
171
172 Palette GetPalette() const {
173 Palette palette;
174 auto ec = GXBitmapGetPalette(m_handle, &palette);
175 PDF_CHECK_SUCCESS(ec, "Failed to get the bitmap palette");
176 return palette;
177 }
178
179 GXLockedData Lock(GXLockMode mode, const RectI* rect = nullptr) {
180 GXLockedData lockdata;
181 auto ec = GXBitmapLock(m_handle, rect, mode, &lockdata);
182 PDF_CHECK_SUCCESS(ec, "Failed to lock the bitmap");
183 return lockdata;
184 }
185
186 void Unlock() {
187 auto ec = GXBitmapUnlock(m_handle);
188 PDF_CHECK_SUCCESS(ec, "Failed to unlock the bitmap");
189 }
190
191 void CopyFromBitmap(const Bitmap& source, const RectI* source_rect = nullptr, const PointI* dest_point = nullptr) {
192 auto ec = GXBitmapCopyFromBitmap(m_handle, dest_point, source.get(), source_rect);
193 PDF_CHECK_SUCCESS(ec, "Failed to copy the bitmap");
194 }
195
196 void CopyFromMemory(const GXLockedData& memory, const RectI* dest_rect = nullptr) {
197 auto ec = GXBitmapCopyFromMemory(m_handle, dest_rect, &memory);
198 PDF_CHECK_SUCCESS(ec, "Failed to copy the bitmap");
199 }
200
201 void CopyToMemory(const GXLockedData& memory, const RectI* source_rect = nullptr) const {
202 auto ec = GXBitmapCopyToMemory(m_handle, source_rect, &memory);
203 PDF_CHECK_SUCCESS(ec, "Failed to copy the bitmap");
204 }
205
206 void ColorFill(GXColorValue color, const RectI* fill_rect = nullptr) {
207 auto ec = GXBitmapColorFill(m_handle, fill_rect, color);
208 PDF_CHECK_SUCCESS(ec, "Failed to fill the bitmap");
209 }
210
211 void NotifyChanged() {
212 auto ec = GXBitmapNotifyChanged(m_handle);
213 PDF_CHECK_SUCCESS(ec, "Failed to notify the bitmap change");
214 }
215
216 void SetOffscreenPainting(bool offscreen) {
217 auto ec = GXBitmapSetOffscreenPainting(m_handle, offscreen);
218 PDF_CHECK_SUCCESS(ec, "Failed to set the bitmap offscreen");
219 }
220
221 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Bitmap, GXBitmap)
222};
223
225 BitmapScopedLock(const Bitmap& bm, GXLockMode mode = kGXLockModeRead, const PDF::RectI* rectp = nullptr)
226 : bitmap(bm) {
227 data = bitmap.Lock(mode, rectp);
228 }
230 try {
231 bitmap.Unlock();
232 } catch (...) {
233 /* ignore */
234 }
235 }
236 Bitmap bitmap;
237 GXLockedData data;
238};
239
244class SystemFont : public detail::RefCountedHandle<GXSysFont> {
245public:
246 std::wstring GetFamilyName() const {
247 return detail::GetWstringProperty(GXSysFontGetFamilyName, m_handle);
248 }
249
250 std::wstring GetPostScriptName() const {
251 return detail::GetWstringProperty(GXSysFontGetPostScriptName, m_handle);
252 }
253
254 std::wstring GetFontName() const {
255 return detail::GetWstringProperty(GXSysFontGetFontName, m_handle);
256 }
257
258 GXFontStyle GetStyle() const {
260 PDF_CHECK_SUCCESS_X(GXSysFontGetStyle(m_handle, &style));
261 return style;
262 }
263
264 GXFontFlags GetFontFlags() const {
265 GXFontFlags flags = 0;
266 PDF_CHECK_SUCCESS_X(GXSysFontGetFontFlags(m_handle, &flags));
267 return flags;
268 }
269
270 std::vector<GXUnicodeRange> GetUnicodeRanges() const {
271 size_t num_ranges = 0;
272 auto ec = GXSysFontGetUnicodeRanges(m_handle, nullptr, 0, &num_ranges);
273 if (ec == kPDErrSuccess)
274 return {};
275 if (ec != kPDErrBufferTooSmall)
276 PDF_CHECK_SUCCESS_X(ec);
277 std::vector<GXUnicodeRange> ranges(num_ranges);
278 PDF_CHECK_SUCCESS_X(GXSysFontGetUnicodeRanges(m_handle, ranges.data(), num_ranges, &num_ranges));
279 return ranges;
280 }
281
282 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(SystemFont, GXSysFont)
283};
284
285inline std::vector<SystemFont> ListSystemFonts() {
286 std::vector<SystemFont> fonts;
287 auto ec = GXEnumSysFonts(
288 [](void* userdata, GXSysFont sysfont) -> PDErrCode {
289 PDFSDK_CALLBACK_BEGIN
290 auto fonts = static_cast<std::vector<SystemFont>*>(userdata);
291 fonts->emplace_back(sysfont);
292 return kPDErrSuccess;
293 PDFSDK_CALLBACK_END
294 },
295 &fonts);
296 PDF_CHECK_SUCCESS_X(ec);
297 return fonts;
298}
299
300inline SystemFont FindSystemFont(const std::wstring& family, GXFontStyle style = kGXFontStyleRegular) {
301 GXSysFontQuery query = {};
302 query.matchFlags = kGXSysFontQueryMatchFamily | kGXSysFontQueryMatchWeight | kGXSysFontQueryMatchItalic;
303 query.family = family.c_str();
304 query.style = style;
305
306 SystemFont sysfont;
307 auto ec = GXFindSysFont(&query, &sysfont);
308 if (ec == kPDErrNotFound)
309 return nullptr;
310
311 PDF_CHECK_SUCCESS_X(ec);
312 return sysfont;
313}
314
315
320class FontFace : public detail::RefCountedHandle<GXFontFace> {
321public:
322 static FontFace FromSystemFont(const SystemFont& sysfont) {
323 FontFace fontface;
324 auto ec = GXCreateFontFaceFromSysFont(sysfont.get(), &fontface);
325 if (ec == kPDErrNotFound)
326 return nullptr;
327 PDF_CHECK_SUCCESS(ec, "Failed to create a font face");
328 return fontface;
329 }
330
331 static FontFace FromSystemFont(const std::wstring& family, GXFontStyle style = kGXFontStyleRegular) {
332 auto sysfont = FindSystemFont(family, style);
333 return FromSystemFont(sysfont);
334 }
335
336 static FontFace LoadFromFile(const std::filesystem::path& path, uint32_t faceindex = 0, uint32_t* ptotalfaces = nullptr) {
337 FontFace fontface;
338 auto path_string = path.wstring();
339 auto ec = GXCreateFontFaceFromFile(path_string.c_str(), faceindex, ptotalfaces, &fontface);
340 PDF_CHECK_SUCCESS(ec, "Failed to load a bitmap from file");
341 return fontface;
342 }
343
344 static FontFace LoadFromMemory(const void* data, size_t size, bool copyData = true, uint32_t faceindex = 0, uint32_t* ptotalfaces = nullptr) {
345 FontFace fontface;
346 auto ec = GXCreateFontFaceFromMemory(data, size, copyData, faceindex, ptotalfaces, &fontface);
347 PDF_CHECK_SUCCESS(ec, "Failed to load a bitmap from memory");
348 return fontface;
349 }
350
351 std::wstring GetFamilyName() const {
352 return detail::GetWstringProperty(GXFontFaceGetFamilyName, m_handle);
353 }
354
355 std::wstring GetPostScriptName() const {
356 return detail::GetWstringProperty(GXFontFaceGetPostScriptName, m_handle);
357 }
358
359 std::wstring GetFontName() const {
360 return detail::GetWstringProperty(GXFontFaceGetFontName, m_handle);
361 }
362
363 GXFontStyle GetStyle() const {
365 PDF_CHECK_SUCCESS_X(GXFontFaceGetStyle(m_handle, &style));
366 return style;
367 }
368
369 GXFontFlags GetFontFlags() const {
370 GXFontFlags flags = 0;
371 PDF_CHECK_SUCCESS_X(GXFontFaceGetFontFlags(m_handle, &flags));
372 return flags;
373 }
374
375 std::vector<GXUnicodeRange> GetUnicodeRanges() const {
376 size_t num_ranges = 0;
377 auto ec = GXFontFaceGetUnicodeRanges(m_handle, nullptr, 0, &num_ranges);
378 if (ec == kPDErrSuccess)
379 return {};
380 if (ec != kPDErrBufferTooSmall)
381 PDF_CHECK_SUCCESS_X(ec);
382 std::vector<GXUnicodeRange> ranges(num_ranges);
383 PDF_CHECK_SUCCESS_X(GXFontFaceGetUnicodeRanges(m_handle, ranges.data(), num_ranges, &num_ranges));
384 return ranges;
385 }
386
387 GXFontMetrics GetMetrics() const {
388 GXFontMetrics metrics;
389 auto ec = GXFontFaceGetMetrics(m_handle, &metrics);
390 PDF_CHECK_SUCCESS(ec, "Failed to get the font metrics");
391 return metrics;
392 }
393
394 uint32_t GetGlyphIndex(uint32_t unicode) const {
395 uint32_t gid = 0;
396 auto ec = GXFontFaceGetGlyphIndex(m_handle, unicode, &gid);
397 PDF_CHECK_SUCCESS(ec, "Failed to get the glyph index");
398 return gid;
399 }
400
401 /*
402 * Opens a stream for reading a specific table in the font.
403 * @param tableTag The tag of the table to open. If 0, the entire font data is returned.
404 * @return A read stream for the table data.
405 */
406 ReadStream OpenFontStream(uint32_t tableTag = 0) const {
407 ReadStream stream;
408 auto ec = GXFontFaceOpenFontStream(m_handle, tableTag, &stream);
409 PDF_CHECK_SUCCESS(ec, "Failed to open the font table stream");
410 return stream;
411 }
412
413 RectF CalculateTextBound(float fontSize, const std::wstring& text) const {
414 RectF bound;
415 auto ec = GXFontFaceCalculateTextBound(m_handle, fontSize, text.c_str(), &bound);
416 PDF_CHECK_SUCCESS(ec, "Failed to calculate the text bound");
417 return bound;
418 }
419
420 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(FontFace, GXFontFace)
421};
422
427class Geometry : public detail::RefCountedHandle<GXGeometry> {
428public:
429 static Geometry New() {
430 Geometry geom;
431 auto ec = GXCreateGeometry(&geom);
432 PDF_CHECK_SUCCESS(ec, "Failed to create a geometry");
433 return geom;
434 }
435
436 static Geometry NewFromRectangle(const PDF::RectF& rect) {
437 Geometry geom = New();
438 geom.Rectangle(rect);
439 return geom;
440 }
441
442 void SetFillRule(GXFillRule fillrule) {
443 auto ec = GXGeometrySetFillRule(m_handle, fillrule);
444 PDF_CHECK_SUCCESS(ec, "Failed to set the geometry fill rule");
445 }
446
447 GXFillRule GetFillRule() const {
449 auto ec = GXGeometryGetFillRule(m_handle, &fillrule);
450 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry fill rule");
451 return fillrule;
452 }
453
454 bool IsPointsEmpty() const {
455 bool empty = false;
456 auto ec = GXGeometryEmpty(m_handle, &empty);
457 PDF_CHECK_SUCCESS(ec, "Failed to check the geometry points");
458 return empty;
459 }
460
461 bool IsPointsEqual(const Geometry& rhs) const {
462 bool empty = false;
463 auto ec = GXGeometryPointsEqual(m_handle, rhs.get(), &empty);
464 PDF_CHECK_SUCCESS(ec, "Failed to check the geometry points");
465 return empty;
466 }
467
468 bool GetCurrentPoint(PointF* presult) const {
469 auto ec = GXGeometryGetCurrentPoint(m_handle, presult);
470 if (ec == kPDErrNotFound)
471 return false;
472 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry points");
473 return true;
474 }
475
476 RectF GetBound(const Matrix* xform = nullptr) const {
477 RectF bound;
478 auto ec = GXGeometryGetBound(m_handle, xform, &bound);
479 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry bound");
480 return bound;
481 }
482
483 RectF GetWidenBound(float lineWidth, const GXStrokeParams& params, const Matrix* xform = nullptr, float flatness = 0.75f) const {
484 if (Math::FloatEq(lineWidth, 0.0f))
485 lineWidth = flatness;
486 auto widenGeometry = Widen(lineWidth, params);
487 return widenGeometry.GetBound(xform);
488 }
489
490 void BeginFigure(const PointF& point) {
491 auto ec = GXGeometryBeginFigure(m_handle, &point);
492 PDF_CHECK_SUCCESS(ec, "Failed to begin figure");
493 }
494
495 void EndFigure() {
496 auto ec = GXGeometryEndFigure(m_handle);
497 PDF_CHECK_SUCCESS(ec, "Failed to end figure");
498 }
499
500 void EndFigureClose() {
501 auto ec = GXGeometryEndFigureClose(m_handle);
502 PDF_CHECK_SUCCESS(ec, "Failed to close figure");
503 }
504
505 void LineTo(const PointF& to) {
506 auto ec = GXGeometryLineTo(m_handle, &to);
507 PDF_CHECK_SUCCESS(ec, "Failed to add points to the geometry");
508 }
509
510 void CurveTo(const PointF& c, const PointF& to) {
511 auto ec = GXGeometryConicCurveTo(m_handle, &c, &to);
512 PDF_CHECK_SUCCESS(ec, "Failed to add points to the geometry");
513 }
514
515 void CurveTo(const PointF& c0, const PointF& c1, const PointF& to) {
516 auto ec = GXGeometryCubicCurveTo(m_handle, &c0, &c1, &to);
517 PDF_CHECK_SUCCESS(ec, "Failed to add points to the geometry");
518 }
519
520 void Rectangle(const RectF& rect) {
521 auto ec = GXGeometryRectangle(m_handle, &rect);
522 PDF_CHECK_SUCCESS(ec, "Failed to add points to the geometry");
523 }
524
525 void Ellipse(const RectF& bound) {
526 auto ec = GXGeometryEllipse(m_handle, &bound);
527 PDF_CHECK_SUCCESS(ec, "Failed to add points to the geometry");
528 }
529
530 void RoundRectangle(const RectF& rect, float xradii, float yradii) {
531 auto ec = GXGeometryRoundRectangle(m_handle, &rect, xradii, yradii);
532 PDF_CHECK_SUCCESS(ec, "Failed to add points to the geometry");
533 }
534
535 Geometry Copy() const {
536 Geometry copy;
537 auto ec = GXGeometryCopy(m_handle, &copy);
538 PDF_CHECK_SUCCESS(ec, "Failed to copy the geometry");
539 return copy;
540 }
541
542 Geometry Transform(const Matrix& xform) const {
543 Geometry result;
544 auto ec = GXGeometryTransform(m_handle, &xform, &result);
545 PDF_CHECK_SUCCESS(ec, "Failed to transform the geometry");
546 return result;
547 }
548
549 Geometry Widen(float width, const GXStrokeParams& params, float flatness = 0.75) const {
550 Geometry result;
551 auto ec = GXGeometryWiden(m_handle, width, &params, flatness, &result);
552 PDF_CHECK_SUCCESS(ec, "Failed to widen the geometry");
553 return result;
554 }
555
556 Geometry Combine(GXCombineMode mode,
557 const Geometry& rhs,
558 const Matrix* xform = nullptr,
559 float flatness = 0.75) const {
560 Geometry result;
561 auto ec = GXGeometryCombine(m_handle, rhs.get(), xform, mode, flatness, &result);
562 PDF_CHECK_SUCCESS(ec, "Failed to combine the geometries");
563 return result;
564 }
565
566 bool HitTest(const PointF& point) const {
567 bool hit = false;
568 auto ec = GXGeometryHitTest(m_handle, &point, &hit);
569 PDF_CHECK_SUCCESS(ec, "Failed to hit test the geometry");
570 return hit;
571 }
572
573 Geometry Simplify(float flatness = 0.75) const {
574 Geometry result;
575 auto ec = GXGeometrySimplify(m_handle, flatness, &result);
576 PDF_CHECK_SUCCESS(ec, "Failed to simplify the geometries");
577 return result;
578 }
579
580 std::optional<RectF> IsRectangle(const Matrix& xform = Matrix{}) const {
581 bool isrectangle = false;
582 RectF rectangle;
583 auto ec = GXGeometryIsRectangle(m_handle, &xform, &isrectangle, &rectangle);
584 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry rectangle");
585 if (!isrectangle)
586 return std::nullopt;
587 return rectangle;
588 }
589
590 bool IsSingleLine() const {
591 if (GetNumFigures() > 1)
592 return false;
593
594 if (GetFigureNumPoints(0) != 2)
595 return false;
596
597 return true;
598 }
599
600 size_t GetNumFigures() const {
601 size_t numfigures = 0;
602 auto ec = GXGeometryGetNumFigures(m_handle, &numfigures);
603 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figures");
604 return numfigures;
605 }
606
607 size_t GetFigureNumSegments(size_t figureindex) const {
608 size_t numsegs = 0;
609 auto ec = GXGeometryGetFigureNumSegments(m_handle, figureindex, &numsegs);
610 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figure segments");
611 return numsegs;
612 }
613
614 size_t GetFigureNumPoints(size_t figureindex) const {
615 size_t numpoints = 0;
616 auto ec = GXGeometryGetFigureNumPoints(m_handle, figureindex, &numpoints);
617 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figure points");
618 return numpoints;
619 }
620
621 const PointF* GetFigurePointsPtr(size_t figureindex) const {
622 const PDPointF* points = nullptr;
623 auto ec = GXGeometryGetFigurePointsPtr(m_handle, figureindex, &points);
624 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figure start point");
625 static_assert(sizeof(PointF) == sizeof(PDPointF), "Size of PointF and PDPointF must be equal");
626 return reinterpret_cast<const PointF*>(points);
627 }
628
629 bool IsFigureSegmentCurve(size_t figureindex, size_t segindex) const {
630 bool iscurve = false;
631 auto ec = GXGeometryIsFigureSegmentCurve(m_handle, figureindex, segindex, &iscurve);
632 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figure segment points");
633 return iscurve;
634 }
635
636 size_t GetFigureSegmentPointsIndex(size_t figureindex, size_t segindex) const {
637 size_t pointsindex = 0;
638 auto ec = GXGeometryGetFigureSegmentPointsIndex(m_handle, figureindex, segindex, &pointsindex);
639 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figure segment points");
640 return pointsindex;
641 }
642
643 bool IsFigureClosed(size_t figureindex) const {
644 bool isclosed = false;
645 auto ec = GXGeometryIsFigureClosed(m_handle, figureindex, &isclosed);
646 PDF_CHECK_SUCCESS(ec, "Failed to get the geometry figure closed");
647 return isclosed;
648 }
649
650 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Geometry, GXGeometry)
651};
652
657class Gradient : public detail::RefCountedHandle<GXGradient> {
658public:
659 static Gradient NewLinearGradient(const GXLinearGradientAttrs& attrs) {
660 Gradient gradient;
661 auto ec = GXCreateGradientLinear(&attrs, &gradient);
662 PDF_CHECK_SUCCESS(ec, "Failed to create a gradient");
663 return gradient;
664 }
665
666 static Gradient NewRadialGradient(const GXRadialGradientAttrs& attrs) {
667 Gradient gradient;
668 auto ec = GXCreateGradientRadial(&attrs, &gradient);
669 PDF_CHECK_SUCCESS(ec, "Failed to create a gradient");
670 return gradient;
671 }
672
673 static Gradient NewTriMeshGradient(const GXMeshVertex* vertices, size_t num_vertices, GXColorValue bgcolor) {
674 Gradient gradient;
675 auto ec = GXCreateGradientTriMesh(vertices, num_vertices, bgcolor, &gradient);
676 PDF_CHECK_SUCCESS(ec, "Failed to create a gradient");
677 return gradient;
678 }
679
680 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Gradient, GXGradient)
681};
682
687class Brush : public detail::RefCountedHandle<GXBrush> {
688public:
689 static Brush NewSolidBrush(const GXColor& color) {
690 Brush brush;
691 auto ec = GXCreateBrushSolid(&color, &brush);
692 PDF_CHECK_SUCCESS(ec, "Failed to create a brush");
693 return brush;
694 }
695
696 static Brush NewSolidBrush(GXColorValue argb) {
697 Brush brush;
698 auto ec = GXCreateBrushSolidARGB(argb, &brush);
699 PDF_CHECK_SUCCESS(ec, "Failed to create a brush");
700 return brush;
701 }
702
703 static Brush NewBitmapBrush(const Bitmap& bitmap,
704 const GXBitmapBrushAttrs& attrs,
705 float opacity = 1,
706 const Matrix* xform = nullptr) {
707 Brush brush;
708 auto ec = GXCreateBrushBitmap(bitmap.get(), opacity, &attrs, xform, &brush);
709 PDF_CHECK_SUCCESS(ec, "Failed to create a brush");
710 return brush;
711 }
712
713 static Brush NewGradientBrush(const Gradient& gradient, float opacity = 1, const Matrix* xform = nullptr) {
714 Brush brush;
715 auto ec = GXCreateBrushGradient(gradient.get(), opacity, xform, &brush);
716 PDF_CHECK_SUCCESS(ec, "Failed to create a brush");
717 return brush;
718 }
719
720 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Brush, GXBrush)
721};
722
727class Region : public detail::RefCountedHandle<GXRegion> {
728public:
729 static Region New() {
730 Region region;
731 auto ec = GXCreateRegion(&region);
732 PDF_CHECK_SUCCESS(ec, "Failed to create a region");
733 return region;
734 }
735
736 static Region NewFromRect(const RectI& rect) {
737 Region region;
738 auto ec = GXCreateRegionFromRect(&rect, &region);
739 PDF_CHECK_SUCCESS(ec, "Failed to create a region");
740 return region;
741 }
742
743 bool IsAreaEmpty() const {
744 bool empty = false;
745 auto ec = GXRegionIsAreaEmpty(m_handle, &empty);
746 PDF_CHECK_SUCCESS(ec, "Failed to check the region area");
747 return empty;
748 }
749
750 RectI GetBound() const {
751 RectI bound;
752 auto ec = GXRegionGetBound(m_handle, &bound);
753 PDF_CHECK_SUCCESS(ec, "Failed to get the region bound");
754 return bound;
755 }
756
757 bool Contains(const PointI& point) const {
758 bool contains = false;
759 auto ec = GXRegionContainsPoint(m_handle, &point, &contains);
760 PDF_CHECK_SUCCESS(ec, "Failed to hit test the region");
761 return contains;
762 }
763
764 bool Contains(const RectI& rect) const {
765 bool contains = false;
766 auto ec = GXRegionContainsRect(m_handle, &rect, &contains);
767 PDF_CHECK_SUCCESS(ec, "Failed to hit test the region");
768 return contains;
769 }
770
771 bool Contains(const Region& region) const {
772 bool contains = false;
773 auto ec = GXRegionContains(m_handle, region.get(), &contains);
774 PDF_CHECK_SUCCESS(ec, "Failed to hit test the region");
775 return contains;
776 }
777
778 bool HasIntersection(const RectI& rect) const {
779 bool isects = false;
780 auto ec = GXRegionHasIntersectionWithRect(m_handle, &rect, &isects);
781 PDF_CHECK_SUCCESS(ec, "Failed to check the regions intersection");
782 return isects;
783 }
784
785 bool HasIntersection(const Region& region) const {
786 bool isects = false;
787 auto ec = GXRegionHasIntersection(m_handle, region.get(), &isects);
788 PDF_CHECK_SUCCESS(ec, "Failed to check the regions intersection");
789 return isects;
790 }
791
792 void Offset(int dx, int dy) {
793 auto ec = GXRegionOffset(m_handle, dx, dy);
794 PDF_CHECK_SUCCESS(ec, "Failed to offset the region");
795 }
796
797 void Combine(GXCombineMode mode, const Region& region) {
798 Region result;
799 auto ec = GXRegionCombine(m_handle, region.get(), mode, &result);
800 PDF_CHECK_SUCCESS(ec, "Failed to combine the regions");
801 *this = std::move(result);
802 }
803
804 void Combine(GXCombineMode mode, const RectI& rect) {
805 Region result;
806 auto ec = GXRegionCombineRect(m_handle, &rect, mode, &result);
807 PDF_CHECK_SUCCESS(ec, "Failed to combine the regions");
808 *this = std::move(result);
809 }
810
811 using RectEnumFunc = std::function<bool(const RectI&)>;
812
813 void EnumRects(RectEnumFunc func) const {
814 auto enumProc = [](void* userdata, const PDRectI* rect) -> PDErrCode {
815 PDFSDK_CALLBACK_BEGIN
816 auto& func = *reinterpret_cast<RectEnumFunc*>(userdata);
817 return func(*rect) ? kPDErrSuccess : kPDErrCanceled;
818 PDFSDK_CALLBACK_END
819 };
820 auto ec = GXRegionEnumRects(m_handle, enumProc, &func);
821 if (ec != kPDErrCanceled)
822 PDF_CHECK_SUCCESS(ec, "Failed to enum the region rects");
823 }
824
825 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Region, GXRegion)
826};
827
832class RenderTarget : public detail::RefCountedHandle<GXRenderTarget> {
833public:
834 static RenderTarget NewBitmapRenderTarget(const Bitmap& bitmap) {
835 RenderTarget target;
836 auto ec = GXCreateRenderTargetBitmap(bitmap.get(), &target);
837 PDF_CHECK_SUCCESS(ec, "Failed to create the render target");
838 return target;
839 }
840
841 static RenderTarget NewExtBufRenderTarget(void* pixels,
842 int stride,
843 const SizeI& size,
844 GXPixelFormat format,
845 float dpiX = 96,
846 float dpiY = 96) {
847 RenderTarget target;
848 GXBitmapAttrs attrs = {size, format, dpiX, dpiY};
849 auto ec = GXCreateRenderTargetExtBuf(pixels, stride, &attrs, &target);
850 PDF_CHECK_SUCCESS(ec, "Failed to create the render target");
851 return target;
852 }
853
854#ifdef _WIN32
855
856 static RenderTarget NewHwndRenderTarget(void* hwnd, GXRuntimeMode mode = kGXRuntimeModeHardware) {
857 RenderTarget target;
858 auto ec = GXCreateRenderTargetHWND(hwnd, mode, &target);
859 PDF_CHECK_SUCCESS(ec, "Failed to create the render target");
860 return target;
861 }
862
863 static RenderTarget NewPrintRenderTarget(void* hdc) {
864 RenderTarget target;
865 auto ec = GXCreateRenderTargetPrintDC(hdc, &target);
866 PDF_CHECK_SUCCESS(ec, "Failed to create the render target");
867 return target;
868 }
869
870 static RenderTarget NewHdcRenderTarget(void* hdc, const RectI* rect = nullptr) {
871 RenderTarget target;
872 auto ec = GXCreateRenderTargetHDC(hdc, rect, &target);
873 PDF_CHECK_SUCCESS(ec, "Failed to create the render target");
874 return target;
875 }
876
877#endif // _WIN32
878
879#ifdef __APPLE__
880
881 static RenderTarget NewNSViewRenderTarget(void* nsview, GXRuntimeMode mode = kGXXRuntimeModeHardware) {
882 RenderTarget target;
883 auto ec = GXCreateRenderTargetNSView(nsview, mode, &target);
884 PDF_CHECK_SUCCESS(ec, "Failed to create the render target");
885 return target;
886 }
887
888#endif // __APPLE__
889
890 GXPixelFormat GetPixelFormat() {
892 auto ec = GXRenderTargetGetPixelFormat(m_handle, &format);
893 PDF_CHECK_SUCCESS(ec, "Failed to get the render target pixel format");
894 return format;
895 }
896
897 SizeI GetSize() {
898 SizeI size;
899 auto ec = GXRenderTargetGetSize(m_handle, &size);
900 PDF_CHECK_SUCCESS(ec, "Failed to get the render target size");
901 return size;
902 }
903
904 void Clear(GXColorValue clrcolor) {
905 auto ec = GXRenderTargetClear(m_handle, clrcolor);
906 PDF_CHECK_SUCCESS(ec, "Failed to clear the render target");
907 }
908
910 public:
911 PaintScope(RenderTarget& target)
912 : m_target(target) {
913 m_target.BeginPaint();
914 }
915
916 ~PaintScope() {
917 try {
918 m_target.EndPaint();
919 } catch (...) {
920 }
921 }
922
923 PaintScope(const PaintScope&) = delete;
924 PaintScope& operator=(const PaintScope&) = delete;
925
926 private:
927 RenderTarget& m_target;
928 };
929
930 void BeginPaint() {
931 auto ec = GXRenderTargetBeginPaint(m_handle);
932 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
933 }
934
935 bool EndPaint() {
936 auto ec = GXRenderTargetEndPaint(m_handle);
937 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
938 return true;
939 }
940
942 public:
943 StateScope(RenderTarget& target)
944 : m_target(target) {
945 m_target.PushState();
946 }
947
948 ~StateScope() {
949 try {
950 m_target.PopState();
951 } catch (...) {
952 }
953 }
954
955 StateScope(const StateScope&) = delete;
956 StateScope& operator=(const StateScope&) = delete;
957
958 private:
959 RenderTarget& m_target;
960 };
961
962 void PushState() {
963 auto ec = GXRenderTargetPushState(m_handle);
964 PDF_CHECK_SUCCESS(ec, "Failed to push the render target state");
965 }
966
967 void PopState() {
968 auto ec = GXRenderTargetPopState(m_handle);
969 PDF_CHECK_SUCCESS(ec, "Failed to pop the render target state");
970 }
971
972 class CTMScope {
973 public:
974 CTMScope(RenderTarget& target)
975 : m_target(target) {
976 m_ctm = m_target.GetCTM();
977 }
978
979 ~CTMScope() {
980 try {
981 m_target.SetCTM(m_ctm);
982 } catch (...) {
983 }
984 }
985
986 CTMScope(const CTMScope&) = delete;
987 CTMScope& operator=(const CTMScope&) = delete;
988
989 private:
990 RenderTarget& m_target;
991 Matrix m_ctm;
992 };
993
994 Matrix GetCTM() const {
995 Matrix ctm;
996 auto ec = GXRenderTargetGetCTM(m_handle, &ctm);
997 PDF_CHECK_SUCCESS(ec, "Failed to get the render target CTM");
998 return ctm;
999 }
1000
1001 void SetCTM(const Matrix& ctm) {
1002 auto ec = GXRenderTargetSetCTM(m_handle, &ctm);
1003 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1004 }
1005
1006 void ConcatCTM(const Matrix& xform) {
1007 auto ec = GXRenderTargetConcatCTM(m_handle, &xform);
1008 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1009 }
1010
1011 void RotateCTM(float radians) {
1012 auto ec = GXRenderTargetRotateCTM(m_handle, radians);
1013 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1014 }
1015
1016 void ScaleCTM(float scale) {
1017 auto ec = GXRenderTargetScaleCTM(m_handle, scale, scale);
1018 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1019 }
1020
1021 void ScaleCTM(float sx, float sy) {
1022 auto ec = GXRenderTargetScaleCTM(m_handle, sx, sy);
1023 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1024 }
1025
1026 void ScaleCTM(const SizeF& scale) {
1027 auto ec = GXRenderTargetScaleCTM(m_handle, scale.width, scale.height);
1028 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1029 }
1030
1031 void TranslateCTM(float dx, float dy) {
1032 auto ec = GXRenderTargetTranslateCTM(m_handle, dx, dy);
1033 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1034 }
1035
1036 void TranslateCTM(const PointF& delta) {
1037 auto ec = GXRenderTargetTranslateCTM(m_handle, delta.x, delta.y);
1038 PDF_CHECK_SUCCESS(ec, "Failed to modify the render target CTM");
1039 }
1040
1041 void SetBlendMode(GXBlendMode mode) {
1042 auto ec = GXRenderTargetSetBlendMode(m_handle, mode);
1043 PDF_CHECK_SUCCESS(ec, "Failed to set the render target blend mode");
1044 }
1045
1046 void SetStrokeAdjustment(bool adjust) {
1047 auto ec = GXRenderTargetSetStrokeAdjustment(m_handle, adjust);
1048 PDF_CHECK_SUCCESS(ec, "Failed to set the render target stroke adjust");
1049 }
1050
1051 bool GetStrokeAdjustment() const {
1052 bool adjust = false;
1053 auto ec = GXRenderTargetGetStrokeAdjustment(m_handle, &adjust);
1054 PDF_CHECK_SUCCESS(ec, "Failed to get the render target stroke adjust");
1055 return adjust;
1056 }
1057
1058 void SetOpacityMask(GXMaskMode mode, const Brush& mask) {
1059 auto ec = GXRenderTargetSetOpacityMask(m_handle, mode, mask.get());
1060 PDF_CHECK_SUCCESS(ec, "Failed to set the render target mask");
1061 }
1062
1063 void SetShapeMask(GXMaskMode mode, const Brush& mask) {
1064 auto ec = GXRenderTargetSetShapeMask(m_handle, mode, mask.get());
1065 PDF_CHECK_SUCCESS(ec, "Failed to set the render target mask");
1066 }
1067
1068 void BeginLayer(const GXLayerParams& params) {
1069 auto ec = GXRenderTargetBeginLayer(m_handle, &params);
1070 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1071 }
1072
1073 void EndLayer() {
1074 auto ec = GXRenderTargetEndLayer(m_handle);
1075 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1076 }
1077
1078 void FillGeometry(const Geometry& geom, const Brush& brush) {
1079 auto ec = GXRenderTargetFillGeometry(m_handle, geom.get(), brush.get());
1080 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1081 }
1082
1083 void FillTextGeometry(const Geometry& geom, const Brush& brush) {
1084 auto ec = GXRenderTargetFillTextGeometry(m_handle, geom.get(), brush.get());
1085 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1086 }
1087
1088 void FillRect(const RectF& rect, const Brush& brush) {
1089 auto ec = GXRenderTargetFillRect(m_handle, &rect, brush.get());
1090 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1091 }
1092
1093 void FillEllipse(const RectF& bound, const Brush& brush) {
1094 auto ec = GXRenderTargetFillEllipse(m_handle, &bound, brush.get());
1095 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1096 }
1097
1098 void StrokeGeometry(const Geometry& geom, const Brush& brush, float width, const GXStrokeParams* params = nullptr) {
1099 auto ec = GXRenderTargetStrokeGeometry(m_handle, geom.get(), brush.get(), width, params);
1100 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1101 }
1102
1103 void StrokeLine(const PointF& start,
1104 const PointF& end,
1105 const Brush& brush,
1106 float width,
1107 const GXStrokeParams* params = nullptr) {
1108 auto ec = GXRenderTargetStrokeLine(m_handle, &start, &end, brush.get(), width, params);
1109 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1110 }
1111
1112 void StrokeRect(const RectF& rect, const Brush& brush, float width, const GXStrokeParams* params = nullptr) {
1113 auto ec = GXRenderTargetStrokeRect(m_handle, &rect, brush.get(), width, params);
1114 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1115 }
1116
1117 void StrokeEllipse(const RectF& bound, const Brush& brush, float width, const GXStrokeParams* params = nullptr) {
1118 auto ec = GXRenderTargetStrokeEllipse(m_handle, &bound, brush.get(), width, params);
1119 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1120 }
1121
1122 void ClipGeometry(const Geometry& geom) {
1123 auto ec = GXRenderTargetClipGeometry(m_handle, geom.get());
1124 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1125 }
1126
1127 void ClipRect(const RectF& rect) {
1128 auto ec = GXRenderTargetClipRect(m_handle, &rect);
1129 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1130 }
1131
1132 void ClipEllipse(const RectF& bound) {
1133 auto ec = GXRenderTargetClipEllipse(m_handle, &bound);
1134 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1135 }
1136
1137 void DrawBitmap(const Bitmap& bitmap,
1138 float opacity = 1,
1140 auto ec = GXRenderTargetDrawBitmap(m_handle, bitmap.get(), opacity, imode);
1141 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1142 }
1143
1144 void StretchBitmap(const Bitmap& bitmap,
1145 const RectF& target_rect,
1146 float opacity = 1,
1148 auto ec = GXRenderTargetStretchBitmap(m_handle, bitmap.get(), &target_rect, opacity, imode);
1149 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1150 }
1151
1152 void DrawGradient(const Gradient& gradient, float opacity) {
1153 auto ec = GXRenderTargetDrawGradient(m_handle, gradient.get(), opacity);
1154 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1155 }
1156
1157 void FillMask(const Bitmap& mask,
1158 const Brush& brush,
1160 auto ec = GXRenderTargetFillMask(m_handle, mask.get(), brush.get(), imode);
1161 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1162 }
1163
1164 void InvertRect(const RectF& rect) {
1165 auto ec = GXRenderTargetInvertRect(m_handle, &rect);
1166 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1167 }
1168
1169 void InvertLine(const PointI& start, const PointI& end) {
1170 auto ec = GXRenderTargetInvertLine(m_handle, &start, &end);
1171 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1172 }
1173
1174 void FillText(const FontFace& font, float fontSize, const std::wstring& text, const Brush& brush) {
1175 auto ec = GXRenderTargetFillText(m_handle, font.get(), fontSize, text.c_str(), brush.get());
1176 PDF_CHECK_SUCCESS(ec, "Failed to paint the render target");
1177 }
1178
1179 RectI GetDrawBounds() {
1180 RectI bounds;
1181 auto ec = GXRenderTargetGetDrawBounds(m_handle, &bounds);
1182 PDF_CHECK_SUCCESS(ec, "Failed to get the render target draw bounds");
1183 return bounds;
1184 }
1185
1186 float GetDpiX() const {
1187 float dpiX = 96.0f;
1188 auto ec = GXRenderTargetGetDpiX(m_handle, &dpiX);
1189 PDF_CHECK_SUCCESS(ec, "Failed to get the render target DPI X");
1190 return dpiX;
1191 }
1192
1193 float GetDpiY() const {
1194 float dpiY = 96.0f;
1195 auto ec = GXRenderTargetGetDpiY(m_handle, &dpiY);
1196 PDF_CHECK_SUCCESS(ec, "Failed to get the render target DPI Y");
1197 return dpiY;
1198 }
1199
1200 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(RenderTarget, GXRenderTarget)
1201};
1202
1203} // namespace Graphics
1204} // namespace PDF
1205
1206#endif // PDFSDK_CXX_GRAPHICS_H_INCLUDED_
Represents a bitmap.
Definition graphics.h:63
Represents a brush.
Definition graphics.h:687
Represents a font face.
Definition graphics.h:320
Represents a geometry.
Definition graphics.h:427
Represents a gradient.
Definition graphics.h:657
Represents a color palette.
Definition graphics.h:26
Represents a region.
Definition graphics.h:727
Definition graphics.h:972
Represents a render target.
Definition graphics.h:832
Represents a system font.
Definition graphics.h:244
Represents a read stream for reading data.
Definition read_stream.h:15
@ kPDErrSuccess
Operation was successful.
Definition errors.h:18
@ kPDErrBufferTooSmall
Memory buffer too small, increase buffer size.
Definition errors.h:25
@ kPDErrNotFound
Object not found.
Definition errors.h:21
@ kPDErrCanceled
Operation was cancelled by user.
Definition errors.h:17
int32_t PDErrCode
Definition errors.h:44
Graphics API.
GXLockMode
Defines the level of access and control over the graphics content.
Definition graphics.h:87
@ kGXLockModeRead
Definition graphics.h:88
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateRenderTargetBitmap(GXBitmap bitmap, GXRenderTarget *ptarget)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateBitmap(const GXBitmapAttrs *attrs, GXBitmap *pbitmap)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateFontFaceFromSysFont(GXSysFont sysfont, GXFontFace *pfontface)
GXFillRule
Determines how a path (a series or points that define a shape) is filled with color.
Definition graphics.h:117
@ kGXFillRuleNonZero
Definition graphics.h:118
GXInterpolationMode
Defines the way through which pixel values are estimated or interpolated.
Definition graphics.h:104
@ kGXInterpolationModeAreaAverage
Definition graphics.h:107
GXRuntimeMode
Defines the runtime modes for the Graphics application.
Definition graphics.h:39
@ kGXRuntimeModeHardware
Definition graphics.h:40
GXBlendMode
Determines the way in which colors of overlapping objects are combined.
Definition graphics.h:136
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateBrushSolid(const GXColor *color, GXBrush *pbrush)
GXCombineMode
Determines how the areas of different graphics interact with each other.
Definition graphics.h:190
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXEnumSysFonts(GXSysFontEnumProc proc, void *userdata)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreatePalette(const GXColorValue *colors, size_t num_colors, GXPalette *ppalette)
GXFontStyle
Defines the various styles that can be applied to text within a PDF document.
Definition graphics.h:316
@ kGXFontStyleRegular
Definition graphics.h:317
GXMaskMode
Determines the type of mask used to control which parts of an image or graphical element are visible ...
Definition graphics.h:171
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateGradientLinear(const GXLinearGradientAttrs *attrs, GXGradient *pgradient)
GXPixelFormat
Defines the pixel format of the graphics application.
Definition graphics.h:64
@ kGXPixelFormatP8
Definition graphics.h:75
@ kGXPixelFormatA8
Definition graphics.h:74
@ kGXPixelFormatXRGB8
Definition graphics.h:72
@ kGXPixelFormatARGB8p
Definition graphics.h:67
@ kGXPixelFormatUnknown
Definition graphics.h:65
@ kGXPixelFormatL1
Definition graphics.h:79
@ kGXPixelFormatRGB8
Definition graphics.h:66
@ kGXPixelFormatA1
Definition graphics.h:77
@ kGXPixelFormatL8
Definition graphics.h:76
@ kGXPixelFormatP1
Definition graphics.h:78
@ kGXPixelFormatARGB8
Definition graphics.h:70
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateRegion(GXRegion *pregion)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateGeometry(GXGeometry *pgeom)
Definition graphics.h:253
Definition graphics.h:305
Definition graphics.h:45
Definition graphics.h:323
Definition graphics.h:198
Definition graphics.h:265
Definition graphics.h:93
Definition graphics.h:287
Definition graphics.h:275
Definition graphics.h:246
Definition graphics.h:371
Definition graphics.h:224
Definition math.h:1271
Definition math.h:154
Definition math.h:53
Definition math.h:749
Definition math.h:541
Definition math.h:460
Definition math_types.h:12
Definition math_types.h:44