From 2347bfd9110ee0353d3dc55aeaa9c0d27486d2cc Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 23 Apr 2018 14:36:58 +0000 Subject: [PATCH] Draw: DrawProxy struct git-svn-id: svn://ultimatepp.org/upp/trunk@11907 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/Draw.cpp | 159 +++++++++++++++++++++++++++++++++++++++++++ uppsrc/Draw/Draw.h | 53 +++++++++++++++ 2 files changed, 212 insertions(+) diff --git a/uppsrc/Draw/Draw.cpp b/uppsrc/Draw/Draw.cpp index 8f544f772..a37f945f5 100644 --- a/uppsrc/Draw/Draw.cpp +++ b/uppsrc/Draw/Draw.cpp @@ -521,4 +521,163 @@ void NilDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, void NilDraw::DrawDrawingOp(const Rect& target, const Drawing& w) {} void NilDraw::DrawPaintingOp(const Rect& target, const Painting& w) {} +dword DrawProxy::GetInfo() const +{ + return ptr->GetInfo(); +} + +Size DrawProxy::GetPageSize() const +{ + return ptr->GetPageSize(); +} + +void DrawProxy::StartPage() +{ + ptr->StartPage(); +} + +void DrawProxy::EndPage() +{ + ptr->EndPage(); +} + +void DrawProxy::BeginOp() +{ + ptr->BeginOp(); +} + +void DrawProxy::EndOp() +{ + ptr->EndOp(); +} + +void DrawProxy::OffsetOp(Point p) +{ + ptr->OffsetOp(p); +} + +bool DrawProxy::ClipOp(const Rect& r) +{ + return ptr->ClipOp(r); +} + +bool DrawProxy::ClipoffOp(const Rect& r) +{ + return ptr->ClipoffOp(r); +} + +bool DrawProxy::ExcludeClipOp(const Rect& r) +{ + return ptr->ExcludeClipOp(r); +} + +bool DrawProxy::IntersectClipOp(const Rect& r) +{ + return ptr->IntersectClipOp(r); +} + +bool DrawProxy::IsPaintingOp(const Rect& r) const +{ + return ptr->IsPaintingOp(r); +} + +Rect DrawProxy::GetPaintRect() const +{ + return ptr->GetPaintRect(); +} + +void DrawProxy::DrawRectOp(int x, int y, int cx, int cy, Color color) +{ + ptr->DrawRectOp(x, y, cx, cy, color); +} + +void DrawProxy::SysDrawImageOp(int x, int y, const Image& img, Color color) +{ + ptr->SysDrawImageOp(x, y, img, color); +} + +void DrawProxy::SysDrawImageOp(int x, int y, const Image& img, const Rect& src, Color color) +{ + ptr->SysDrawImageOp(x, y, img, src, color); +} + +void DrawProxy::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color) +{ + ptr->DrawImageOp(x, y, cx, cy, img, src, color); +} + +void DrawProxy::DrawDataOp(int x, int y, int cx, int cy, const String& data, const char *id) +{ + ptr->DrawDataOp(x, y, cx, cy, data, id); +} + +void DrawProxy::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color) +{ + ptr->DrawLineOp(x1, y1, x2, y2, width, color); +} + +void DrawProxy::DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts, + int count_count, int width, Color color, Color doxor) +{ + ptr->DrawPolyPolylineOp(vertices, vertex_count, counts, count_count, width, color, doxor); +} + +void DrawProxy::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, const int *subpolygon_counts, + int scc, const int *disjunct_polygon_counts, int dpcc, Color color, + int width, Color outline, uint64 pattern, Color doxor) +{ + ptr->DrawPolyPolyPolygonOp(vertices, vertex_count, subpolygon_counts, scc, disjunct_polygon_counts, + dpcc, color, width, outline, pattern, doxor); +} + +void DrawProxy::DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color) +{ + ptr->DrawArcOp(rc, start, end, width, color); +} + +void DrawProxy::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor) +{ + ptr->DrawEllipseOp(r, color, pen, pencolor); +} + +void DrawProxy::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx) +{ + ptr->DrawTextOp(x, y, angle, text, font, ink, n, dx); +} + +void DrawProxy::DrawDrawingOp(const Rect& target, const Drawing& w) +{ + ptr->DrawDrawingOp(target, w); +} + +void DrawProxy::DrawPaintingOp(const Rect& target, const Painting& w) +{ + ptr->DrawPaintingOp(target, w); +} + +Size DrawProxy::GetNativeDpi() const +{ + return ptr->GetNativeDpi(); +} + +void DrawProxy::BeginNative() +{ + ptr->BeginNative(); +} + +void DrawProxy::EndNative() +{ + ptr->EndNative(); +} + +int DrawProxy::GetCloffLevel() const +{ + return ptr->GetCloffLevel(); +} + +void DrawProxy::Escape(const String& data) +{ + ptr->Escape(data); +} + } diff --git a/uppsrc/Draw/Draw.h b/uppsrc/Draw/Draw.h index 53bb2c978..dfe40ba8f 100644 --- a/uppsrc/Draw/Draw.h +++ b/uppsrc/Draw/Draw.h @@ -761,6 +761,59 @@ public: virtual void DrawPaintingOp(const Rect& target, const Painting& w); }; +struct DrawProxy : Draw { + Draw *ptr; + + void SetTarget(Draw *w) { ptr = w; } + + virtual dword GetInfo() const; + + virtual Size GetPageSize() const; + virtual void StartPage(); + virtual void EndPage(); + + virtual void BeginOp(); + virtual void EndOp(); + virtual void OffsetOp(Point p); + virtual bool ClipOp(const Rect& r); + virtual bool ClipoffOp(const Rect& r); + virtual bool ExcludeClipOp(const Rect& r); + virtual bool IntersectClipOp(const Rect& r); + virtual bool IsPaintingOp(const Rect& r) const; + virtual Rect GetPaintRect() const; + + virtual void DrawRectOp(int x, int y, int cx, int cy, Color color); + virtual void SysDrawImageOp(int x, int y, const Image& img, Color color); + virtual void SysDrawImageOp(int x, int y, const Image& img, const Rect& src, Color color); + virtual void DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color); + virtual void DrawDataOp(int x, int y, int cx, int cy, const String& data, const char *id); + virtual void DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color); + + virtual void DrawPolyPolylineOp(const Point *vertices, int vertex_count, + const int *counts, int count_count, + int width, Color color, Color doxor); + virtual void DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, + const int *subpolygon_counts, int scc, + const int *disjunct_polygon_counts, int dpcc, + Color color, int width, Color outline, + uint64 pattern, Color doxor); + virtual void DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color); + + virtual void DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor); + virtual void DrawTextOp(int x, int y, int angle, const wchar *text, Font font, + Color ink, int n, const int *dx); + virtual void DrawDrawingOp(const Rect& target, const Drawing& w); + virtual void DrawPaintingOp(const Rect& target, const Painting& w); + + virtual Size GetNativeDpi() const; + virtual void BeginNative(); + virtual void EndNative(); + + virtual int GetCloffLevel() const; + + virtual void Escape(const String& data); +}; + class ImageAnyDraw : public Draw { Draw *draw;