// Author: Vadim Zeitlin
// Modified by:
// Created: 05/25/99
-// RCS-ID: $Id$
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
class WXDLLIMPEXP_FWD_CORE wxPrintData;
+#if wxUSE_GRAPHICS_CONTEXT
+class WXDLLIMPEXP_FWD_CORE wxGraphicsContext;
+#endif
+
// Logical ops
enum wxRasterOperationMode
{
return NULL;
}
+ virtual void* GetHandle() const { return NULL; }
+
// query dimension, colour deps, resolution
virtual void DoGetSize(int *width, int *height) const = 0;
// clipping
+ // Note that this pure virtual method has an implementation that updates
+ // the values returned by DoGetClippingBox() and so can be called from the
+ // derived class overridden version if it makes sense (i.e. if the clipping
+ // box coordinates are not already updated in some other way).
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height) = 0;
+ wxCoord w, wxCoord h) = 0;
// NB: this function works with device coordinates, not the logical ones!
virtual void DoSetDeviceClippingRegion(const wxRegion& region) = 0;
}
virtual void SetLogicalScale(double x, double y);
- virtual void GetLogicalScale(double *x, double *y)
+ virtual void GetLogicalScale(double *x, double *y) const
{
if ( x ) *x = m_logicalScaleX;
if ( y ) *y = m_logicalScaleY;
// this needs to overidden if the axis is inverted
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
+
+ virtual double GetContentScaleFactor() const { return m_contentScaleFactor; }
+
+#ifdef __WXMSW__
+ // Native Windows functions using the underlying HDC don't honour GDI+
+ // transformations which may be applied to it. Using this function we can
+ // transform the coordinates manually before passing them to such functions
+ // (as in e.g. wxRendererMSW code). It doesn't do anything if this is not a
+ // wxGCDC.
+ virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const
+ {
+ return r;
+ }
+#endif // __WXMSW__
+
// ---------------------------------------------------------
// the actual drawing API
{ return wxNullBitmap; }
- virtual void DoDrawLines(int n, wxPoint points[],
+ virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset ) = 0;
virtual void DrawLines(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset );
- virtual void DoDrawPolygon(int n, wxPoint points[],
+ virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
- virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
+ virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);
void DrawPolygon(const wxPointList *list,
void DrawSpline(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3);
- void DrawSpline(int n, wxPoint points[]);
+ void DrawSpline(int n, const wxPoint points[]);
void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
virtual void DoDrawSpline(const wxPointList *points);
virtual int GetResolution() const
{ return -1; }
+#if wxUSE_GRAPHICS_CONTEXT
+ virtual wxGraphicsContext* GetGraphicsContext() const
+ { return NULL; }
+ virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) )
+ {}
+#endif
+
private:
wxDC *m_owner;
double m_scaleX, m_scaleY; // calculated from logical scale and user scale
int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes
+
+ double m_contentScaleFactor; // used by high resolution displays (retina)
// what is a mm on a screen you don't know the size of?
double m_mm_to_pix_x,
wxWindow *GetWindow() const
{ return m_pimpl->GetWindow(); }
+ void *GetHandle() const
+ { return m_pimpl->GetHandle(); }
+
bool IsOk() const
{ return m_pimpl && m_pimpl->IsOk(); }
virtual int GetResolution() const
{ return m_pimpl->GetResolution(); }
+ double GetContentScaleFactor() const
+ { return m_pimpl->GetContentScaleFactor(); }
+
// Right-To-Left (RTL) modes
void SetLayoutDirection(wxLayoutDirection dir)
void SetLogicalScale(double x, double y)
{ m_pimpl->SetLogicalScale( x, y ); }
- void GetLogicalScale(double *x, double *y)
+ void GetLogicalScale(double *x, double *y) const
{ m_pimpl->GetLogicalScale( x, y ); }
void SetLogicalOrigin(wxCoord x, wxCoord y)
void DrawPoint(const wxPoint& pt)
{ m_pimpl->DoDrawPoint(pt.x, pt.y); }
- void DrawLines(int n, wxPoint points[],
+ void DrawLines(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
void DrawLines(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0) );
#endif // WXWIN_COMPATIBILITY_2_8
- void DrawPolygon(int n, wxPoint points[],
+ void DrawPolygon(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
- void DrawPolyPolygon(int n, int count[], wxPoint points[],
+ void DrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3)
{ m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); }
- void DrawSpline(int n, wxPoint points[])
+ void DrawSpline(int n, const wxPoint points[])
{ m_pimpl->DrawSpline(n,points); }
void DrawSpline(const wxPointList *points)
{ m_pimpl->DrawSpline(points); }
TempHDC GetTempHDC() { return TempHDC(*this); }
#endif // __WXMSW__
+#if wxUSE_GRAPHICS_CONTEXT
+ virtual wxGraphicsContext* GetGraphicsContext() const
+ {
+ return m_pimpl->GetGraphicsContext();
+ }
+ virtual void SetGraphicsContext( wxGraphicsContext* ctx )
+ {
+ m_pimpl->SetGraphicsContext(ctx);
+ }
+#endif
+
protected:
// ctor takes ownership of the pointer
wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { }