61class Bitmap :
public detail::RefCountedHandle<GXBitmap> {
67 PDF_CHECK_SUCCESS(ec,
"Failed to create a bitmap");
71 static Bitmap LoadFromFile(
const std::filesystem::path& path, uint32_t frame_index = 0, uint32_t* ptotal_frames =
nullptr) {
73 auto path_string = path.wstring();
74 auto ec = GXCreateBitmapFromFileFrame(path_string.c_str(), frame_index, ptotal_frames, &bitmap);
75 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from file");
79 static Bitmap LoadFromMemory(
const void* data,
size_t size, uint32_t frame_index = 0, uint32_t* ptotal_frames =
nullptr) {
81 auto ec = GXCreateBitmapFromMemoryFrame(data, size, frame_index, ptotal_frames, &bitmap);
82 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from memory");
87 static Bitmap NewFromHBITMAP(
void* hbitmap) {
89 auto ec = GXCreateBitmapFromHBITMAP(hbitmap, &bitmap);
90 PDF_CHECK_SUCCESS(ec,
"Failed to create a bitmap from HBITMAP");
95 void SaveToFile(
const std::filesystem::path& path)
const {
96 auto path_string = path.wstring();
97 auto ec = GXBitmapSaveToFile(m_handle, path_string.c_str());
98 PDF_CHECK_SUCCESS(ec,
"Failed to save the bitmap to file");
102 void* SaveToHBITMAP()
const {
103 void* hbitmap = NULL;
104 auto ec = GXBitmapSaveToHBITMAP(m_handle, &hbitmap);
105 PDF_CHECK_SUCCESS(ec,
"Failed to save the bitmap to HBITMAP");
112 auto ec = GXBitmapGetPixelFormat(m_handle, &format);
113 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap pixel format");
117 SizeI GetSize()
const {
119 auto ec = GXBitmapGetSize(m_handle, &size);
120 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap size");
124 float GetDpiX()
const {
126 auto ec = GXBitmapGetDpiX(m_handle, &dpix);
127 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap horz dpi");
131 float GetDpiY()
const {
133 auto ec = GXBitmapGetDpiY(m_handle, &dpiy);
134 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap vert dpi");
138 int GetBitsPerPixel()
const {
165 void SetPalette(
const Palette& palette) {
166 auto ec = GXBitmapSetPalette(m_handle, palette.get());
167 PDF_CHECK_SUCCESS(ec,
"Failed to set the bitmap palette");
172 auto ec = GXBitmapGetPalette(m_handle, &palette);
173 PDF_CHECK_SUCCESS(ec,
"Failed to get the bitmap palette");
179 auto ec = GXBitmapLock(m_handle, rect, mode, &lockdata);
180 PDF_CHECK_SUCCESS(ec,
"Failed to lock the bitmap");
185 auto ec = GXBitmapUnlock(m_handle);
186 PDF_CHECK_SUCCESS(ec,
"Failed to unlock the bitmap");
189 void CopyFromBitmap(
const Bitmap& source,
const RectI* source_rect =
nullptr,
const PointI* dest_point =
nullptr) {
190 auto ec = GXBitmapCopyFromBitmap(m_handle, dest_point, source.get(), source_rect);
191 PDF_CHECK_SUCCESS(ec,
"Failed to copy the bitmap");
194 void CopyFromMemory(
const GXLockedData& memory,
const RectI* dest_rect =
nullptr) {
195 auto ec = GXBitmapCopyFromMemory(m_handle, dest_rect, &memory);
196 PDF_CHECK_SUCCESS(ec,
"Failed to copy the bitmap");
199 void CopyToMemory(
const GXLockedData& memory,
const RectI* source_rect =
nullptr)
const {
200 auto ec = GXBitmapCopyToMemory(m_handle, source_rect, &memory);
201 PDF_CHECK_SUCCESS(ec,
"Failed to copy the bitmap");
204 void ColorFill(GXColorValue color,
const RectI* fill_rect =
nullptr) {
205 auto ec = GXBitmapColorFill(m_handle, fill_rect, color);
206 PDF_CHECK_SUCCESS(ec,
"Failed to fill the bitmap");
209 void NotifyChanged() {
210 auto ec = GXBitmapNotifyChanged(m_handle);
211 PDF_CHECK_SUCCESS(ec,
"Failed to notify the bitmap change");
214 void SetOffscreenPainting(
bool offscreen) {
215 auto ec = GXBitmapSetOffscreenPainting(m_handle, offscreen);
216 PDF_CHECK_SUCCESS(ec,
"Failed to set the bitmap offscreen");
219 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
Bitmap, GXBitmap)
242class FontFace :
public detail::RefCountedHandle<GXFontFace> {
247 PDF_CHECK_SUCCESS(ec,
"Failed to create a font face");
251 static FontFace LoadFromFile(
const std::filesystem::path& path, uint32_t faceindex = 0, uint32_t* ptotalfaces =
nullptr) {
253 auto path_string = path.wstring();
254 auto ec = GXCreateFontFaceFromFile(path_string.c_str(), faceindex, ptotalfaces, &fontface);
255 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from file");
259 static FontFace LoadFromMemory(
const void* data,
size_t size,
bool copyData =
true, uint32_t faceindex = 0, uint32_t* ptotalfaces =
nullptr) {
261 auto ec = GXCreateFontFaceFromMemory(data, size, copyData, faceindex, ptotalfaces, &fontface);
262 PDF_CHECK_SUCCESS(ec,
"Failed to load a bitmap from memory");
266 SizeF CalculateTextBound(
float fontSize,
const std::wstring& text)
const {
268 auto ec = GXFontFaceCalculateTextBound(m_handle, fontSize, text.c_str(), &bound);
269 PDF_CHECK_SUCCESS(ec,
"Failed to calculate the text bound");
273 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
FontFace, GXFontFace)
280class Geometry :
public detail::RefCountedHandle<GXGeometry> {
285 PDF_CHECK_SUCCESS(ec,
"Failed to create a geometry");
291 geom.Rectangle(rect);
296 auto ec = GXGeometrySetFillRule(m_handle, fillrule);
297 PDF_CHECK_SUCCESS(ec,
"Failed to set the geometry fill rule");
302 auto ec = GXGeometryGetFillRule(m_handle, &fillrule);
303 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry fill rule");
307 bool IsPointsEmpty()
const {
309 auto ec = GXGeometryEmpty(m_handle, &empty);
310 PDF_CHECK_SUCCESS(ec,
"Failed to check the geometry points");
314 bool IsPointsEqual(
const Geometry& rhs)
const {
316 auto ec = GXGeometryPointsEqual(m_handle, rhs.get(), &empty);
317 PDF_CHECK_SUCCESS(ec,
"Failed to check the geometry points");
321 bool GetCurrentPoint(
PointF* presult)
const {
322 auto ec = GXGeometryGetCurrentPoint(m_handle, presult);
325 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry points");
329 RectF GetBound(
const Matrix* xform =
nullptr)
const {
331 auto ec = GXGeometryGetBound(m_handle, xform, &bound);
332 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry bound");
336 RectF GetWidenBound(
float lineWidth,
const GXStrokeParams& params,
const Matrix* xform =
nullptr,
float flatness = 0.75f)
const {
337 if (Math::FloatEq(lineWidth, 0.0f))
338 lineWidth = flatness;
339 auto widenGeometry = Widen(lineWidth, params);
340 return widenGeometry.GetBound(xform);
343 void BeginFigure(
const PointF& point) {
344 auto ec = GXGeometryBeginFigure(m_handle, &point);
345 PDF_CHECK_SUCCESS(ec,
"Failed to begin figure");
349 auto ec = GXGeometryEndFigure(m_handle);
350 PDF_CHECK_SUCCESS(ec,
"Failed to end figure");
353 void EndFigureClose() {
354 auto ec = GXGeometryEndFigureClose(m_handle);
355 PDF_CHECK_SUCCESS(ec,
"Failed to close figure");
358 void LineTo(
const PointF& to) {
359 auto ec = GXGeometryLineTo(m_handle, &to);
360 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
364 auto ec = GXGeometryConicCurveTo(m_handle, &c, &to);
365 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
369 auto ec = GXGeometryCubicCurveTo(m_handle, &c0, &c1, &to);
370 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
373 void Rectangle(
const RectF& rect) {
374 auto ec = GXGeometryRectangle(m_handle, &rect);
375 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
378 void Ellipse(
const RectF& bound) {
379 auto ec = GXGeometryEllipse(m_handle, &bound);
380 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
383 void RoundRectangle(
const RectF& rect,
float xradii,
float yradii) {
384 auto ec = GXGeometryRoundRectangle(m_handle, &rect, xradii, yradii);
385 PDF_CHECK_SUCCESS(ec,
"Failed to add points to the geometry");
390 auto ec = GXGeometryCopy(m_handle, ©);
391 PDF_CHECK_SUCCESS(ec,
"Failed to copy the geometry");
397 auto ec = GXGeometryTransform(m_handle, &xform, &result);
398 PDF_CHECK_SUCCESS(ec,
"Failed to transform the geometry");
404 auto ec = GXGeometryWiden(m_handle, width, ¶ms, flatness, &result);
405 PDF_CHECK_SUCCESS(ec,
"Failed to widen the geometry");
411 const Matrix* xform =
nullptr,
412 float flatness = 0.75)
const {
414 auto ec = GXGeometryCombine(m_handle, rhs.get(), xform, mode, flatness, &result);
415 PDF_CHECK_SUCCESS(ec,
"Failed to combine the geometries");
419 bool HitTest(
const PointF& point)
const {
421 auto ec = GXGeometryHitTest(m_handle, &point, &hit);
422 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the geometry");
426 Geometry Simplify(
float flatness = 0.75)
const {
428 auto ec = GXGeometrySimplify(m_handle, flatness, &result);
429 PDF_CHECK_SUCCESS(ec,
"Failed to simplify the geometries");
433 std::optional<RectF> IsRectangle(
const Matrix& xform =
Matrix{})
const {
434 bool isrectangle =
false;
436 auto ec = GXGeometryIsRectangle(m_handle, &xform, &isrectangle, &rectangle);
437 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry rectangle");
443 bool IsSingleLine()
const {
444 if (GetNumFigures() > 1)
447 if (GetFigureNumPoints(0) != 2)
453 size_t GetNumFigures()
const {
454 size_t numfigures = 0;
455 auto ec = GXGeometryGetNumFigures(m_handle, &numfigures);
456 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figures");
460 size_t GetFigureNumSegments(
size_t figureindex)
const {
462 auto ec = GXGeometryGetFigureNumSegments(m_handle, figureindex, &numsegs);
463 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segments");
467 size_t GetFigureNumPoints(
size_t figureindex)
const {
468 size_t numpoints = 0;
469 auto ec = GXGeometryGetFigureNumPoints(m_handle, figureindex, &numpoints);
470 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure points");
474 const PointF* GetFigurePointsPtr(
size_t figureindex)
const {
476 auto ec = GXGeometryGetFigurePointsPtr(m_handle, figureindex, &points);
477 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure start point");
478 static_assert(
sizeof(
PointF) ==
sizeof(
PDPointF),
"Size of PointF and PDPointF must be equal");
479 return reinterpret_cast<const PointF*
>(points);
482 bool IsFigureSegmentCurve(
size_t figureindex,
size_t segindex)
const {
483 bool iscurve =
false;
484 auto ec = GXGeometryIsFigureSegmentCurve(m_handle, figureindex, segindex, &iscurve);
485 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segment points");
489 size_t GetFigureSegmentPointsIndex(
size_t figureindex,
size_t segindex)
const {
490 size_t pointsindex = 0;
491 auto ec = GXGeometryGetFigureSegmentPointsIndex(m_handle, figureindex, segindex, &pointsindex);
492 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure segment points");
496 bool IsFigureClosed(
size_t figureindex)
const {
497 bool isclosed =
false;
498 auto ec = GXGeometryIsFigureClosed(m_handle, figureindex, &isclosed);
499 PDF_CHECK_SUCCESS(ec,
"Failed to get the geometry figure closed");
503 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
Geometry, GXGeometry)
580class Region :
public detail::RefCountedHandle<GXRegion> {
585 PDF_CHECK_SUCCESS(ec,
"Failed to create a region");
591 auto ec = GXCreateRegionFromRect(&rect, ®ion);
592 PDF_CHECK_SUCCESS(ec,
"Failed to create a region");
596 bool IsAreaEmpty()
const {
598 auto ec = GXRegionIsAreaEmpty(m_handle, &empty);
599 PDF_CHECK_SUCCESS(ec,
"Failed to check the region area");
603 RectI GetBound()
const {
605 auto ec = GXRegionGetBound(m_handle, &bound);
606 PDF_CHECK_SUCCESS(ec,
"Failed to get the region bound");
610 bool Contains(
const PointI& point)
const {
611 bool contains =
false;
612 auto ec = GXRegionContainsPoint(m_handle, &point, &contains);
613 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the region");
617 bool Contains(
const RectI& rect)
const {
618 bool contains =
false;
619 auto ec = GXRegionContainsRect(m_handle, &rect, &contains);
620 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the region");
624 bool Contains(
const Region& region)
const {
625 bool contains =
false;
626 auto ec = GXRegionContains(m_handle, region.get(), &contains);
627 PDF_CHECK_SUCCESS(ec,
"Failed to hit test the region");
631 bool HasIntersection(
const RectI& rect)
const {
633 auto ec = GXRegionHasIntersectionWithRect(m_handle, &rect, &isects);
634 PDF_CHECK_SUCCESS(ec,
"Failed to check the regions intersection");
638 bool HasIntersection(
const Region& region)
const {
640 auto ec = GXRegionHasIntersection(m_handle, region.get(), &isects);
641 PDF_CHECK_SUCCESS(ec,
"Failed to check the regions intersection");
645 void Offset(
int dx,
int dy) {
646 auto ec = GXRegionOffset(m_handle, dx, dy);
647 PDF_CHECK_SUCCESS(ec,
"Failed to offset the region");
651 GXRegion result =
nullptr;
652 auto ec = GXRegionCombine(m_handle, region.get(), mode, &result);
653 PDF_CHECK_SUCCESS(ec,
"Failed to combine the regions");
658 GXRegion result =
nullptr;
659 auto ec = GXRegionCombineRect(m_handle, &rect, mode, &result);
660 PDF_CHECK_SUCCESS(ec,
"Failed to combine the regions");
664 using RectEnumFunc = std::function<bool(
const RectI&)>;
666 static PDErrCode PDFSDK_CALLCONV RectEnumProc_(
void* userdata,
const PDRectI* rect) {
667 auto& func = *
reinterpret_cast<RectEnumFunc*
>(userdata);
671 void EnumRects(RectEnumFunc func)
const {
672 auto ec = GXRegionEnumRects(m_handle, RectEnumProc_, &func);
674 PDF_CHECK_SUCCESS(ec,
"Failed to enum the region rects");
677 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(
Region, GXRegion)
689 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
701 auto ec = GXCreateRenderTargetExtBuf(pixels, stride, &attrs, &target);
702 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
710 auto ec = GXCreateRenderTargetHWND(hwnd, mode, &target);
711 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
717 auto ec = GXCreateRenderTargetPrintDC(hdc, &target);
718 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
724 auto ec = GXCreateRenderTargetHDC(hdc, rect, &target);
725 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
735 auto ec = GXCreateRenderTargetNSView(nsview, mode, &target);
736 PDF_CHECK_SUCCESS(ec,
"Failed to create the render target");
744 auto ec = GXRenderTargetGetPixelFormat(m_handle, &format);
745 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target pixel format");
751 auto ec = GXRenderTargetGetSize(m_handle, &size);
752 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target size");
756 void Clear(GXColorValue clrcolor) {
757 auto ec = GXRenderTargetClear(m_handle, clrcolor);
758 PDF_CHECK_SUCCESS(ec,
"Failed to clear the render target");
765 m_target.BeginPaint();
783 auto ec = GXRenderTargetBeginPaint(m_handle);
784 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
788 auto ec = GXRenderTargetEndPaint(m_handle);
789 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
797 m_target.PushState();
815 auto ec = GXRenderTargetPushState(m_handle);
816 PDF_CHECK_SUCCESS(ec,
"Failed to push the render target state");
820 auto ec = GXRenderTargetPopState(m_handle);
821 PDF_CHECK_SUCCESS(ec,
"Failed to pop the render target state");
828 m_ctm = m_target.GetCTM();
833 m_target.SetCTM(m_ctm);
848 auto ec = GXRenderTargetGetCTM(m_handle, &ctm);
849 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target CTM");
853 void SetCTM(
const Matrix& ctm) {
854 auto ec = GXRenderTargetSetCTM(m_handle, &ctm);
855 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
858 void ConcatCTM(
const Matrix& xform) {
859 auto ec = GXRenderTargetConcatCTM(m_handle, &xform);
860 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
863 void RotateCTM(
float radians) {
864 auto ec = GXRenderTargetRotateCTM(m_handle, radians);
865 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
868 void ScaleCTM(
float scale) {
869 auto ec = GXRenderTargetScaleCTM(m_handle, scale, scale);
870 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
873 void ScaleCTM(
float sx,
float sy) {
874 auto ec = GXRenderTargetScaleCTM(m_handle, sx, sy);
875 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
878 void ScaleCTM(
const SizeF& scale) {
879 auto ec = GXRenderTargetScaleCTM(m_handle, scale.width, scale.height);
880 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
883 void TranslateCTM(
float dx,
float dy) {
884 auto ec = GXRenderTargetTranslateCTM(m_handle, dx, dy);
885 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
888 void TranslateCTM(
const PointF& delta) {
889 auto ec = GXRenderTargetTranslateCTM(m_handle, delta.x, delta.y);
890 PDF_CHECK_SUCCESS(ec,
"Failed to modify the render target CTM");
894 auto ec = GXRenderTargetSetBlendMode(m_handle, mode);
895 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target blend mode");
898 void SetStrokeAdjustment(
bool adjust) {
899 auto ec = GXRenderTargetSetStrokeAdjustment(m_handle, adjust);
900 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target stroke adjust");
903 bool GetStrokeAdjustment()
const {
905 auto ec = GXRenderTargetGetStrokeAdjustment(m_handle, &adjust);
906 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target stroke adjust");
910 void SetOpacityMask(
GXMaskMode mode,
const Brush& mask) {
911 auto ec = GXRenderTargetSetOpacityMask(m_handle, mode, mask.get());
912 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target mask");
915 void SetShapeMask(
GXMaskMode mode,
const Brush& mask) {
916 auto ec = GXRenderTargetSetShapeMask(m_handle, mode, mask.get());
917 PDF_CHECK_SUCCESS(ec,
"Failed to set the render target mask");
921 auto ec = GXRenderTargetBeginLayer(m_handle, ¶ms);
922 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
926 auto ec = GXRenderTargetEndLayer(m_handle);
927 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
930 void FillGeometry(
const Geometry& geom,
const Brush& brush) {
931 auto ec = GXRenderTargetFillGeometry(m_handle, geom.get(), brush.get());
932 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
935 void FillTextGeometry(
const Geometry& geom,
const Brush& brush) {
936 auto ec = GXRenderTargetFillTextGeometry(m_handle, geom.get(), brush.get());
937 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
940 void FillRect(
const RectF& rect,
const Brush& brush) {
941 auto ec = GXRenderTargetFillRect(m_handle, &rect, brush.get());
942 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
945 void FillEllipse(
const RectF& bound,
const Brush& brush) {
946 auto ec = GXRenderTargetFillEllipse(m_handle, &bound, brush.get());
947 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
950 void StrokeGeometry(
const Geometry& geom,
const Brush& brush,
float width,
const GXStrokeParams* params =
nullptr) {
951 auto ec = GXRenderTargetStrokeGeometry(m_handle, geom.get(), brush.get(), width, params);
952 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
955 void StrokeLine(
const PointF& start,
960 auto ec = GXRenderTargetStrokeLine(m_handle, &start, &end, brush.get(), width, params);
961 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
964 void StrokeRect(
const RectF& rect,
const Brush& brush,
float width,
const GXStrokeParams* params =
nullptr) {
965 auto ec = GXRenderTargetStrokeRect(m_handle, &rect, brush.get(), width, params);
966 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
969 void StrokeEllipse(
const RectF& bound,
const Brush& brush,
float width,
const GXStrokeParams* params =
nullptr) {
970 auto ec = GXRenderTargetStrokeEllipse(m_handle, &bound, brush.get(), width, params);
971 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
974 void ClipGeometry(
const Geometry& geom) {
975 auto ec = GXRenderTargetClipGeometry(m_handle, geom.get());
976 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
979 void ClipRect(
const RectF& rect) {
980 auto ec = GXRenderTargetClipRect(m_handle, &rect);
981 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
984 void ClipEllipse(
const RectF& bound) {
985 auto ec = GXRenderTargetClipEllipse(m_handle, &bound);
986 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
989 void DrawBitmap(
const Bitmap& bitmap,
992 auto ec = GXRenderTargetDrawBitmap(m_handle, bitmap.get(), opacity, imode);
993 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
996 void StretchBitmap(
const Bitmap& bitmap,
997 const RectF& target_rect,
1000 auto ec = GXRenderTargetStretchBitmap(m_handle, bitmap.get(), &target_rect, opacity, imode);
1001 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1004 void DrawGradient(
const Gradient& gradient,
float opacity) {
1005 auto ec = GXRenderTargetDrawGradient(m_handle, gradient.get(), opacity);
1006 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1009 void FillMask(
const Bitmap& mask,
1012 auto ec = GXRenderTargetFillMask(m_handle, mask.get(), brush.get(), imode);
1013 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1016 void InvertRect(
const RectF& rect) {
1017 auto ec = GXRenderTargetInvertRect(m_handle, &rect);
1018 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1021 void InvertLine(
const PointI& start,
const PointI& end) {
1022 auto ec = GXRenderTargetInvertLine(m_handle, &start, &end);
1023 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1026 void FillText(
const FontFace& font,
float fontSize,
const std::wstring& text,
const Brush& brush) {
1027 auto ec = GXRenderTargetFillText(m_handle, font.get(), fontSize, text.c_str(), brush.get());
1028 PDF_CHECK_SUCCESS(ec,
"Failed to paint the render target");
1031 RectI GetDrawBounds() {
1033 auto ec = GXRenderTargetGetDrawBounds(m_handle, &bounds);
1034 PDF_CHECK_SUCCESS(ec,
"Failed to get the render target draw bounds");
1038 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(RenderTarget, GXRenderTarget)