2006-10-21 12:37:42 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-20 00:14:35 +00:00
|
|
|
// Name: wx/dcgraph.h
|
2006-10-21 12:37:42 +00:00
|
|
|
// Purpose: graphics context device bridge header
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created:
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GRAPHICS_DC_H_
|
|
|
|
#define _WX_GRAPHICS_DC_H_
|
|
|
|
|
|
|
|
#if wxUSE_GRAPHICS_CONTEXT
|
|
|
|
|
2007-12-03 02:15:43 +00:00
|
|
|
#include "wx/dc.h"
|
2006-10-21 12:37:42 +00:00
|
|
|
#include "wx/geometry.h"
|
2006-10-29 10:41:13 +00:00
|
|
|
#include "wx/graphics.h"
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindowDC;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxGCDC: public wxDC
|
2006-10-21 12:37:42 +00:00
|
|
|
{
|
2007-11-30 13:48:22 +00:00
|
|
|
public:
|
|
|
|
wxGCDC( const wxWindowDC& dc );
|
|
|
|
wxGCDC( const wxMemoryDC& dc );
|
2008-07-31 05:57:56 +00:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
2008-04-30 09:26:02 +00:00
|
|
|
wxGCDC( const wxPrinterDC& dc );
|
2011-07-19 22:35:41 +00:00
|
|
|
#endif
|
|
|
|
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
|
|
|
|
wxGCDC( const wxEnhMetaFileDC& dc );
|
2008-07-31 05:57:56 +00:00
|
|
|
#endif
|
2011-08-27 23:26:53 +00:00
|
|
|
wxGCDC(wxGraphicsContext* context);
|
|
|
|
|
2007-11-30 13:48:22 +00:00
|
|
|
wxGCDC();
|
2007-12-03 16:34:29 +00:00
|
|
|
virtual ~wxGCDC();
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2009-10-05 22:56:58 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
// override wxDC virtual functions to provide access to HDC associated with
|
|
|
|
// this Graphics object (implemented in src/msw/graphics.cpp)
|
|
|
|
virtual WXHDC AcquireHDC();
|
|
|
|
virtual void ReleaseHDC(WXHDC hdc);
|
|
|
|
#endif // __WXMSW__
|
|
|
|
|
|
|
|
private:
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxGCDC);
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxGCDC);
|
2007-11-30 13:48:22 +00:00
|
|
|
};
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2007-11-30 13:48:22 +00:00
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl
|
2007-11-30 13:48:22 +00:00
|
|
|
{
|
2006-10-21 12:37:42 +00:00
|
|
|
public:
|
2007-11-30 13:48:22 +00:00
|
|
|
wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
|
|
|
|
wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
|
2008-07-31 05:57:56 +00:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
2008-04-30 09:26:02 +00:00
|
|
|
wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc );
|
2011-07-19 22:35:41 +00:00
|
|
|
#endif
|
|
|
|
#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
|
|
|
|
wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc );
|
2008-07-31 05:57:56 +00:00
|
|
|
#endif
|
2007-11-30 13:48:22 +00:00
|
|
|
wxGCDCImpl( wxDC *owner );
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2007-11-30 13:48:22 +00:00
|
|
|
virtual ~wxGCDCImpl();
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
// implement base class pure virtuals
|
|
|
|
// ----------------------------------
|
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void Clear() wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual bool StartDoc( const wxString& message ) wxOVERRIDE;
|
|
|
|
virtual void EndDoc() wxOVERRIDE;
|
2007-11-09 20:25:57 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void StartPage() wxOVERRIDE;
|
|
|
|
virtual void EndPage() wxOVERRIDE;
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2007-11-09 20:25:57 +00:00
|
|
|
// flushing the content of this dc immediately onto screen
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void Flush() wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void SetFont(const wxFont& font) wxOVERRIDE;
|
|
|
|
virtual void SetPen(const wxPen& pen) wxOVERRIDE;
|
|
|
|
virtual void SetBrush(const wxBrush& brush) wxOVERRIDE;
|
|
|
|
virtual void SetBackground(const wxBrush& brush) wxOVERRIDE;
|
|
|
|
virtual void SetBackgroundMode(int mode) wxOVERRIDE;
|
|
|
|
virtual void SetPalette(const wxPalette& palette) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DestroyClippingRegion() wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual wxCoord GetCharHeight() const wxOVERRIDE;
|
|
|
|
virtual wxCoord GetCharWidth() const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual bool CanDrawBitmap() const wxOVERRIDE;
|
|
|
|
virtual bool CanGetTextExtent() const wxOVERRIDE;
|
|
|
|
virtual int GetDepth() const wxOVERRIDE;
|
|
|
|
virtual wxSize GetPPI() const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void SetTextForeground(const wxColour& colour) wxOVERRIDE;
|
|
|
|
virtual void SetTextBackground(const wxColour& colour) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void ComputeScaleAndOrigin() wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
wxGraphicsContext* GetGraphicsContext() const wxOVERRIDE { return m_graphicContext; }
|
|
|
|
virtual void SetGraphicsContext( wxGraphicsContext* ctx ) wxOVERRIDE;
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void* GetHandle() const wxOVERRIDE;
|
2012-07-28 19:31:03 +00:00
|
|
|
|
2006-10-21 12:37:42 +00:00
|
|
|
// the true implementations
|
|
|
|
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual void DoGradientFillLinear(const wxRect& rect,
|
|
|
|
const wxColour& initialColour,
|
|
|
|
const wxColour& destColour,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxDirection nDirection = wxEAST) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual void DoGradientFillConcentric(const wxRect& rect,
|
|
|
|
const wxColour& initialColour,
|
|
|
|
const wxColour& destColour,
|
2015-09-07 00:20:42 +00:00
|
|
|
const wxPoint& circleCenter) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
#if wxUSE_SPLINES
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoDrawSpline(const wxPointList *points) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
#endif
|
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
|
|
|
wxCoord x2, wxCoord y2,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxCoord xc, wxCoord yc) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxCoord width, wxCoord height) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
2015-09-07 00:20:42 +00:00
|
|
|
double sa, double ea) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
|
|
|
wxCoord width, wxCoord height,
|
2015-09-07 00:20:42 +00:00
|
|
|
double radius) wxOVERRIDE;
|
|
|
|
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
|
2015-09-07 00:20:42 +00:00
|
|
|
bool useMask = false) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
2015-09-07 00:20:42 +00:00
|
|
|
double angle) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
2009-01-08 14:21:53 +00:00
|
|
|
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
2009-08-21 10:41:26 +00:00
|
|
|
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2007-03-18 15:32:27 +00:00
|
|
|
virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
|
|
|
|
wxCoord dstWidth, wxCoord dstHeight,
|
|
|
|
wxDC *source,
|
|
|
|
wxCoord xsrc, wxCoord ysrc,
|
|
|
|
wxCoord srcWidth, wxCoord srcHeight,
|
2009-01-08 14:21:53 +00:00
|
|
|
wxRasterOperationMode = wxCOPY, bool useMask = false,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE;
|
2007-03-18 15:32:27 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoGetSize(int *,int *) const wxOVERRIDE;
|
|
|
|
virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2013-01-18 17:27:51 +00:00
|
|
|
virtual void DoDrawLines(int n, const wxPoint points[],
|
2015-09-07 00:20:42 +00:00
|
|
|
wxCoord xoffset, wxCoord yoffset) wxOVERRIDE;
|
2013-01-18 17:27:51 +00:00
|
|
|
virtual void DoDrawPolygon(int n, const wxPoint points[],
|
2009-01-08 14:21:53 +00:00
|
|
|
wxCoord xoffset, wxCoord yoffset,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE;
|
2013-01-18 17:27:51 +00:00
|
|
|
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
|
2009-01-08 14:21:53 +00:00
|
|
|
wxCoord xoffset, wxCoord yoffset,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxPolygonFillMode fillStyle) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
|
2015-09-07 00:20:42 +00:00
|
|
|
wxCoord width, wxCoord height) wxOVERRIDE;
|
2016-09-01 18:55:17 +00:00
|
|
|
virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
|
|
|
|
wxCoord *w, wxCoord *h) const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
virtual void DoGetTextExtent(const wxString& string,
|
|
|
|
wxCoord *x, wxCoord *y,
|
|
|
|
wxCoord *descent = NULL,
|
|
|
|
wxCoord *externalLeading = NULL,
|
2015-09-07 00:20:42 +00:00
|
|
|
const wxFont *theFont = NULL) const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2015-09-07 00:20:42 +00:00
|
|
|
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
2011-07-07 13:05:22 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const;
|
|
|
|
#endif // __WXMSW__
|
|
|
|
|
2016-09-01 18:55:17 +00:00
|
|
|
// update the internal clip box variables
|
|
|
|
void UpdateClipBox();
|
|
|
|
|
2006-10-21 12:37:42 +00:00
|
|
|
protected:
|
2012-07-13 16:58:37 +00:00
|
|
|
// unused int parameter distinguishes this version, which does not create a
|
|
|
|
// wxGraphicsContext, in the expectation that the derived class will do it
|
|
|
|
wxGCDCImpl(wxDC* owner, int);
|
|
|
|
|
2006-10-21 12:37:42 +00:00
|
|
|
// scaling variables
|
2006-12-03 15:23:42 +00:00
|
|
|
bool m_logicalFunctionSupported;
|
2006-10-29 10:41:13 +00:00
|
|
|
wxGraphicsMatrix m_matrixOriginal;
|
|
|
|
wxGraphicsMatrix m_matrixCurrent;
|
2006-10-21 18:00:11 +00:00
|
|
|
|
|
|
|
double m_formerScaleX, m_formerScaleY;
|
2006-10-21 12:37:42 +00:00
|
|
|
|
|
|
|
wxGraphicsContext* m_graphicContext;
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2016-09-01 18:55:17 +00:00
|
|
|
bool m_isClipBoxValid;
|
|
|
|
|
2012-07-11 06:36:38 +00:00
|
|
|
private:
|
|
|
|
void Init(wxGraphicsContext*);
|
|
|
|
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_CLASS(wxGCDCImpl);
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxGCDCImpl);
|
2006-10-21 12:37:42 +00:00
|
|
|
};
|
|
|
|
|
2007-12-06 16:22:00 +00:00
|
|
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
2006-10-21 12:37:42 +00:00
|
|
|
#endif // _WX_GRAPHICS_DC_H_
|