63class Bitmap :
public detail::RefCountedHandle<GXBitmap> {
69 PDF_CHECK_SUCCESS(ec,
"Failed to create a bitmap");
73 static Bitmap LoadFromFile(
const std::filesystem::path& path, uint32_t frame_index = 0, uint32_t* ptotal_frames =
nullptr) {
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");
81 static Bitmap LoadFromMemory(
const void* data,
size_t size, uint32_t frame_index = 0, uint32_t* ptotal_frames =
nullptr) {
83 auto ec = GXCreateBitmapFromMemoryFrame(data, size, frame_index, ptotal_frames, &bitmap);
84 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from memory");
89 static Bitmap NewFromHBITMAP(
void* hbitmap) {
91 auto ec = GXCreateBitmapFromHBITMAP(hbitmap, &bitmap);
92 PDF_CHECK_SUCCESS(ec,
"Failed to create a bitmap from HBITMAP");
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");
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");
114 auto ec = GXBitmapGetPixelFormat(m_handle, &format);
115 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap pixel format");
119 SizeI GetSize()
const {
121 auto ec = GXBitmapGetSize(m_handle, &size);
122 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap size");
126 float GetDpiX()
const {
128 auto ec = GXBitmapGetDpiX(m_handle, &dpix);
129 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap horz dpi");
133 float GetDpiY()
const {
135 auto ec = GXBitmapGetDpiY(m_handle, &dpiy);
136 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap vert dpi");
140 int GetBitsPerPixel()
const {
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");
174 auto ec = GXBitmapGetPalette(m_handle, &palette);
175 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap palette");
181 auto ec = GXBitmapLock(m_handle, rect, mode, &lockdata);
182 PDF_CHECK_SUCCESS(ec,
"Failed to lock the bitmap");
187 auto ec = GXBitmapUnlock(m_handle);
188 PDF_CHECK_SUCCESS(ec,
"Failed to unlock the bitmap");
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");
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");
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");
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");
211 void NotifyChanged() {
212 auto ec = GXBitmapNotifyChanged(m_handle);
213 PDF_CHECK_SUCCESS(ec,
"Failed to notify the bitmap change");
216 void SetOffscreenPainting(
bool offscreen) {
217 auto ec = GXBitmapSetOffscreenPainting(m_handle, offscreen);
218 PDF_CHECK_SUCCESS(ec,
"Failed to set the bitmap offscreen");
221 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
Bitmap, GXBitmap)
244class SystemFont :
public detail::RefCountedHandle<GXSysFont> {
246 std::wstring GetFamilyName()
const {
247 return detail::GetWstringProperty(GXSysFontGetFamilyName, m_handle);
250 std::wstring GetPostScriptName()
const {
251 return detail::GetWstringProperty(GXSysFontGetPostScriptName, m_handle);
254 std::wstring GetFontName()
const {
255 return detail::GetWstringProperty(GXSysFontGetFontName, m_handle);
260 PDF_CHECK_SUCCESS_X(GXSysFontGetStyle(m_handle, &style));
264 GXFontFlags GetFontFlags()
const {
265 GXFontFlags flags = 0;
266 PDF_CHECK_SUCCESS_X(GXSysFontGetFontFlags(m_handle, &flags));
270 std::vector<GXUnicodeRange> GetUnicodeRanges()
const {
271 size_t num_ranges = 0;
272 auto ec = GXSysFontGetUnicodeRanges(m_handle,
nullptr, 0, &num_ranges);
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));
282 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
SystemFont, GXSysFont)
320class FontFace :
public detail::RefCountedHandle<GXFontFace> {
327 PDF_CHECK_SUCCESS(ec,
"Failed to create a font face");
332 auto sysfont = FindSystemFont(family, style);
333 return FromSystemFont(sysfont);
336 static FontFace LoadFromFile(
const std::filesystem::path& path, uint32_t faceindex = 0, uint32_t* ptotalfaces =
nullptr) {
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");
344 static FontFace LoadFromMemory(
const void* data,
size_t size,
bool copyData =
true, uint32_t faceindex = 0, uint32_t* ptotalfaces =
nullptr) {
346 auto ec = GXCreateFontFaceFromMemory(data, size, copyData, faceindex, ptotalfaces, &fontface);
347 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from memory");
351 std::wstring GetFamilyName()
const {
352 return detail::GetWstringProperty(GXFontFaceGetFamilyName, m_handle);
355 std::wstring GetPostScriptName()
const {
356 return detail::GetWstringProperty(GXFontFaceGetPostScriptName, m_handle);
359 std::wstring GetFontName()
const {
360 return detail::GetWstringProperty(GXFontFaceGetFontName, m_handle);
365 PDF_CHECK_SUCCESS_X(GXFontFaceGetStyle(m_handle, &style));
369 GXFontFlags GetFontFlags()
const {
370 GXFontFlags flags = 0;
371 PDF_CHECK_SUCCESS_X(GXFontFaceGetFontFlags(m_handle, &flags));
375 std::vector<GXUnicodeRange> GetUnicodeRanges()
const {
376 size_t num_ranges = 0;
377 auto ec = GXFontFaceGetUnicodeRanges(m_handle,
nullptr, 0, &num_ranges);
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));
389 auto ec = GXFontFaceGetMetrics(m_handle, &metrics);
390 PDF_CHECK_SUCCESS(ec,
"Failed to get the font metrics");
394 uint32_t GetGlyphIndex(uint32_t unicode)
const {
396 auto ec = GXFontFaceGetGlyphIndex(m_handle, unicode, &gid);
397 PDF_CHECK_SUCCESS(ec,
"Failed to get the glyph index");
406 ReadStream OpenFontStream(uint32_t tableTag = 0)
const {
408 auto ec = GXFontFaceOpenFontStream(m_handle, tableTag, &stream);
409 PDF_CHECK_SUCCESS(ec,
"Failed to open the font table stream");
413 RectF CalculateTextBound(
float fontSize,
const std::wstring& text)
const {
415 auto ec = GXFontFaceCalculateTextBound(m_handle, fontSize, text.c_str(), &bound);
416 PDF_CHECK_SUCCESS(ec,
"Failed to calculate the text bound");
420 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
FontFace, GXFontFace)
427class Geometry :
public detail::RefCountedHandle<GXGeometry> {
432 PDF_CHECK_SUCCESS(ec,
"Failed to create a geometry");
438 geom.Rectangle(rect);
443 auto ec = GXGeometrySetFillRule(m_handle, fillrule);
444 PDF_CHECK_SUCCESS(ec,
"Failed to set the geometry fill rule");
449 auto ec = GXGeometryGetFillRule(m_handle, &fillrule);
450 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry fill rule");
454 bool IsPointsEmpty()
const {
456 auto ec = GXGeometryEmpty(m_handle, &empty);
457 PDF_CHECK_SUCCESS(ec,
"Failed to check the geometry points");
461 bool IsPointsEqual(
const Geometry& rhs)
const {
463 auto ec = GXGeometryPointsEqual(m_handle, rhs.get(), &empty);
464 PDF_CHECK_SUCCESS(ec,
"Failed to check the geometry points");
468 bool GetCurrentPoint(
PointF* presult)
const {
469 auto ec = GXGeometryGetCurrentPoint(m_handle, presult);
472 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry points");
476 RectF GetBound(
const Matrix* xform =
nullptr)
const {
478 auto ec = GXGeometryGetBound(m_handle, xform, &bound);
479 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry bound");
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);
490 void BeginFigure(
const PointF& point) {
491 auto ec = GXGeometryBeginFigure(m_handle, &point);
492 PDF_CHECK_SUCCESS(ec,
"Failed to begin figure");
496 auto ec = GXGeometryEndFigure(m_handle);
497 PDF_CHECK_SUCCESS(ec,
"Failed to end figure");
500 void EndFigureClose() {
501 auto ec = GXGeometryEndFigureClose(m_handle);
502 PDF_CHECK_SUCCESS(ec,
"Failed to close figure");
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");
511 auto ec = GXGeometryConicCurveTo(m_handle, &c, &to);
512 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
516 auto ec = GXGeometryCubicCurveTo(m_handle, &c0, &c1, &to);
517 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
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");
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");
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");
537 auto ec = GXGeometryCopy(m_handle, ©);
538 PDF_CHECK_SUCCESS(ec,
"Failed to copy the geometry");
544 auto ec = GXGeometryTransform(m_handle, &xform, &result);
545 PDF_CHECK_SUCCESS(ec,
"Failed to transform the geometry");
551 auto ec = GXGeometryWiden(m_handle, width, ¶ms, flatness, &result);
552 PDF_CHECK_SUCCESS(ec,
"Failed to widen the geometry");
558 const Matrix* xform =
nullptr,
559 float flatness = 0.75)
const {
561 auto ec = GXGeometryCombine(m_handle, rhs.get(), xform, mode, flatness, &result);
562 PDF_CHECK_SUCCESS(ec,
"Failed to combine the geometries");
566 bool HitTest(
const PointF& point)
const {
568 auto ec = GXGeometryHitTest(m_handle, &point, &hit);
569 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the geometry");
573 Geometry Simplify(
float flatness = 0.75)
const {
575 auto ec = GXGeometrySimplify(m_handle, flatness, &result);
576 PDF_CHECK_SUCCESS(ec,
"Failed to simplify the geometries");
580 std::optional<RectF> IsRectangle(
const Matrix& xform =
Matrix{})
const {
581 bool isrectangle =
false;
583 auto ec = GXGeometryIsRectangle(m_handle, &xform, &isrectangle, &rectangle);
584 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry rectangle");
590 bool IsSingleLine()
const {
591 if (GetNumFigures() > 1)
594 if (GetFigureNumPoints(0) != 2)
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");
607 size_t GetFigureNumSegments(
size_t figureindex)
const {
609 auto ec = GXGeometryGetFigureNumSegments(m_handle, figureindex, &numsegs);
610 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segments");
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");
621 const PointF* GetFigurePointsPtr(
size_t figureindex)
const {
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);
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");
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");
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");
650 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
Geometry, GXGeometry)
727class Region :
public detail::RefCountedHandle<GXRegion> {
732 PDF_CHECK_SUCCESS(ec,
"Failed to create a region");
738 auto ec = GXCreateRegionFromRect(&rect, ®ion);
739 PDF_CHECK_SUCCESS(ec,
"Failed to create a region");
743 bool IsAreaEmpty()
const {
745 auto ec = GXRegionIsAreaEmpty(m_handle, &empty);
746 PDF_CHECK_SUCCESS(ec,
"Failed to check the region area");
750 RectI GetBound()
const {
752 auto ec = GXRegionGetBound(m_handle, &bound);
753 PDF_CHECK_SUCCESS(ec,
"Failed to get the region bound");
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");
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");
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");
778 bool HasIntersection(
const RectI& rect)
const {
780 auto ec = GXRegionHasIntersectionWithRect(m_handle, &rect, &isects);
781 PDF_CHECK_SUCCESS(ec,
"Failed to check the regions intersection");
785 bool HasIntersection(
const Region& region)
const {
787 auto ec = GXRegionHasIntersection(m_handle, region.get(), &isects);
788 PDF_CHECK_SUCCESS(ec,
"Failed to check the regions intersection");
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");
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);
806 auto ec = GXRegionCombineRect(m_handle, &rect, mode, &result);
807 PDF_CHECK_SUCCESS(ec,
"Failed to combine the regions");
808 *
this = std::move(result);
811 using RectEnumFunc = std::function<bool(
const RectI&)>;
813 void EnumRects(RectEnumFunc func)
const {
815 PDFSDK_CALLBACK_BEGIN
816 auto& func = *
reinterpret_cast<RectEnumFunc*
>(userdata);
820 auto ec = GXRegionEnumRects(m_handle, enumProc, &func);
822 PDF_CHECK_SUCCESS(ec,
"Failed to enum the region rects");
825 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
Region, GXRegion)
837 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
849 auto ec = GXCreateRenderTargetExtBuf(pixels, stride, &attrs, &target);
850 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
858 auto ec = GXCreateRenderTargetHWND(hwnd, mode, &target);
859 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
865 auto ec = GXCreateRenderTargetPrintDC(hdc, &target);
866 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
872 auto ec = GXCreateRenderTargetHDC(hdc, rect, &target);
873 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
883 auto ec = GXCreateRenderTargetNSView(nsview, mode, &target);
884 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
892 auto ec = GXRenderTargetGetPixelFormat(m_handle, &format);
893 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target pixel format");
899 auto ec = GXRenderTargetGetSize(m_handle, &size);
900 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target size");
904 void Clear(GXColorValue clrcolor) {
905 auto ec = GXRenderTargetClear(m_handle, clrcolor);
906 PDF_CHECK_SUCCESS(ec,
"Failed to clear the render target");
913 m_target.BeginPaint();
931 auto ec = GXRenderTargetBeginPaint(m_handle);
932 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
936 auto ec = GXRenderTargetEndPaint(m_handle);
937 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
945 m_target.PushState();
963 auto ec = GXRenderTargetPushState(m_handle);
964 PDF_CHECK_SUCCESS(ec,
"Failed to push the render target state");
968 auto ec = GXRenderTargetPopState(m_handle);
969 PDF_CHECK_SUCCESS(ec,
"Failed to pop the render target state");
976 m_ctm = m_target.GetCTM();
981 m_target.SetCTM(m_ctm);
996 auto ec = GXRenderTargetGetCTM(m_handle, &ctm);
997 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target CTM");
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");
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");
1011 void RotateCTM(
float radians) {
1012 auto ec = GXRenderTargetRotateCTM(m_handle, radians);
1013 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
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");
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");
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");
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");
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");
1042 auto ec = GXRenderTargetSetBlendMode(m_handle, mode);
1043 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target blend mode");
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");
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");
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");
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");
1069 auto ec = GXRenderTargetBeginLayer(m_handle, ¶ms);
1070 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1074 auto ec = GXRenderTargetEndLayer(m_handle);
1075 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
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");
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");
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");
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");
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");
1103 void StrokeLine(
const PointF& start,
1108 auto ec = GXRenderTargetStrokeLine(m_handle, &start, &end, brush.get(), width, params);
1109 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
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");
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");
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");
1127 void ClipRect(
const RectF& rect) {
1128 auto ec = GXRenderTargetClipRect(m_handle, &rect);
1129 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1132 void ClipEllipse(
const RectF& bound) {
1133 auto ec = GXRenderTargetClipEllipse(m_handle, &bound);
1134 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1137 void DrawBitmap(
const Bitmap& bitmap,
1140 auto ec = GXRenderTargetDrawBitmap(m_handle, bitmap.get(), opacity, imode);
1141 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1144 void StretchBitmap(
const Bitmap& bitmap,
1145 const RectF& target_rect,
1148 auto ec = GXRenderTargetStretchBitmap(m_handle, bitmap.get(), &target_rect, opacity, imode);
1149 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
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");
1157 void FillMask(
const Bitmap& mask,
1160 auto ec = GXRenderTargetFillMask(m_handle, mask.get(), brush.get(), imode);
1161 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1164 void InvertRect(
const RectF& rect) {
1165 auto ec = GXRenderTargetInvertRect(m_handle, &rect);
1166 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
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");
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");
1179 RectI GetDrawBounds() {
1181 auto ec = GXRenderTargetGetDrawBounds(m_handle, &bounds);
1182 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target draw bounds");
1186 float GetDpiX()
const {
1188 auto ec = GXRenderTargetGetDpiX(m_handle, &dpiX);
1189 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target DPI X");
1193 float GetDpiY()
const {
1195 auto ec = GXRenderTargetGetDpiY(m_handle, &dpiY);
1196 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target DPI Y");
1200 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(RenderTarget, GXRenderTarget)