1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-15 11:26:27 -04:00
|
|
|
// Name: wx/generic/dcps.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose: wxPostScriptDC class
|
|
|
|
// Author: Julian Smart and others
|
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) Julian Smart and Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#ifndef _WX_DCPSG_H_
|
|
|
|
#define _WX_DCPSG_H_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2006-05-26 12:12:31 -04:00
|
|
|
#include "wx/defs.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2007-09-24 10:04:09 -04:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2006-05-26 12:12:31 -04:00
|
|
|
#include "wx/dc.h"
|
2007-11-14 09:49:40 -05:00
|
|
|
#include "wx/dcprint.h"
|
1999-01-22 06:06:20 -05:00
|
|
|
#include "wx/dialog.h"
|
|
|
|
#include "wx/module.h"
|
1999-03-25 18:06:01 -05:00
|
|
|
#include "wx/cmndata.h"
|
2007-03-17 06:26:10 -04:00
|
|
|
#include "wx/strvararg.h"
|
1998-10-12 03:46:15 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxPostScriptDC
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-12-05 16:53:51 -05:00
|
|
|
|
2007-11-14 09:49:40 -05:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxPostScriptDC : public wxDC
|
2007-11-14 09:49:40 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPostScriptDC();
|
|
|
|
|
|
|
|
// Recommended constructor
|
|
|
|
wxPostScriptDC(const wxPrintData& printData);
|
2007-11-30 16:17:23 -05:00
|
|
|
|
2007-11-14 09:49:40 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
|
|
|
|
};
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1999-01-22 06:06:20 -05:00
|
|
|
public:
|
2007-11-30 08:48:22 -05:00
|
|
|
wxPostScriptDCImpl( wxPrinterDC *owner );
|
|
|
|
wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data );
|
|
|
|
wxPostScriptDCImpl( wxPostScriptDC *owner );
|
|
|
|
wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data );
|
1999-03-25 18:06:01 -05:00
|
|
|
|
2007-11-14 09:49:40 -05:00
|
|
|
void Init();
|
|
|
|
|
2007-11-30 08:48:22 -05:00
|
|
|
virtual ~wxPostScriptDCImpl();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
virtual bool Ok() const { return IsOk(); }
|
|
|
|
virtual bool IsOk() const;
|
1999-01-22 06:06:20 -05:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
bool CanDrawBitmap() const { return true; }
|
1999-01-22 06:06:20 -05:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
void Clear();
|
|
|
|
void SetFont( const wxFont& font );
|
|
|
|
void SetPen( const wxPen& pen );
|
|
|
|
void SetBrush( const wxBrush& brush );
|
2009-01-08 09:21:53 -05:00
|
|
|
void SetLogicalFunction( wxRasterOperationMode function );
|
2007-05-02 07:05:45 -04:00
|
|
|
void SetBackground( const wxBrush& brush );
|
1999-01-22 06:06:20 -05:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
void DestroyClippingRegion();
|
1999-06-08 15:10:37 -04:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
bool StartDoc(const wxString& message);
|
|
|
|
void EndDoc();
|
|
|
|
void StartPage();
|
|
|
|
void EndPage();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
wxCoord GetCharHeight() const;
|
|
|
|
wxCoord GetCharWidth() const;
|
|
|
|
bool CanGetTextExtent() const { return true; }
|
1999-03-25 18:06:01 -05:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
// Resolution in pixels per logical inch
|
|
|
|
wxSize GetPPI() const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2007-09-26 15:33:44 -04:00
|
|
|
virtual void ComputeScaleAndOrigin();
|
1999-01-22 06:06:20 -05:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
void SetBackgroundMode(int WXUNUSED(mode)) { }
|
|
|
|
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
void SetPrintData(const wxPrintData& data);
|
|
|
|
wxPrintData& GetPrintData() { return m_printData; }
|
1999-06-08 15:10:37 -04:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
virtual int GetDepth() const { return 24; }
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2007-05-02 07:05:45 -04:00
|
|
|
void PsPrint( const wxString& psdata );
|
2007-11-30 16:17:23 -05:00
|
|
|
|
2007-11-14 09:49:40 -05:00
|
|
|
// Overrridden for wxPrinterDC Impl
|
2007-11-30 16:17:23 -05:00
|
|
|
|
2008-11-15 06:10:34 -05:00
|
|
|
virtual int GetResolution() const;
|
|
|
|
virtual wxRect GetPaperRect() const;
|
1999-03-25 18:06:01 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
protected:
|
2009-08-21 06:41:26 -04:00
|
|
|
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxFloodFillStyle style = wxFLOOD_SURFACE);
|
2006-02-08 16:47:09 -05:00
|
|
|
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
|
|
|
|
void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
|
|
|
void DoCrossHair(wxCoord x, wxCoord y) ;
|
|
|
|
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
|
|
|
|
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
|
|
|
|
void DoDrawPoint(wxCoord x, wxCoord y);
|
|
|
|
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
|
2009-08-21 06:41:26 -04:00
|
|
|
void DoDrawPolygon(int n, wxPoint points[],
|
|
|
|
wxCoord xoffset = 0, wxCoord yoffset = 0,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
|
2009-08-21 06:41:26 -04:00
|
|
|
void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
|
|
|
|
wxCoord xoffset = 0, wxCoord yoffset = 0,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
|
2006-02-08 16:47:09 -05:00
|
|
|
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
|
|
|
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
|
|
|
|
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
|
|
|
#if wxUSE_SPLINES
|
2007-10-19 10:53:55 -04:00
|
|
|
void DoDrawSpline(const wxPointList *points);
|
2007-11-14 09:49:40 -05:00
|
|
|
#endif
|
2006-02-08 16:47:09 -05:00
|
|
|
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
2009-08-21 06:41:26 -04:00
|
|
|
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
|
2006-02-08 16:47:09 -05:00
|
|
|
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
|
|
|
|
void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
|
|
|
|
void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
|
|
|
|
void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
|
|
|
|
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
|
|
|
|
void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
2008-06-07 21:45:56 -04:00
|
|
|
void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip))
|
|
|
|
{
|
|
|
|
wxFAIL_MSG( "not implemented" );
|
|
|
|
}
|
2006-02-08 16:47:09 -05:00
|
|
|
void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
|
|
|
|
wxCoord *descent = NULL,
|
|
|
|
wxCoord *externalLeading = NULL,
|
2007-04-24 21:49:47 -04:00
|
|
|
const wxFont *theFont = NULL) const;
|
2006-02-08 16:47:09 -05:00
|
|
|
void DoGetSize(int* width, int* height) const;
|
|
|
|
void DoGetSizeMM(int *width, int *height) const;
|
2003-07-08 07:18:42 -04:00
|
|
|
|
2002-08-17 12:29:05 -04:00
|
|
|
FILE* m_pstream; // PostScript output stream
|
|
|
|
unsigned char m_currentRed;
|
|
|
|
unsigned char m_currentGreen;
|
|
|
|
unsigned char m_currentBlue;
|
|
|
|
int m_pageNumber;
|
|
|
|
bool m_clipping;
|
|
|
|
double m_underlinePosition;
|
|
|
|
double m_underlineThickness;
|
|
|
|
wxPrintData m_printData;
|
2007-09-24 10:04:09 -04:00
|
|
|
double m_pageHeight;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2002-08-17 12:29:05 -04:00
|
|
|
private:
|
2007-11-30 08:48:22 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#endif
|
2007-09-24 10:04:09 -04:00
|
|
|
// wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE
|
1998-12-05 16:02:04 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
1999-01-22 06:06:20 -05:00
|
|
|
// _WX_DCPSG_H_
|