no changes, just deTABbed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56752 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
411484436d
commit
caa42c43d0
@ -3,7 +3,7 @@
|
|||||||
// Purpose: graphics context methods common to all platforms
|
// Purpose: graphics context methods common to all platforms
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created:
|
// Created:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
@ -59,42 +59,42 @@ wxGraphicsObjectRefData::wxGraphicsObjectRefData( const wxGraphicsObjectRefData*
|
|||||||
{
|
{
|
||||||
m_renderer = data->m_renderer;
|
m_renderer = data->m_renderer;
|
||||||
}
|
}
|
||||||
wxGraphicsRenderer* wxGraphicsObjectRefData::GetRenderer() const
|
wxGraphicsRenderer* wxGraphicsObjectRefData::GetRenderer() const
|
||||||
{
|
{
|
||||||
return m_renderer ;
|
return m_renderer ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsObjectRefData* wxGraphicsObjectRefData::Clone() const
|
wxGraphicsObjectRefData* wxGraphicsObjectRefData::Clone() const
|
||||||
{
|
{
|
||||||
return new wxGraphicsObjectRefData(this);
|
return new wxGraphicsObjectRefData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsObject::wxGraphicsObject()
|
wxGraphicsObject::wxGraphicsObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsObject::wxGraphicsObject( wxGraphicsRenderer* renderer )
|
wxGraphicsObject::wxGraphicsObject( wxGraphicsRenderer* renderer )
|
||||||
{
|
{
|
||||||
SetRefData( new wxGraphicsObjectRefData(renderer));
|
SetRefData( new wxGraphicsObjectRefData(renderer));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsObject::~wxGraphicsObject()
|
wxGraphicsObject::~wxGraphicsObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGraphicsObject::IsNull() const
|
bool wxGraphicsObject::IsNull() const
|
||||||
{
|
{
|
||||||
return m_refData == NULL;
|
return m_refData == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsRenderer* wxGraphicsObject::GetRenderer() const
|
wxGraphicsRenderer* wxGraphicsObject::GetRenderer() const
|
||||||
{
|
{
|
||||||
return ( IsNull() ? NULL : GetGraphicsData()->GetRenderer() );
|
return ( IsNull() ? NULL : GetGraphicsData()->GetRenderer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsObjectRefData* wxGraphicsObject::GetGraphicsData() const
|
wxGraphicsObjectRefData* wxGraphicsObject::GetGraphicsData() const
|
||||||
{
|
{
|
||||||
return (wxGraphicsObjectRefData*) m_refData;
|
return (wxGraphicsObjectRefData*) m_refData;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObjectRefData* wxGraphicsObject::CreateRefData() const
|
wxObjectRefData* wxGraphicsObject::CreateRefData() const
|
||||||
@ -138,7 +138,7 @@ void wxGraphicsMatrix::Concat( const wxGraphicsMatrix *t )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sets the matrix to the respective values
|
// sets the matrix to the respective values
|
||||||
void wxGraphicsMatrix::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d,
|
void wxGraphicsMatrix::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d,
|
||||||
wxDouble tx, wxDouble ty)
|
wxDouble tx, wxDouble ty)
|
||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
@ -190,7 +190,7 @@ void wxGraphicsMatrix::Rotate( wxDouble angle )
|
|||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
GetMatrixData()->Rotate(angle);
|
GetMatrixData()->Rotate(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// apply the transforms
|
// apply the transforms
|
||||||
@ -252,9 +252,9 @@ void wxGraphicsPath::AddArc( const wxPoint2DDouble& c, wxDouble r, wxDouble star
|
|||||||
|
|
||||||
wxRect2DDouble wxGraphicsPath::GetBox() const
|
wxRect2DDouble wxGraphicsPath::GetBox() const
|
||||||
{
|
{
|
||||||
wxDouble x,y,w,h;
|
wxDouble x,y,w,h;
|
||||||
GetBox(&x,&y,&w,&h);
|
GetBox(&x,&y,&w,&h);
|
||||||
return wxRect2DDouble( x,y,w,h );
|
return wxRect2DDouble( x,y,w,h );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGraphicsPath::Contains( const wxPoint2DDouble& c, int fillStyle ) const
|
bool wxGraphicsPath::Contains( const wxPoint2DDouble& c, int fillStyle ) const
|
||||||
@ -271,7 +271,7 @@ void wxGraphicsPath::MoveToPoint( wxDouble x, wxDouble y )
|
|||||||
GetPathData()->MoveToPoint(x,y);
|
GetPathData()->MoveToPoint(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// adds a straight line from the current point to (x,y)
|
// adds a straight line from the current point to (x,y)
|
||||||
void wxGraphicsPath::AddLineToPoint( wxDouble x, wxDouble y )
|
void wxGraphicsPath::AddLineToPoint( wxDouble x, wxDouble y )
|
||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
@ -313,7 +313,7 @@ void wxGraphicsPath::AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startA
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// These are convenience functions which - if not available natively will be assembled
|
// These are convenience functions which - if not available natively will be assembled
|
||||||
// using the primitives from above
|
// using the primitives from above
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ void wxGraphicsPath::AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x,
|
|||||||
GetPathData()->AddQuadCurveToPoint(cx,cy,x,y);
|
GetPathData()->AddQuadCurveToPoint(cx,cy,x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// appends a rectangle as a new closed subpath
|
// appends a rectangle as a new closed subpath
|
||||||
void wxGraphicsPath::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
void wxGraphicsPath::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h )
|
||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
@ -339,7 +339,7 @@ void wxGraphicsPath::AddCircle( wxDouble x, wxDouble y, wxDouble r )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
|
// appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
|
||||||
void wxGraphicsPath::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r )
|
void wxGraphicsPath::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r )
|
||||||
{
|
{
|
||||||
GetPathData()->AddArcToPoint(x1,y1,x2,y2,r);
|
GetPathData()->AddArcToPoint(x1,y1,x2,y2,r);
|
||||||
}
|
}
|
||||||
@ -427,7 +427,7 @@ void wxGraphicsPathData::AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDoubl
|
|||||||
{
|
{
|
||||||
if (w <= 0. || h <= 0.)
|
if (w <= 0. || h <= 0.)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxDouble rw = w/2;
|
wxDouble rw = w/2;
|
||||||
wxDouble rh = h/2;
|
wxDouble rh = h/2;
|
||||||
wxDouble xc = x + rw;
|
wxDouble xc = x + rw;
|
||||||
@ -458,7 +458,7 @@ void wxGraphicsPathData::AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w
|
|||||||
|
|
||||||
// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
|
// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
|
||||||
void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r )
|
void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r )
|
||||||
{
|
{
|
||||||
wxPoint2DDouble current;
|
wxPoint2DDouble current;
|
||||||
GetCurrentPoint(¤t.m_x,¤t.m_y);
|
GetCurrentPoint(¤t.m_x,¤t.m_y);
|
||||||
wxPoint2DDouble p1(x1,y1);
|
wxPoint2DDouble p1(x1,y1);
|
||||||
@ -501,20 +501,20 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2,
|
|||||||
IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject)
|
||||||
|
|
||||||
|
|
||||||
wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer)
|
wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer)
|
||||||
{
|
{
|
||||||
m_logicalFunction = wxCOPY;
|
m_logicalFunction = wxCOPY;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicsContext::~wxGraphicsContext()
|
wxGraphicsContext::~wxGraphicsContext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGraphicsContext::StartDoc(const wxString& WXUNUSED(message))
|
bool wxGraphicsContext::StartDoc(const wxString& WXUNUSED(message))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGraphicsContext::EndDoc()
|
void wxGraphicsContext::EndDoc()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ void wxGraphicsContext::StartPage(wxDouble WXUNUSED(width),
|
|||||||
wxDouble WXUNUSED(height))
|
wxDouble WXUNUSED(height))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGraphicsContext::EndPage()
|
void wxGraphicsContext::EndPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -536,7 +536,7 @@ void wxGraphicsContext::Flush()
|
|||||||
void wxGraphicsContext::SetAlpha( wxDouble WXUNUSED(alpha) )
|
void wxGraphicsContext::SetAlpha( wxDouble WXUNUSED(alpha) )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDouble wxGraphicsContext::GetAlpha() const
|
wxDouble wxGraphicsContext::GetAlpha() const
|
||||||
{
|
{
|
||||||
return 1.0;
|
return 1.0;
|
||||||
@ -556,7 +556,7 @@ void wxGraphicsContext::GetDPI( wxDouble* dpiX, wxDouble* dpiY)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sets the pen
|
// sets the pen
|
||||||
void wxGraphicsContext::SetPen( const wxGraphicsPen& pen )
|
void wxGraphicsContext::SetPen( const wxGraphicsPen& pen )
|
||||||
{
|
{
|
||||||
m_pen = pen;
|
m_pen = pen;
|
||||||
}
|
}
|
||||||
@ -568,9 +568,9 @@ void wxGraphicsContext::SetPen( const wxPen& pen )
|
|||||||
else
|
else
|
||||||
SetPen( CreatePen( pen ) );
|
SetPen( CreatePen( pen ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets the brush for filling
|
// sets the brush for filling
|
||||||
void wxGraphicsContext::SetBrush( const wxGraphicsBrush& brush )
|
void wxGraphicsContext::SetBrush( const wxGraphicsBrush& brush )
|
||||||
{
|
{
|
||||||
m_brush = brush;
|
m_brush = brush;
|
||||||
}
|
}
|
||||||
@ -584,7 +584,7 @@ void wxGraphicsContext::SetBrush( const wxBrush& brush )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sets the brush for filling
|
// sets the brush for filling
|
||||||
void wxGraphicsContext::SetFont( const wxGraphicsFont& font )
|
void wxGraphicsContext::SetFont( const wxGraphicsFont& font )
|
||||||
{
|
{
|
||||||
m_font = font;
|
m_font = font;
|
||||||
}
|
}
|
||||||
@ -622,18 +622,18 @@ void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, w
|
|||||||
Translate(-x,-y);
|
Translate(-x,-y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush )
|
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, const wxGraphicsBrush& backgroundBrush )
|
||||||
{
|
{
|
||||||
wxGraphicsBrush formerBrush = m_brush;
|
wxGraphicsBrush formerBrush = m_brush;
|
||||||
wxGraphicsPen formerPen = m_pen;
|
wxGraphicsPen formerPen = m_pen;
|
||||||
wxDouble width;
|
wxDouble width;
|
||||||
wxDouble height;
|
wxDouble height;
|
||||||
wxDouble descent;
|
wxDouble descent;
|
||||||
wxDouble externalLeading;
|
wxDouble externalLeading;
|
||||||
GetTextExtent( str , &width, &height, &descent, &externalLeading );
|
GetTextExtent( str , &width, &height, &descent, &externalLeading );
|
||||||
SetBrush( backgroundBrush );
|
SetBrush( backgroundBrush );
|
||||||
// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
|
// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
|
||||||
SetPen( wxNullGraphicsPen );
|
SetPen( wxNullGraphicsPen );
|
||||||
|
|
||||||
wxGraphicsPath path = CreatePath();
|
wxGraphicsPath path = CreatePath();
|
||||||
path.AddRectangle( x , y, width, height );
|
path.AddRectangle( x , y, width, height );
|
||||||
@ -641,13 +641,13 @@ void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, c
|
|||||||
|
|
||||||
DrawText( str, x ,y);
|
DrawText( str, x ,y);
|
||||||
SetBrush( formerBrush );
|
SetBrush( formerBrush );
|
||||||
SetPen( formerPen );
|
SetPen( formerPen );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush )
|
void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle, const wxGraphicsBrush& backgroundBrush )
|
||||||
{
|
{
|
||||||
wxGraphicsBrush formerBrush = m_brush;
|
wxGraphicsBrush formerBrush = m_brush;
|
||||||
wxGraphicsPen formerPen = m_pen;
|
wxGraphicsPen formerPen = m_pen;
|
||||||
|
|
||||||
wxDouble width;
|
wxDouble width;
|
||||||
wxDouble height;
|
wxDouble height;
|
||||||
@ -655,8 +655,8 @@ void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, w
|
|||||||
wxDouble externalLeading;
|
wxDouble externalLeading;
|
||||||
GetTextExtent( str , &width, &height, &descent, &externalLeading );
|
GetTextExtent( str , &width, &height, &descent, &externalLeading );
|
||||||
SetBrush( backgroundBrush );
|
SetBrush( backgroundBrush );
|
||||||
// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
|
// to make sure our 'OffsetToPixelBoundaries' doesn't move the fill shape
|
||||||
SetPen( wxNullGraphicsPen );
|
SetPen( wxNullGraphicsPen );
|
||||||
|
|
||||||
wxGraphicsPath path = CreatePath();
|
wxGraphicsPath path = CreatePath();
|
||||||
path.MoveToPoint( x , y );
|
path.MoveToPoint( x , y );
|
||||||
@ -668,7 +668,7 @@ void wxGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, w
|
|||||||
FillPath( path );
|
FillPath( path );
|
||||||
DrawText( str, x ,y, angle);
|
DrawText( str, x ,y, angle);
|
||||||
SetBrush( formerBrush );
|
SetBrush( formerBrush );
|
||||||
SetPen( formerPen );
|
SetPen( formerPen );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2)
|
void wxGraphicsContext::StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2)
|
||||||
@ -733,7 +733,7 @@ void wxGraphicsContext::StrokeLines( size_t n, const wxPoint2DDouble *beginPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a 'native' matrix corresponding to these values
|
// create a 'native' matrix corresponding to these values
|
||||||
wxGraphicsMatrix wxGraphicsContext::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d,
|
wxGraphicsMatrix wxGraphicsContext::CreateMatrix( wxDouble a, wxDouble b, wxDouble c, wxDouble d,
|
||||||
wxDouble tx, wxDouble ty) const
|
wxDouble tx, wxDouble ty) const
|
||||||
{
|
{
|
||||||
return GetRenderer()->CreateMatrix(a,b,c,d,tx,ty);
|
return GetRenderer()->CreateMatrix(a,b,c,d,tx,ty);
|
||||||
@ -755,13 +755,13 @@ wxGraphicsBrush wxGraphicsContext::CreateBrush(const wxBrush& brush ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
|
// sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
|
||||||
wxGraphicsBrush wxGraphicsContext::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
|
wxGraphicsBrush wxGraphicsContext::CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
|
||||||
const wxColour&c1, const wxColour&c2) const
|
const wxColour&c1, const wxColour&c2) const
|
||||||
{
|
{
|
||||||
return GetRenderer()->CreateLinearGradientBrush(x1,y1,x2,y2,c1,c2);
|
return GetRenderer()->CreateLinearGradientBrush(x1,y1,x2,y2,c1,c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc)
|
// sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc)
|
||||||
// with radius r and color cColor
|
// with radius r and color cColor
|
||||||
wxGraphicsBrush wxGraphicsContext::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius,
|
wxGraphicsBrush wxGraphicsContext::CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius,
|
||||||
const wxColour &oColor, const wxColour &cColor) const
|
const wxColour &oColor, const wxColour &cColor) const
|
||||||
@ -793,18 +793,18 @@ wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC& dc)
|
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC& dc)
|
||||||
{
|
{
|
||||||
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxMemoryDC& dc)
|
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxMemoryDC& dc)
|
||||||
{
|
{
|
||||||
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxPrinterDC& dc)
|
/* static */ wxGraphicsContext* wxGraphicsContext::Create( const wxPrinterDC& dc)
|
||||||
{
|
{
|
||||||
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user