3#ifndef PDFSDK_CXX_GRAPHICS_H_INCLUDED_
4#define PDFSDK_CXX_GRAPHICS_H_INCLUDED_
16#include <pdfsdk/cxx/bytes.h>
17#include <pdfsdk/cxx/callback.h>
18#include <pdfsdk/cxx/helpers.h>
19#include <pdfsdk/cxx/math.h>
20#include <pdfsdk/cxx/read_stream.h>
23#include "wrapper_base.h"
32class Palette :
public detail::RefCountedHandle<GXPalette> {
34 static Palette New(
const GXColorValue* colors,
size_t num_colors) {
37 PDF_CHECK_SUCCESS(ec,
"Failed to create a palette");
41 const GXColorValue* GetColorsPtr()
const {
42 const GXColorValue* colors =
nullptr;
43 auto ec = GXPaletteGetColors(m_handle, &colors);
44 PDF_CHECK_SUCCESS(ec,
"Failed to get palette colors");
48 size_t GetNumColors()
const {
49 size_t num_colors = 0;
50 auto ec = GXPaletteGetNumColors(m_handle, &num_colors);
51 PDF_CHECK_SUCCESS(ec,
"Failed to get the number of palette colors");
55 GXColorValue GetColor(
size_t index)
const {
56 GXColorValue color = 0;
57 auto ec = GXPaletteGetColor(m_handle, index, &color);
58 PDF_CHECK_SUCCESS(ec,
"Failed to get palette color by index");
62 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Palette, GXPalette)
69class Bitmap :
public detail::RefCountedHandle<GXBitmap> {
71 static Bitmap New(
const SizeI& size,
GXPixelFormat format,
float dpiX = 96,
float dpiY = 96) {
75 PDF_CHECK_SUCCESS(ec,
"Failed to create a bitmap");
79 static Bitmap LoadFromFile(
const std::filesystem::path& path, uint32_t frame_index = 0, uint32_t* ptotal_frames =
nullptr) {
81 auto path_string = path.wstring();
82 auto ec = GXCreateBitmapFromFileFrame(path_string.c_str(), frame_index, ptotal_frames, &bitmap);
83 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from file");
87 static Bitmap LoadFromMemory(std::span<const Byte> data, uint32_t frame_index = 0, uint32_t* ptotal_frames =
nullptr) {
89 auto ec = GXCreateBitmapFromMemoryFrame(data.data(), data.size(), frame_index, ptotal_frames, &bitmap);
90 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from memory");
95 static Bitmap NewFromHBITMAP(
void* hbitmap) {
97 auto ec = GXCreateBitmapFromHBITMAP(hbitmap, &bitmap);
98 PDF_CHECK_SUCCESS(ec,
"Failed to create a bitmap from HBITMAP");
103 void SaveToFile(
const std::filesystem::path& path)
const {
104 auto path_string = path.wstring();
105 auto ec = GXBitmapSaveToFile(m_handle, path_string.c_str());
106 PDF_CHECK_SUCCESS(ec, std::format(
"Failed to save the bitmap to {}", path.string()));
110 void* SaveToHBITMAP()
const {
111 void* hbitmap = NULL;
112 auto ec = GXBitmapSaveToHBITMAP(m_handle, &hbitmap);
113 PDF_CHECK_SUCCESS(ec,
"Failed to save the bitmap to HBITMAP");
120 auto ec = GXBitmapGetPixelFormat(m_handle, &format);
121 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap pixel format");
125 SizeI GetSize()
const {
127 auto ec = GXBitmapGetSize(m_handle, &size);
128 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap size");
132 float GetDpiX()
const {
134 auto ec = GXBitmapGetDpiX(m_handle, &dpix);
135 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap horz dpi");
139 float GetDpiY()
const {
141 auto ec = GXBitmapGetDpiY(m_handle, &dpiy);
142 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap vert dpi");
146 int GetBitsPerPixel()
const {
173 void SetPalette(
const Palette& palette) {
174 auto ec = GXBitmapSetPalette(m_handle, palette.get());
175 PDF_CHECK_SUCCESS(ec,
"Failed to set the bitmap palette");
180 auto ec = GXBitmapGetPalette(m_handle, &palette);
181 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap palette");
187 auto ec = GXBitmapLock(m_handle, rect, mode, &lockdata);
188 PDF_CHECK_SUCCESS(ec,
"Failed to lock the bitmap");
193 auto ec = GXBitmapUnlock(m_handle);
194 PDF_CHECK_SUCCESS(ec,
"Failed to unlock the bitmap");
197 void CopyFromBitmap(
const Bitmap& source,
const RectI* source_rect =
nullptr,
const PointI* dest_point =
nullptr) {
198 auto ec = GXBitmapCopyFromBitmap(m_handle, dest_point, source.get(), source_rect);
199 PDF_CHECK_SUCCESS(ec,
"Failed to copy the bitmap");
202 void CopyFromMemory(
const GXLockedData& memory,
const RectI* dest_rect =
nullptr) {
203 auto ec = GXBitmapCopyFromMemory(m_handle, dest_rect, &memory);
204 PDF_CHECK_SUCCESS(ec,
"Failed to copy the bitmap");
207 void CopyToMemory(
const GXLockedData& memory,
const RectI* source_rect =
nullptr)
const {
208 auto ec = GXBitmapCopyToMemory(m_handle, source_rect, &memory);
209 PDF_CHECK_SUCCESS(ec,
"Failed to copy the bitmap");
212 void ColorFill(GXColorValue color,
const RectI* fill_rect =
nullptr) {
213 auto ec = GXBitmapColorFill(m_handle, fill_rect, color);
214 PDF_CHECK_SUCCESS(ec,
"Failed to fill the bitmap");
217 void NotifyChanged() {
218 auto ec = GXBitmapNotifyChanged(m_handle);
219 PDF_CHECK_SUCCESS(ec,
"Failed to notify the bitmap change");
222 void SetOffscreenPainting(
bool offscreen) {
223 auto ec = GXBitmapSetOffscreenPainting(m_handle, offscreen);
224 PDF_CHECK_SUCCESS(ec,
"Failed to set the bitmap offscreen");
227 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Bitmap, GXBitmap)
230struct BitmapScopedLock {
233 data = bitmap.Lock(mode, rectp);
235 ~BitmapScopedLock() {
250class Geometry :
public detail::RefCountedHandle<GXGeometry> {
252 static Geometry New() {
255 PDF_CHECK_SUCCESS(ec,
"Failed to create a geometry");
259 static Geometry NewFromRectangle(
const PDF::RectF& rect) {
260 Geometry geom = New();
261 geom.Rectangle(rect);
266 auto ec = GXGeometrySetFillRule(m_handle, fillrule);
267 PDF_CHECK_SUCCESS(ec,
"Failed to set the geometry fill rule");
272 auto ec = GXGeometryGetFillRule(m_handle, &fillrule);
273 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry fill rule");
277 bool IsPointsEmpty()
const {
279 auto ec = GXGeometryEmpty(m_handle, &empty);
280 PDF_CHECK_SUCCESS(ec,
"Failed to check the geometry points");
284 bool IsPointsEqual(
const Geometry& rhs)
const {
286 auto ec = GXGeometryPointsEqual(m_handle, rhs.get(), &empty);
287 PDF_CHECK_SUCCESS(ec,
"Failed to check the geometry points");
291 bool GetCurrentPoint(
PointF* presult)
const {
292 auto ec = GXGeometryGetCurrentPoint(m_handle, presult);
295 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry points");
299 RectF GetBound(
const Matrix* xform =
nullptr)
const {
301 auto ec = GXGeometryGetBound(m_handle, xform, &bound);
302 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry bound");
306 RectF GetWidenBound(
float lineWidth,
const GXStrokeParams& params,
const Matrix* xform =
nullptr,
float flatness = 0.75f)
const {
307 if (Math::FloatEq(lineWidth, 0.0f))
308 lineWidth = flatness;
309 auto widenGeometry = Widen(lineWidth, params);
310 return widenGeometry.GetBound(xform);
313 void BeginFigure(
const PointF& point) {
314 auto ec = GXGeometryBeginFigure(m_handle, &point);
315 PDF_CHECK_SUCCESS(ec,
"Failed to begin figure");
319 auto ec = GXGeometryEndFigure(m_handle);
320 PDF_CHECK_SUCCESS(ec,
"Failed to end figure");
323 void EndFigureClose() {
324 auto ec = GXGeometryEndFigureClose(m_handle);
325 PDF_CHECK_SUCCESS(ec,
"Failed to close figure");
328 void LineTo(
const PointF& to) {
329 auto ec = GXGeometryLineTo(m_handle, &to);
330 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
334 auto ec = GXGeometryConicCurveTo(m_handle, &c, &to);
335 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
339 auto ec = GXGeometryCubicCurveTo(m_handle, &c0, &c1, &to);
340 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
343 void Rectangle(
const RectF& rect) {
344 auto ec = GXGeometryRectangle(m_handle, &rect);
345 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
348 void Ellipse(
const RectF& bound) {
349 auto ec = GXGeometryEllipse(m_handle, &bound);
350 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
353 void RoundRectangle(
const RectF& rect,
float xradii,
float yradii) {
354 auto ec = GXGeometryRoundRectangle(m_handle, &rect, xradii, yradii);
355 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
358 Geometry Copy()
const {
360 auto ec = GXGeometryCopy(m_handle, ©);
361 PDF_CHECK_SUCCESS(ec,
"Failed to copy the geometry");
365 Geometry Transform(
const Matrix& xform)
const {
367 auto ec = GXGeometryTransform(m_handle, &xform, &result);
368 PDF_CHECK_SUCCESS(ec,
"Failed to transform the geometry");
372 Geometry Widen(
float width,
const GXStrokeParams& params,
float flatness = 0.75)
const {
374 auto ec = GXGeometryWiden(m_handle, width, ¶ms, flatness, &result);
375 PDF_CHECK_SUCCESS(ec,
"Failed to widen the geometry");
381 const Matrix* xform =
nullptr,
382 float flatness = 0.75)
const {
384 auto ec = GXGeometryCombine(m_handle, rhs.get(), xform, mode, flatness, &result);
385 PDF_CHECK_SUCCESS(ec,
"Failed to combine the geometries");
389 bool HitTest(
const PointF& point)
const {
391 auto ec = GXGeometryHitTest(m_handle, &point, &hit);
392 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the geometry");
396 Geometry Simplify(
float flatness = 0.75)
const {
398 auto ec = GXGeometrySimplify(m_handle, flatness, &result);
399 PDF_CHECK_SUCCESS(ec,
"Failed to simplify the geometries");
403 std::optional<RectF> IsRectangle(
const Matrix& xform =
Matrix{})
const {
404 bool isrectangle =
false;
406 auto ec = GXGeometryIsRectangle(m_handle, &xform, &isrectangle, &rectangle);
407 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry rectangle");
413 bool IsSingleLine()
const {
414 if (GetNumFigures() > 1)
417 if (GetFigureNumPoints(0) != 2)
423 size_t GetNumFigures()
const {
424 size_t numfigures = 0;
425 auto ec = GXGeometryGetNumFigures(m_handle, &numfigures);
426 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figures");
430 size_t GetFigureNumSegments(
size_t figureindex)
const {
432 auto ec = GXGeometryGetFigureNumSegments(m_handle, figureindex, &numsegs);
433 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segments");
437 size_t GetFigureNumPoints(
size_t figureindex)
const {
438 size_t numpoints = 0;
439 auto ec = GXGeometryGetFigureNumPoints(m_handle, figureindex, &numpoints);
440 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure points");
444 const PointF* GetFigurePointsPtr(
size_t figureindex)
const {
446 auto ec = GXGeometryGetFigurePointsPtr(m_handle, figureindex, &points);
447 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure start point");
448 static_assert(
sizeof(
PointF) ==
sizeof(
PDPointF),
"Size of PointF and PDPointF must be equal");
449 return reinterpret_cast<const PointF*
>(points);
452 bool IsFigureSegmentCurve(
size_t figureindex,
size_t segindex)
const {
453 bool iscurve =
false;
454 auto ec = GXGeometryIsFigureSegmentCurve(m_handle, figureindex, segindex, &iscurve);
455 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segment points");
459 size_t GetFigureSegmentPointsIndex(
size_t figureindex,
size_t segindex)
const {
460 size_t pointsindex = 0;
461 auto ec = GXGeometryGetFigureSegmentPointsIndex(m_handle, figureindex, segindex, &pointsindex);
462 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segment points");
466 bool IsFigureClosed(
size_t figureindex)
const {
467 bool isclosed =
false;
468 auto ec = GXGeometryIsFigureClosed(m_handle, figureindex, &isclosed);
469 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure closed");
473 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Geometry, GXGeometry)
480class SystemFont :
public detail::RefCountedHandle<GXSysFont> {
482 std::wstring GetFamilyName()
const {
483 return detail::GetWstringProperty(GXSysFontGetFamilyName, m_handle);
486 std::wstring GetPostScriptName()
const {
487 return detail::GetWstringProperty(GXSysFontGetPostScriptName, m_handle);
490 std::wstring GetFontName()
const {
491 return detail::GetWstringProperty(GXSysFontGetFontName, m_handle);
496 PDF_CHECK_SUCCESS_X(GXSysFontGetStyle(m_handle, &style));
500 GXFontFlags GetFontFlags()
const {
501 GXFontFlags flags = 0;
502 PDF_CHECK_SUCCESS_X(GXSysFontGetFontFlags(m_handle, &flags));
506 std::vector<GXUnicodeRange> GetUnicodeRanges()
const {
507 size_t num_ranges = 0;
508 auto ec = GXSysFontGetUnicodeRanges(m_handle,
nullptr, 0, &num_ranges);
512 PDF_CHECK_SUCCESS_X(ec);
513 std::vector<GXUnicodeRange> ranges(num_ranges);
514 PDF_CHECK_SUCCESS_X(GXSysFontGetUnicodeRanges(m_handle, ranges.data(), num_ranges, &num_ranges));
518 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(SystemFont, GXSysFont)
521inline std::vector<SystemFont> ListSystemFonts() {
522 std::vector<SystemFont> fonts;
524 [](
void* userdata, GXSysFont sysfont) ->
PDErrCode {
525 PDFSDK_CALLBACK_BEGIN
526 auto fonts =
static_cast<std::vector<SystemFont>*
>(userdata);
527 fonts->emplace_back(sysfont);
532 PDF_CHECK_SUCCESS_X(ec);
538 auto ec = GXFindSysFont(&query, &sysfont);
542 PDF_CHECK_SUCCESS_X(ec);
547 GXSysFontQuery query = {};
548 query.matchFlags = kGXSysFontQueryMatchFamily | kGXSysFontQueryMatchWeight | kGXSysFontQueryMatchItalic;
549 query.family = family.c_str();
551 return FindSystemFont(query);
560constexpr uint32_t MakeOpenTypeTag(std::string_view tag) {
561 auto result = uint32_t(0);
562 for (
int i = 0; i < 4; ++i) {
563 const char c =
static_cast<size_t>(i) < tag.size() ? tag[i] :
' ';
564 result = (result << 8) | static_cast<uint8_t>(c);
610class FontFace :
public detail::RefCountedHandle<GXFontFace> {
612 static FontFace FromSystemFont(
const SystemFont& sysfont) {
617 PDF_CHECK_SUCCESS(ec,
"Failed to create a font face");
622 auto sysfont = FindSystemFont(family, style);
623 return FromSystemFont(sysfont);
626 static FontFace LoadFromFile(
const std::filesystem::path& path, uint32_t faceindex = 0, uint32_t* ptotalfaces =
nullptr) {
628 auto path_string = path.wstring();
629 auto ec = GXCreateFontFaceFromFile(path_string.c_str(), faceindex, ptotalfaces, &fontface);
630 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from file");
634 static FontFace LoadFromMemory(std::span<const Byte> data,
bool copyData =
true, uint32_t faceindex = 0, uint32_t* ptotalfaces =
nullptr) {
636 auto ec = GXCreateFontFaceFromMemory(data.data(), data.size(), copyData, faceindex, ptotalfaces, &fontface);
637 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from memory");
641 std::wstring GetFamilyName()
const {
642 return detail::GetWstringProperty(GXFontFaceGetFamilyName, m_handle);
645 std::wstring GetPostScriptName()
const {
646 return detail::GetWstringProperty(GXFontFaceGetPostScriptName, m_handle);
649 std::wstring GetFontName()
const {
650 return detail::GetWstringProperty(GXFontFaceGetFontName, m_handle);
655 PDF_CHECK_SUCCESS_X(GXFontFaceGetStyle(m_handle, &style));
659 GXFontFlags GetFontFlags()
const {
660 GXFontFlags flags = 0;
661 PDF_CHECK_SUCCESS_X(GXFontFaceGetFontFlags(m_handle, &flags));
665 std::vector<GXUnicodeRange> GetUnicodeRanges()
const {
666 size_t num_ranges = 0;
667 auto ec = GXFontFaceGetUnicodeRanges(m_handle,
nullptr, 0, &num_ranges);
671 PDF_CHECK_SUCCESS_X(ec);
672 std::vector<GXUnicodeRange> ranges(num_ranges);
673 PDF_CHECK_SUCCESS_X(GXFontFaceGetUnicodeRanges(m_handle, ranges.data(), num_ranges, &num_ranges));
679 auto ec = GXFontFaceGetMetrics(m_handle, &metrics);
680 PDF_CHECK_SUCCESS(ec,
"Failed to get the font metrics");
684 uint32_t GetGlyphIndex(uint32_t unicode)
const {
686 auto ec = GXFontFaceGetGlyphIndex(m_handle, unicode, &gid);
687 PDF_CHECK_SUCCESS(ec,
"Failed to get the glyph index");
691 bool HasGlyph(uint32_t unicode)
const {
692 return GetGlyphIndex(unicode) != 0;
695 uint32_t GetGlyphAdvance(uint32_t glyphIndex)
const {
696 uint32_t advance = 0;
697 auto ec = GXFontFaceGetGlyphAdvance(m_handle, glyphIndex, &advance);
698 PDF_CHECK_SUCCESS(ec,
"Failed to get the glyph advance");
711 auto ec = GXFontFaceRenderGlyphOutline(m_handle, glyphIndex, &transform, geometry.get());
712 PDF_CHECK_SUCCESS(ec,
"Failed to render the glyph outline");
720 ReadStream OpenFontStream(uint32_t tableTag = 0)
const {
722 auto ec = GXFontFaceOpenFontStream(m_handle, tableTag, &stream);
723 PDF_CHECK_SUCCESS(ec,
"Failed to open the font table stream");
737 PDF_CHECK_SUCCESS_X(GXFontFaceGetNumVariationAxes(m_handle, &numAxes));
739 std::vector<FontVariationAxisInfo> axes;
740 axes.reserve(numAxes);
741 for (
size_t i = 0; i < numAxes; ++i) {
743 PDF_CHECK_SUCCESS_X(GXFontFaceGetVariationAxis(m_handle, i, &info));
748 auto ec = GXFontFaceGetVariationAxisName(m_handle, info.tag,
nullptr, 0, &nameSize);
750 PDF_CHECK_SUCCESS_X(ec);
752 axis.
name.resize(nameSize);
753 PDF_CHECK_SUCCESS_X(GXFontFaceGetVariationAxisName(m_handle, info.tag, axis.
name.data(), nameSize, &nameSize));
756 axes.push_back(std::move(axis));
771 size_t numInstances = 0;
772 PDF_CHECK_SUCCESS_X(GXFontFaceGetNumVariationInstances(m_handle, &numInstances));
774 std::vector<FontVariationInstanceInfo> instances;
775 instances.reserve(numInstances);
776 for (
size_t i = 0; i < numInstances; ++i) {
780 auto ec = GXFontFaceGetVariationInstanceName(m_handle, i,
nullptr, 0, &nameSize);
782 PDF_CHECK_SUCCESS_X(ec);
784 instance.
name.resize(nameSize);
785 PDF_CHECK_SUCCESS_X(GXFontFaceGetVariationInstanceName(m_handle, i, instance.
name.data(), nameSize, &nameSize));
788 size_t numAxisValues = 0;
789 ec = GXFontFaceGetVariationInstanceAxisValues(m_handle, i,
nullptr, 0, &numAxisValues);
791 PDF_CHECK_SUCCESS_X(ec);
793 std::vector<GXFontVariationAxisValue> axisValues(numAxisValues);
794 PDF_CHECK_SUCCESS_X(GXFontFaceGetVariationInstanceAxisValues(m_handle, i, axisValues.data(), numAxisValues, &numAxisValues));
797 for (
const auto& axisValue : axisValues)
798 instance.
axisValues.push_back({axisValue.tag, axisValue.value});
801 instances.push_back(std::move(instance));
812 size_t numValues = 0;
813 auto ec = GXFontFaceGetVariation(m_handle,
nullptr, 0, &numValues);
817 PDF_CHECK_SUCCESS_X(ec);
819 std::vector<GXFontVariationAxisValue> values(numValues);
820 PDF_CHECK_SUCCESS_X(GXFontFaceGetVariation(m_handle, values.data(), numValues, &numValues));
822 std::vector<FontVariationAxisValue> result;
823 result.reserve(numValues);
824 for (
const auto& value : values)
825 result.push_back({value.tag, value.value});
838 void SetVariation(std::span<const FontVariationAxisValue> axisValues)
const {
839 std::vector<GXFontVariationAxisValue> values;
840 values.reserve(axisValues.size());
842 values.push_back({axisValue.tag, axisValue.value});
844 auto ec = GXFontFaceSetVariation(m_handle, values.data(), values.size());
845 PDF_CHECK_SUCCESS(ec,
"Failed to set the font variation");
858 if (instance.name == instanceName) {
866 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
FontFace, GXFontFace)
893 virtual std::wstring GetFamilyName() = 0;
894 virtual std::wstring GetPostScriptName() = 0;
895 virtual std::wstring GetFontName() = 0;
897 virtual GXFontFlags GetFontFlags() = 0;
898 virtual std::vector<GXUnicodeRange> GetUnicodeRanges() = 0;
899 virtual FontFace LoadFontFace() = 0;
902 using FontEntryPtr = std::shared_ptr<FontEntry>;
916 struct GXSysFontsHandlerFontData {
917 std::shared_ptr<SystemFontsHandler> handler;
918 SystemFontsHandler::FontEntryPtr font;
922 .enumFonts = [](
void* handlerData, GXSysFontCustomEnumProc proc,
void* userdata) ->
PDErrCode {
923 PDFSDK_CALLBACK_BEGIN
924 auto handler = *
static_cast<std::shared_ptr<SystemFontsHandler>*
>(handlerData);
925 for (SystemFontsHandler::FontEntryPtr& font : handler->ListFonts()) {
928 auto fontData = std::make_unique<GXSysFontsHandlerFontData>(handler, std::move(font));
929 auto ec = proc(userdata, fontData.get());
937 .getFamilyName = [](
void* fontData,
wchar_t* buffer,
size_t bufsize,
size_t* psize) ->
PDErrCode {
938 PDFSDK_CALLBACK_BEGIN
939 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
940 return CopyDataToBuffer(font->GetFamilyName(), buffer, bufsize, psize);
943 .getPostScriptName = [](
void* fontData,
wchar_t* buffer,
size_t bufsize,
size_t* psize) ->
PDErrCode {
944 PDFSDK_CALLBACK_BEGIN
945 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
946 return CopyDataToBuffer(font->GetPostScriptName(), buffer, bufsize, psize);
949 .getFontName = [](
void* fontData,
wchar_t* buffer,
size_t bufsize,
size_t* psize) ->
PDErrCode {
950 PDFSDK_CALLBACK_BEGIN
951 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
952 return CopyDataToBuffer(font->GetFontName(), buffer, bufsize, psize);
956 PDFSDK_CALLBACK_BEGIN
957 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
958 *pStyle = font->GetStyle();
962 .getFontFlags = [](
void* fontData, GXFontFlags* pFlags) ->
PDErrCode {
963 PDFSDK_CALLBACK_BEGIN
964 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
965 *pFlags = font->GetFontFlags();
970 PDFSDK_CALLBACK_BEGIN
971 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
972 return CopyDataToBuffer(font->GetUnicodeRanges(), buffer, bufsize, psize);
975 .loadFontFace = [](
void* fontData, GXFontFace* pFontFace) ->
PDErrCode {
976 PDFSDK_CALLBACK_BEGIN
977 const auto& font =
static_cast<GXSysFontsHandlerFontData*
>(fontData)->font;
978 *pFontFace = font->LoadFontFace().detach();
982 .freeFontData = [](
void* fontData) {
983 delete static_cast<GXSysFontsHandlerFontData*
>(fontData);
985 .freeHandlerData = [](
void* handlerData) {
986 delete static_cast<std::shared_ptr<SystemFontsHandler>*
>(handlerData);
988 return sysFontsHandler;
998inline GXSysFontsHandlerID AddSystemFontsHandler(std::shared_ptr<SystemFontsHandler> handler) {
1000 auto handlerData = std::make_unique<std::shared_ptr<SystemFontsHandler>>(std::move(handler));
1001 GXSysFontsHandlerID handlerId = 0;
1002 auto ec = GXAddCustomSysFontsHandler(&details::GetGXSysFontsHandler(), handlerData.get(), &handlerId);
1003 PDF_CHECK_SUCCESS(ec,
"Failed to add a system fonts handler");
1004 handlerData.release();
1012inline GXSysFontsHandlerID AddSystemFontsDirectory(
const std::filesystem::path& directory) {
1013 auto directory_string = directory.wstring();
1014 GXSysFontsHandlerID handlerId = 0;
1015 auto ec = GXAddDirectorySysFontsHandler(directory_string.c_str(), &handlerId);
1016 PDF_CHECK_SUCCESS(ec,
"Failed to add a system fonts directory");
1024inline void SetSystemFontsHandler(std::shared_ptr<SystemFontsHandler> handler) {
1026 auto handlerData = std::make_unique<std::shared_ptr<SystemFontsHandler>>(std::move(handler));
1027 auto ec = GXSetCustomSysFontsHandler(&details::GetGXSysFontsHandler(), handlerData.get());
1028 PDF_CHECK_SUCCESS(ec,
"Failed to set the system fonts handler");
1029 handlerData.release();
1036inline void SetSystemFontsDirectory(
const std::filesystem::path& directory) {
1037 auto directory_string = directory.wstring();
1038 auto ec = GXSetDirectorySysFontsHandler(directory_string.c_str());
1039 PDF_CHECK_SUCCESS(ec,
"Failed to set the system fonts directory");
1046inline bool RemoveSystemFontsHandler(GXSysFontsHandlerID handlerId) {
1047 auto ec = GXRemoveSysFontsHandler(handlerId);
1051 PDF_CHECK_SUCCESS(ec,
"Failed to remove the system fonts handler");
1056inline void ResetSystemFontsHandlers() {
1057 auto ec = GXResetSysFontsHandlers();
1058 PDF_CHECK_SUCCESS(ec,
"Failed to reset the system fonts handlers");
1065class Gradient :
public detail::RefCountedHandle<GXGradient> {
1070 PDF_CHECK_SUCCESS(ec,
"Failed to create a gradient");
1076 auto ec = GXCreateGradientRadial(&attrs, &gradient);
1077 PDF_CHECK_SUCCESS(ec,
"Failed to create a gradient");
1081 static Gradient NewTriMeshGradient(
const GXMeshVertex* vertices,
size_t num_vertices, GXColorValue bgcolor) {
1083 auto ec = GXCreateGradientTriMesh(vertices, num_vertices, bgcolor, &gradient);
1084 PDF_CHECK_SUCCESS(ec,
"Failed to create a gradient");
1088 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Gradient, GXGradient)
1095class Brush :
public detail::RefCountedHandle<GXBrush> {
1097 static Brush NewSolidBrush(GXColorValue argb) {
1100 PDF_CHECK_SUCCESS(ec,
"Failed to create a brush");
1104 static Brush NewBitmapBrush(
const Bitmap& bitmap,
1107 const Matrix* xform =
nullptr) {
1109 auto ec = GXCreateBrushBitmap(bitmap.get(), opacity, &attrs, xform, &brush);
1110 PDF_CHECK_SUCCESS(ec,
"Failed to create a brush");
1114 static Brush NewGradientBrush(
const Gradient& gradient,
float opacity = 1,
const Matrix* xform =
nullptr) {
1116 auto ec = GXCreateBrushGradient(gradient.get(), opacity, xform, &brush);
1117 PDF_CHECK_SUCCESS(ec,
"Failed to create a brush");
1121 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Brush, GXBrush)
1128class Region :
public detail::RefCountedHandle<GXRegion> {
1130 static Region New() {
1133 PDF_CHECK_SUCCESS(ec,
"Failed to create a region");
1137 static Region NewFromRect(
const RectI& rect) {
1139 auto ec = GXCreateRegionFromRect(&rect, ®ion);
1140 PDF_CHECK_SUCCESS(ec,
"Failed to create a region");
1144 bool IsAreaEmpty()
const {
1146 auto ec = GXRegionIsAreaEmpty(m_handle, &empty);
1147 PDF_CHECK_SUCCESS(ec,
"Failed to check the region area");
1151 RectI GetBound()
const {
1153 auto ec = GXRegionGetBound(m_handle, &bound);
1154 PDF_CHECK_SUCCESS(ec,
"Failed to get the region bound");
1158 bool Contains(
const PointI& point)
const {
1159 bool contains =
false;
1160 auto ec = GXRegionContainsPoint(m_handle, &point, &contains);
1161 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the region");
1165 bool Contains(
const RectI& rect)
const {
1166 bool contains =
false;
1167 auto ec = GXRegionContainsRect(m_handle, &rect, &contains);
1168 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the region");
1172 bool Contains(
const Region& region)
const {
1173 bool contains =
false;
1174 auto ec = GXRegionContains(m_handle, region.get(), &contains);
1175 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the region");
1179 bool HasIntersection(
const RectI& rect)
const {
1180 bool isects =
false;
1181 auto ec = GXRegionHasIntersectionWithRect(m_handle, &rect, &isects);
1182 PDF_CHECK_SUCCESS(ec,
"Failed to check the regions intersection");
1186 bool HasIntersection(
const Region& region)
const {
1187 bool isects =
false;
1188 auto ec = GXRegionHasIntersection(m_handle, region.get(), &isects);
1189 PDF_CHECK_SUCCESS(ec,
"Failed to check the regions intersection");
1193 void Offset(
int dx,
int dy) {
1194 auto ec = GXRegionOffset(m_handle, dx, dy);
1195 PDF_CHECK_SUCCESS(ec,
"Failed to offset the region");
1200 auto ec = GXRegionCombine(m_handle, region.get(), mode, &result);
1201 PDF_CHECK_SUCCESS(ec,
"Failed to combine the regions");
1202 *
this = std::move(result);
1207 auto ec = GXRegionCombineRect(m_handle, &rect, mode, &result);
1208 PDF_CHECK_SUCCESS(ec,
"Failed to combine the regions");
1209 *
this = std::move(result);
1212 using RectEnumFunc = std::function<bool(
const RectI&)>;
1214 void EnumRects(RectEnumFunc func)
const {
1216 PDFSDK_CALLBACK_BEGIN
1217 auto& func = *
reinterpret_cast<RectEnumFunc*
>(userdata);
1221 auto ec = GXRegionEnumRects(m_handle, enumProc, &func);
1223 PDF_CHECK_SUCCESS(ec,
"Failed to enum the region rects");
1226 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(Region, GXRegion)
1233class RenderTarget :
public detail::RefCountedHandle<GXRenderTarget> {
1235 static RenderTarget NewBitmapRenderTarget(
const Bitmap& bitmap) {
1236 RenderTarget target;
1238 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
1242 static RenderTarget NewExtBufRenderTarget(
void* pixels,
1248 RenderTarget target;
1250 auto ec = GXCreateRenderTargetExtBuf(pixels, stride, &attrs, &target);
1251 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
1258 RenderTarget target;
1259 auto ec = GXCreateRenderTargetHWND(hwnd, mode, &target);
1260 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
1264 static RenderTarget NewPrintRenderTarget(
void* hdc) {
1265 RenderTarget target;
1266 auto ec = GXCreateRenderTargetPrintDC(hdc, &target);
1267 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
1271 static RenderTarget NewHdcRenderTarget(
void* hdc,
const RectI* rect =
nullptr) {
1272 RenderTarget target;
1273 auto ec = GXCreateRenderTargetHDC(hdc, rect, &target);
1274 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
1282 auto ec = GXRenderTargetGetPixelFormat(m_handle, &format);
1283 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target pixel format");
1289 auto ec = GXRenderTargetGetSize(m_handle, &size);
1290 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target size");
1294 void Clear(GXColorValue clrcolor) {
1295 auto ec = GXRenderTargetClear(m_handle, clrcolor);
1296 PDF_CHECK_SUCCESS(ec,
"Failed to clear the render target");
1301 PaintScope(RenderTarget& target)
1302 : m_target(target) {
1303 m_target.BeginPaint();
1308 m_target.EndPaint();
1313 PaintScope(
const PaintScope&) =
delete;
1314 PaintScope& operator=(
const PaintScope&) =
delete;
1317 RenderTarget& m_target;
1321 auto ec = GXRenderTargetBeginPaint(m_handle);
1322 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1326 auto ec = GXRenderTargetEndPaint(m_handle);
1327 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1332 StateScope(RenderTarget& target)
1333 : m_target(target) {
1334 m_target.PushState();
1339 m_target.PopState();
1344 StateScope(
const StateScope&) =
delete;
1345 StateScope& operator=(
const StateScope&) =
delete;
1348 RenderTarget& m_target;
1352 auto ec = GXRenderTargetPushState(m_handle);
1353 PDF_CHECK_SUCCESS(ec,
"Failed to push the render target state");
1357 auto ec = GXRenderTargetPopState(m_handle);
1358 PDF_CHECK_SUCCESS(ec,
"Failed to pop the render target state");
1363 CTMScope(RenderTarget& target)
1364 : m_target(target) {
1365 m_ctm = m_target.GetCTM();
1370 m_target.SetCTM(m_ctm);
1375 CTMScope(
const CTMScope&) =
delete;
1376 CTMScope& operator=(
const CTMScope&) =
delete;
1379 RenderTarget& m_target;
1385 auto ec = GXRenderTargetGetCTM(m_handle, &ctm);
1386 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target CTM");
1390 void SetCTM(
const Matrix& ctm) {
1391 auto ec = GXRenderTargetSetCTM(m_handle, &ctm);
1392 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1395 void ConcatCTM(
const Matrix& xform) {
1396 auto ec = GXRenderTargetConcatCTM(m_handle, &xform);
1397 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1400 void RotateCTM(
float radians) {
1401 auto ec = GXRenderTargetRotateCTM(m_handle, radians);
1402 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1405 void ScaleCTM(
float scale) {
1406 auto ec = GXRenderTargetScaleCTM(m_handle, scale, scale);
1407 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1410 void ScaleCTM(
float sx,
float sy) {
1411 auto ec = GXRenderTargetScaleCTM(m_handle, sx, sy);
1412 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1415 void ScaleCTM(
const SizeF& scale) {
1416 auto ec = GXRenderTargetScaleCTM(m_handle, scale.width, scale.height);
1417 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1420 void TranslateCTM(
float dx,
float dy) {
1421 auto ec = GXRenderTargetTranslateCTM(m_handle, dx, dy);
1422 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1425 void TranslateCTM(
const PointF& delta) {
1426 auto ec = GXRenderTargetTranslateCTM(m_handle, delta.x, delta.y);
1427 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
1431 auto ec = GXRenderTargetSetBlendMode(m_handle, mode);
1432 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target blend mode");
1435 void SetStrokeAdjustment(
bool adjust) {
1436 auto ec = GXRenderTargetSetStrokeAdjustment(m_handle, adjust);
1437 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target stroke adjust");
1440 bool GetStrokeAdjustment()
const {
1441 bool adjust =
false;
1442 auto ec = GXRenderTargetGetStrokeAdjustment(m_handle, &adjust);
1443 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target stroke adjust");
1447 void SetOpacityMask(
GXMaskMode mode,
const Brush& mask) {
1448 auto ec = GXRenderTargetSetOpacityMask(m_handle, mode, mask.get());
1449 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target mask");
1452 void SetShapeMask(
GXMaskMode mode,
const Brush& mask) {
1453 auto ec = GXRenderTargetSetShapeMask(m_handle, mode, mask.get());
1454 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target mask");
1457 void BeginLayer(
const GXLayerParams& params) {
1458 auto ec = GXRenderTargetBeginLayer(m_handle, ¶ms);
1459 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1463 auto ec = GXRenderTargetEndLayer(m_handle);
1464 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1467 void FillGeometry(
const Geometry& geom,
const Brush& brush) {
1468 auto ec = GXRenderTargetFillGeometry(m_handle, geom.get(), brush.get());
1469 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1472 void FillTextGeometry(
const Geometry& geom,
const Brush& brush) {
1473 auto ec = GXRenderTargetFillTextGeometry(m_handle, geom.get(), brush.get());
1474 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1477 void FillRect(
const RectF& rect,
const Brush& brush) {
1478 auto ec = GXRenderTargetFillRect(m_handle, &rect, brush.get());
1479 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1482 void FillEllipse(
const RectF& bound,
const Brush& brush) {
1483 auto ec = GXRenderTargetFillEllipse(m_handle, &bound, brush.get());
1484 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1487 void StrokeGeometry(
const Geometry& geom,
const Brush& brush,
float width,
const GXStrokeParams* params =
nullptr) {
1488 auto ec = GXRenderTargetStrokeGeometry(m_handle, geom.get(), brush.get(), width, params);
1489 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1492 void StrokeLine(
const PointF& start,
1496 const GXStrokeParams* params =
nullptr) {
1497 auto ec = GXRenderTargetStrokeLine(m_handle, &start, &end, brush.get(), width, params);
1498 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1501 void StrokeRect(
const RectF& rect,
const Brush& brush,
float width,
const GXStrokeParams* params =
nullptr) {
1502 auto ec = GXRenderTargetStrokeRect(m_handle, &rect, brush.get(), width, params);
1503 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1506 void StrokeEllipse(
const RectF& bound,
const Brush& brush,
float width,
const GXStrokeParams* params =
nullptr) {
1507 auto ec = GXRenderTargetStrokeEllipse(m_handle, &bound, brush.get(), width, params);
1508 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1511 void ClipGeometry(
const Geometry& geom) {
1512 auto ec = GXRenderTargetClipGeometry(m_handle, geom.get());
1513 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1516 void ClipRect(
const RectF& rect) {
1517 auto ec = GXRenderTargetClipRect(m_handle, &rect);
1518 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1521 void ClipEllipse(
const RectF& bound) {
1522 auto ec = GXRenderTargetClipEllipse(m_handle, &bound);
1523 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1526 void DrawBitmap(
const Bitmap& bitmap,
1529 auto ec = GXRenderTargetDrawBitmap(m_handle, bitmap.get(), opacity, imode);
1530 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1533 void StretchBitmap(
const Bitmap& bitmap,
1534 const RectF& target_rect,
1537 auto ec = GXRenderTargetStretchBitmap(m_handle, bitmap.get(), &target_rect, opacity, imode);
1538 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1541 void DrawGradient(
const Gradient& gradient,
float opacity) {
1542 auto ec = GXRenderTargetDrawGradient(m_handle, gradient.get(), opacity);
1543 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1546 void FillMask(
const Bitmap& mask,
1549 auto ec = GXRenderTargetFillMask(m_handle, mask.get(), brush.get(), imode);
1550 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1553 void InvertRect(
const RectF& rect) {
1554 auto ec = GXRenderTargetInvertRect(m_handle, &rect);
1555 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1558 void InvertLine(
const PointI& start,
const PointI& end) {
1559 auto ec = GXRenderTargetInvertLine(m_handle, &start, &end);
1560 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1563 void FillText(
const FontFace& font,
float fontSize,
const std::wstring& text,
const Brush& brush) {
1564 auto ec = GXRenderTargetFillText(m_handle, font.get(), fontSize, text.c_str(), brush.get());
1565 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1568 RectI GetDrawBounds() {
1570 auto ec = GXRenderTargetGetDrawBounds(m_handle, &bounds);
1571 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target draw bounds");
1575 float GetDpiX()
const {
1577 auto ec = GXRenderTargetGetDpiX(m_handle, &dpiX);
1578 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target DPI X");
1582 float GetDpiY()
const {
1584 auto ec = GXRenderTargetGetDpiY(m_handle, &dpiY);
1585 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target DPI Y");
1589 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(RenderTarget, GXRenderTarget)
Represents a bitmap.
Definition graphics.h:69
Represents a font face.
Definition graphics.h:610
void SelectVariationInstance(std::wstring_view instanceName) const
Selects one of the font's own designer-provided named instances (e.g. "Bold Condensed") by name,...
Definition graphics.h:856
void SetVariation(std::span< const FontVariationAxisValue > axisValues) const
Selects a point in the face's design-variation space, i.e. a variable-font instance....
Definition graphics.h:838
std::vector< FontVariationInstanceInfo > GetVariationInstances() const
Lists the variable font's designer-provided named instances (e.g. "Bold Condensed"),...
Definition graphics.h:770
std::vector< FontVariationAxisValue > GetVariation() const
Reports the face's current position in its design-variation space.
Definition graphics.h:811
std::vector< FontVariationAxisInfo > GetVariationAxes() const
Lists the design-variation axes this face supports, with their valid ranges and default coordinates.
Definition graphics.h:735
void RenderGlyphOutline(uint32_t glyphIndex, Geometry geometry, const Matrix &transform=Matrix()) const
Definition graphics.h:710
Represents a geometry.
Definition graphics.h:250
Represents a gradient.
Definition graphics.h:1065
Represents a color palette.
Definition graphics.h:32
Represents a system font.
Definition graphics.h:480
One of the fonts a handler provides.
Definition graphics.h:890
A callback interface that provides a set of fonts to the SDK, to be enumerated by ListSystemFonts and...
Definition graphics.h:879
virtual std::vector< FontEntryPtr > ListFonts()=0
Lists the fonts this handler provides. Called whenever the SDK rebuilds its font list,...
Represents a read stream for reading data from PDF objects.
Definition read_stream.h:19
@ kPDErrBadParam
Bad input parameter.
Definition errors.h:20
@ 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
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateBrushSolidARGB(GXColorValue argb, GXBrush *pbrush)
GXLockMode
Defines the level of access and control over the graphics content.
Definition graphics.h:99
@ kGXLockModeRead
Definition graphics.h:100
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:129
@ kGXFillRuleNonZero
Definition graphics.h:130
GXInterpolationMode
Defines the way through which pixel values are estimated or interpolated.
Definition graphics.h:116
@ kGXInterpolationModeAreaAverage
Definition graphics.h:119
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:148
GXCombineMode
Determines how the areas of different graphics interact with each other.
Definition graphics.h:202
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:328
@ kGXFontStyleRegular
Definition graphics.h:329
GXMaskMode
Determines the type of mask used to control which parts of an image or graphical element are visible ...
Definition graphics.h:183
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateGradientLinear(const GXLinearGradientAttrs *attrs, GXGradient *pgradient)
GXPixelFormat
Defines the pixel format of the graphics application.
Definition graphics.h:76
@ kGXPixelFormatP8
Definition graphics.h:87
@ kGXPixelFormatA8
Definition graphics.h:86
@ kGXPixelFormatXRGB8
Definition graphics.h:84
@ kGXPixelFormatARGB8p
Definition graphics.h:79
@ kGXPixelFormatUnknown
Definition graphics.h:77
@ kGXPixelFormatL1
Definition graphics.h:91
@ kGXPixelFormatRGB8
Definition graphics.h:78
@ kGXPixelFormatA1
Definition graphics.h:89
@ kGXPixelFormatL8
Definition graphics.h:88
@ kGXPixelFormatP1
Definition graphics.h:90
@ kGXPixelFormatARGB8
Definition graphics.h:82
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateRegion(GXRegion *pregion)
PDF_CORE_API PDErrCode PDFSDK_CALLCONV GXCreateGeometry(GXGeometry *pgeom)
Definition graphics.h:265
Definition graphics.h:317
Definition graphics.h:335
Definition graphics.h:376
Definition graphics.h:277
Definition graphics.h:105
Definition graphics.h:299
Definition graphics.h:287
Definition graphics.h:258
Definition graphics.h:395
Definition graphics.h:409
Definition graphics.h:366
Describes one design-variation axis supported by a variable font: its tag, valid range,...
Definition graphics.h:587
std::wstring name
The name of the axis (e.g. "Weight"), or empty if the font provides none.
Definition graphics.h:592
uint32_t tag
Packed 4-character axis tag.
Definition graphics.h:588
float defaultValue
Coordinate value used for this axis in the font's default instance.
Definition graphics.h:590
float maxValue
Maximum coordinate value the font supports on this axis.
Definition graphics.h:591
float minValue
Minimum coordinate value the font supports on this axis.
Definition graphics.h:589
A single (axis, value) pair identifying a point along one axis of a variable font's design space....
Definition graphics.h:576
float value
Coordinate on this axis, in the font's own user-scale units for the tag.
Definition graphics.h:578
uint32_t tag
Packed 4-character axis tag.
Definition graphics.h:577
One of a variable font's designer-provided "named instances" - a pre-chosen point in the font's desig...
Definition graphics.h:601
std::wstring name
The instance name.
Definition graphics.h:602
std::vector< FontVariationAxisValue > axisValues
This instance's coordinates per axis.
Definition graphics.h:603
Definition math_types.h:12
Definition math_types.h:44