1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/graphcmn.cpp
3 // Purpose: graphics context methods common to all platforms
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 #if defined(__BORLANDC__)
19 #if wxUSE_GRAPHICS_CONTEXT
21 #include "wx/graphics.h"
25 #include "wx/bitmap.h"
26 #include "wx/dcmemory.h"
27 #include "wx/region.h"
31 #if !defined(wxMAC_USE_CORE_GRAPHICS_BLEND_MODES)
32 #define wxMAC_USE_CORE_GRAPHICS_BLEND_MODES 0
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
39 static const double RAD2DEG
= 180.0 / M_PI
;
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 static inline double DegToRad(double deg
)
47 return (deg
* M_PI
) / 180.0;
50 //-----------------------------------------------------------------------------
52 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
56 IMPLEMENT_DYNAMIC_CLASS(wxGraphicsObject
, wxObject
)
58 wxGraphicsObjectRefData::wxGraphicsObjectRefData( wxGraphicsRenderer
* renderer
)
60 m_renderer
= renderer
;
62 wxGraphicsObjectRefData::wxGraphicsObjectRefData( const wxGraphicsObjectRefData
* data
)
64 m_renderer
= data
->m_renderer
;
66 wxGraphicsRenderer
* wxGraphicsObjectRefData::GetRenderer() const
71 wxGraphicsObjectRefData
* wxGraphicsObjectRefData::Clone() const
73 return new wxGraphicsObjectRefData(this);
76 wxGraphicsObject::wxGraphicsObject()
80 wxGraphicsObject::wxGraphicsObject( wxGraphicsRenderer
* renderer
)
82 SetRefData( new wxGraphicsObjectRefData(renderer
));
85 wxGraphicsObject::~wxGraphicsObject()
89 bool wxGraphicsObject::IsNull() const
91 return m_refData
== NULL
;
94 wxGraphicsRenderer
* wxGraphicsObject::GetRenderer() const
96 return ( IsNull() ? NULL
: GetGraphicsData()->GetRenderer() );
99 wxGraphicsObjectRefData
* wxGraphicsObject::GetGraphicsData() const
101 return (wxGraphicsObjectRefData
*) m_refData
;
104 wxObjectRefData
* wxGraphicsObject::CreateRefData() const
106 wxLogDebug(wxT("A Null Object cannot be changed"));
110 wxObjectRefData
* wxGraphicsObject::CloneRefData(const wxObjectRefData
* data
) const
112 const wxGraphicsObjectRefData
* ptr
= (const wxGraphicsObjectRefData
*) data
;
116 //-----------------------------------------------------------------------------
118 //-----------------------------------------------------------------------------
120 IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPen
, wxGraphicsObject
)
121 IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBrush
, wxGraphicsObject
)
122 IMPLEMENT_DYNAMIC_CLASS(wxGraphicsFont
, wxGraphicsObject
)
124 WXDLLIMPEXP_DATA_CORE(wxGraphicsPen
) wxNullGraphicsPen
;
125 WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush
) wxNullGraphicsBrush
;
126 WXDLLIMPEXP_DATA_CORE(wxGraphicsFont
) wxNullGraphicsFont
;
128 //-----------------------------------------------------------------------------
130 //-----------------------------------------------------------------------------
132 IMPLEMENT_DYNAMIC_CLASS(wxGraphicsMatrix
, wxGraphicsObject
)
133 WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix
) wxNullGraphicsMatrix
;
135 // concatenates the matrix
136 void wxGraphicsMatrix::Concat( const wxGraphicsMatrix
*t
)
139 GetMatrixData()->Concat(t
->GetMatrixData());
142 // sets the matrix to the respective values
143 void wxGraphicsMatrix::Set(wxDouble a
, wxDouble b
, wxDouble c
, wxDouble d
,
144 wxDouble tx
, wxDouble ty
)
147 GetMatrixData()->Set(a
,b
,c
,d
,tx
,ty
);
150 // gets the component valuess of the matrix
151 void wxGraphicsMatrix::Get(wxDouble
* a
, wxDouble
* b
, wxDouble
* c
,
152 wxDouble
* d
, wxDouble
* tx
, wxDouble
* ty
) const
154 GetMatrixData()->Get(a
, b
, c
, d
, tx
, ty
);
157 // makes this the inverse matrix
158 void wxGraphicsMatrix::Invert()
161 GetMatrixData()->Invert();
164 // returns true if the elements of the transformation matrix are equal ?
165 bool wxGraphicsMatrix::IsEqual( const wxGraphicsMatrix
* t
) const
167 return GetMatrixData()->IsEqual(t
->GetMatrixData());
170 // return true if this is the identity matrix
171 bool wxGraphicsMatrix::IsIdentity() const
173 return GetMatrixData()->IsIdentity();
176 // add the translation to this matrix
177 void wxGraphicsMatrix::Translate( wxDouble dx
, wxDouble dy
)
180 GetMatrixData()->Translate(dx
,dy
);
183 // add the scale to this matrix
184 void wxGraphicsMatrix::Scale( wxDouble xScale
, wxDouble yScale
)
187 GetMatrixData()->Scale(xScale
,yScale
);
190 // add the rotation to this matrix (radians)
191 void wxGraphicsMatrix::Rotate( wxDouble angle
)
194 GetMatrixData()->Rotate(angle
);
198 // apply the transforms
201 // applies that matrix to the point
202 void wxGraphicsMatrix::TransformPoint( wxDouble
*x
, wxDouble
*y
) const
204 GetMatrixData()->TransformPoint(x
,y
);
207 // applies the matrix except for translations
208 void wxGraphicsMatrix::TransformDistance( wxDouble
*dx
, wxDouble
*dy
) const
210 GetMatrixData()->TransformDistance(dx
,dy
);
213 // returns the native representation
214 void * wxGraphicsMatrix::GetNativeMatrix() const
216 return GetMatrixData()->GetNativeMatrix();
219 //-----------------------------------------------------------------------------
221 //-----------------------------------------------------------------------------
223 IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPath
, wxGraphicsObject
)
224 WXDLLIMPEXP_DATA_CORE(wxGraphicsPath
) wxNullGraphicsPath
;
226 // convenience functions, for using wxPoint2DDouble etc
228 wxPoint2DDouble
wxGraphicsPath::GetCurrentPoint() const
231 GetCurrentPoint(&x
,&y
);
232 return wxPoint2DDouble(x
,y
);
235 void wxGraphicsPath::MoveToPoint( const wxPoint2DDouble
& p
)
237 MoveToPoint( p
.m_x
, p
.m_y
);
240 void wxGraphicsPath::AddLineToPoint( const wxPoint2DDouble
& p
)
242 AddLineToPoint( p
.m_x
, p
.m_y
);
245 void wxGraphicsPath::AddCurveToPoint( const wxPoint2DDouble
& c1
, const wxPoint2DDouble
& c2
, const wxPoint2DDouble
& e
)
247 AddCurveToPoint(c1
.m_x
, c1
.m_y
, c2
.m_x
, c2
.m_y
, e
.m_x
, e
.m_y
);
250 void wxGraphicsPath::AddArc( const wxPoint2DDouble
& c
, wxDouble r
, wxDouble startAngle
, wxDouble endAngle
, bool clockwise
)
252 AddArc(c
.m_x
, c
.m_y
, r
, startAngle
, endAngle
, clockwise
);
255 wxRect2DDouble
wxGraphicsPath::GetBox() const
259 return wxRect2DDouble( x
,y
,w
,h
);
262 bool wxGraphicsPath::Contains( const wxPoint2DDouble
& c
, int fillStyle
) const
264 return Contains( c
.m_x
, c
.m_y
, fillStyle
);
269 // begins a new subpath at (x,y)
270 void wxGraphicsPath::MoveToPoint( wxDouble x
, wxDouble y
)
273 GetPathData()->MoveToPoint(x
,y
);
276 // adds a straight line from the current point to (x,y)
277 void wxGraphicsPath::AddLineToPoint( wxDouble x
, wxDouble y
)
280 GetPathData()->AddLineToPoint(x
,y
);
283 // adds a cubic Bezier curve from the current point, using two control points and an end point
284 void wxGraphicsPath::AddCurveToPoint( wxDouble cx1
, wxDouble cy1
, wxDouble cx2
, wxDouble cy2
, wxDouble x
, wxDouble y
)
287 GetPathData()->AddCurveToPoint(cx1
,cy1
,cx2
,cy2
,x
,y
);
291 void wxGraphicsPath::AddPath( const wxGraphicsPath
& path
)
294 GetPathData()->AddPath(path
.GetPathData());
297 // closes the current sub-path
298 void wxGraphicsPath::CloseSubpath()
301 GetPathData()->CloseSubpath();
304 // gets the last point of the current path, (0,0) if not yet set
305 void wxGraphicsPath::GetCurrentPoint( wxDouble
* x
, wxDouble
* y
) const
307 GetPathData()->GetCurrentPoint(x
,y
);
310 // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle
311 void wxGraphicsPath::AddArc( wxDouble x
, wxDouble y
, wxDouble r
, wxDouble startAngle
, wxDouble endAngle
, bool clockwise
)
314 GetPathData()->AddArc(x
,y
,r
,startAngle
,endAngle
,clockwise
);
318 // These are convenience functions which - if not available natively will be assembled
319 // using the primitives from above
322 // adds a quadratic Bezier curve from the current point, using a control point and an end point
323 void wxGraphicsPath::AddQuadCurveToPoint( wxDouble cx
, wxDouble cy
, wxDouble x
, wxDouble y
)
326 GetPathData()->AddQuadCurveToPoint(cx
,cy
,x
,y
);
329 // appends a rectangle as a new closed subpath
330 void wxGraphicsPath::AddRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
)
333 GetPathData()->AddRectangle(x
,y
,w
,h
);
336 // appends an ellipsis as a new closed subpath fitting the passed rectangle
337 void wxGraphicsPath::AddCircle( wxDouble x
, wxDouble y
, wxDouble r
)
340 GetPathData()->AddCircle(x
,y
,r
);
343 // 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)
344 void wxGraphicsPath::AddArcToPoint( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
, wxDouble r
)
346 GetPathData()->AddArcToPoint(x1
,y1
,x2
,y2
,r
);
349 // appends an ellipse
350 void wxGraphicsPath::AddEllipse( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
)
353 GetPathData()->AddEllipse(x
,y
,w
,h
);
356 // appends a rounded rectangle
357 void wxGraphicsPath::AddRoundedRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
, wxDouble radius
)
360 GetPathData()->AddRoundedRectangle(x
,y
,w
,h
,radius
);
363 // returns the native path
364 void * wxGraphicsPath::GetNativePath() const
366 return GetPathData()->GetNativePath();
369 // give the native path returned by GetNativePath() back (there might be some deallocations necessary)
370 void wxGraphicsPath::UnGetNativePath(void *p
)const
372 GetPathData()->UnGetNativePath(p
);
375 // transforms each point of this path by the matrix
376 void wxGraphicsPath::Transform( const wxGraphicsMatrix
& matrix
)
379 GetPathData()->Transform(matrix
.GetMatrixData());
382 // gets the bounding box enclosing all points (possibly including control points)
383 void wxGraphicsPath::GetBox(wxDouble
*x
, wxDouble
*y
, wxDouble
*w
, wxDouble
*h
) const
385 GetPathData()->GetBox(x
,y
,w
,h
);
388 bool wxGraphicsPath::Contains( wxDouble x
, wxDouble y
, int fillStyle
) const
390 return GetPathData()->Contains(x
,y
,fillStyle
);
394 // Emulations, these mus be implemented in the ...Data classes in order to allow for proper overrides
397 void wxGraphicsPathData::AddQuadCurveToPoint( wxDouble cx
, wxDouble cy
, wxDouble x
, wxDouble y
)
399 // calculate using degree elevation to a cubic bezier
403 wxPoint2DDouble start
;
404 GetCurrentPoint(&start
.m_x
,&start
.m_y
);
405 wxPoint2DDouble
end(x
,y
);
406 wxPoint2DDouble
c(cx
,cy
);
407 c1
= wxDouble(1/3.0) * start
+ wxDouble(2/3.0) * c
;
408 c2
= wxDouble(2/3.0) * c
+ wxDouble(1/3.0) * end
;
409 AddCurveToPoint(c1
.m_x
,c1
.m_y
,c2
.m_x
,c2
.m_y
,x
,y
);
412 void wxGraphicsPathData::AddRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
)
415 AddLineToPoint(x
,y
+h
);
416 AddLineToPoint(x
+w
,y
+h
);
417 AddLineToPoint(x
+w
,y
);
421 void wxGraphicsPathData::AddCircle( wxDouble x
, wxDouble y
, wxDouble r
)
424 AddArc( x
,y
,r
,0,2*M_PI
,false);
428 void wxGraphicsPathData::AddEllipse( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
)
432 wxDouble xc
= x
+ rw
;
433 wxDouble yc
= y
+ rh
;
434 wxGraphicsMatrix m
= GetRenderer()->CreateMatrix();
437 wxGraphicsPath p
= GetRenderer()->CreatePath();
440 AddPath(p
.GetPathData());
443 void wxGraphicsPathData::AddRoundedRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
, wxDouble radius
)
446 AddRectangle(x
,y
,w
,h
);
449 MoveToPoint( x
+ w
, y
+ h
/ 2);
450 AddArcToPoint(x
+ w
, y
+ h
, x
+ w
/ 2, y
+ h
, radius
);
451 AddArcToPoint(x
, y
+ h
, x
, y
+ h
/ 2, radius
);
452 AddArcToPoint(x
, y
, x
+ w
/ 2, y
, radius
);
453 AddArcToPoint(x
+ w
, y
, x
+ w
, y
+ h
/ 2, radius
);
458 // 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)
459 void wxGraphicsPathData::AddArcToPoint( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
, wxDouble r
)
461 wxPoint2DDouble current
;
462 GetCurrentPoint(¤t
.m_x
,¤t
.m_y
);
463 wxPoint2DDouble
p1(x1
,y1
);
464 wxPoint2DDouble
p2(x2
,y2
);
466 wxPoint2DDouble v1
= current
- p1
;
468 wxPoint2DDouble v2
= p2
- p1
;
471 wxDouble alpha
= v1
.GetVectorAngle() - v2
.GetVectorAngle();
475 // TODO obtuse angles
477 alpha
= DegToRad(alpha
);
479 wxDouble dist
= r
/ sin(alpha
/2) * cos(alpha
/2);
480 // calculate tangential points
481 wxPoint2DDouble t1
= dist
*v1
+ p1
;
482 wxPoint2DDouble t2
= dist
*v2
+ p1
;
484 wxPoint2DDouble nv1
= v1
;
485 nv1
.SetVectorAngle(v1
.GetVectorAngle()-90);
486 wxPoint2DDouble c
= t1
+ r
*nv1
;
488 wxDouble a1
= v1
.GetVectorAngle()+90;
489 wxDouble a2
= v2
.GetVectorAngle()-90;
491 AddLineToPoint(t1
.m_x
,t1
.m_y
);
492 AddArc(c
.m_x
,c
.m_y
,r
,DegToRad(a1
),DegToRad(a2
),true);
493 AddLineToPoint(p2
.m_x
,p2
.m_y
);
496 //-----------------------------------------------------------------------------
497 // wxGraphicsContext Convenience Methods
498 //-----------------------------------------------------------------------------
500 IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext
, wxObject
)
503 wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer
* renderer
) : wxGraphicsObject(renderer
)
505 m_logicalFunction
= wxCOPY
;
508 wxGraphicsContext::~wxGraphicsContext()
513 void wxGraphicsContext::SetPen( const wxGraphicsPen
& pen
)
518 void wxGraphicsContext::SetPen( const wxPen
& pen
)
520 if ( !pen
.Ok() || pen
.GetStyle() == wxTRANSPARENT
)
521 SetPen( wxNullGraphicsPen
);
523 SetPen( CreatePen( pen
) );
526 // sets the brush for filling
527 void wxGraphicsContext::SetBrush( const wxGraphicsBrush
& brush
)
532 void wxGraphicsContext::SetBrush( const wxBrush
& brush
)
534 if ( !brush
.Ok() || brush
.GetStyle() == wxTRANSPARENT
)
535 SetBrush( wxNullGraphicsBrush
);
537 SetBrush( CreateBrush( brush
) );
540 // sets the brush for filling
541 void wxGraphicsContext::SetFont( const wxGraphicsFont
& font
)
546 bool wxGraphicsContext::SetLogicalFunction( int function
)
548 if ( function
== wxCOPY
)
550 m_logicalFunction
= function
;
556 void wxGraphicsContext::SetFont( const wxFont
& font
, const wxColour
& colour
)
559 SetFont( CreateFont( font
, colour
) );
561 SetFont( wxNullGraphicsFont
);
564 void wxGraphicsContext::DrawPath( const wxGraphicsPath
& path
, int fillStyle
)
566 FillPath( path
, fillStyle
);
570 void wxGraphicsContext::DrawText( const wxString
&str
, wxDouble x
, wxDouble y
, wxDouble angle
)
574 DrawText( str
, 0, 0 );
579 void wxGraphicsContext::DrawText( const wxString
&str
, wxDouble x
, wxDouble y
, const wxGraphicsBrush
& backgroundBrush
)
581 wxGraphicsBrush formerBrush
= m_brush
;
585 wxDouble externalLeading
;
586 GetTextExtent( str
, &width
, &height
, &descent
, &externalLeading
);
587 SetBrush( backgroundBrush
);
589 wxGraphicsPath path
= CreatePath();
590 path
.AddRectangle( x
, y
, width
, height
);
593 DrawText( str
, x
,y
);
594 SetBrush( formerBrush
);
597 void wxGraphicsContext::DrawText( const wxString
&str
, wxDouble x
, wxDouble y
, wxDouble angle
, const wxGraphicsBrush
& backgroundBrush
)
599 wxGraphicsBrush formerBrush
= m_brush
;
604 wxDouble externalLeading
;
605 GetTextExtent( str
, &width
, &height
, &descent
, &externalLeading
);
606 SetBrush( backgroundBrush
);
608 wxGraphicsPath path
= CreatePath();
609 path
.MoveToPoint( x
, y
);
610 path
.AddLineToPoint( (int) (x
+ sin(angle
) * height
) , (int) (y
+ cos(angle
) * height
) );
612 (int) (x
+ sin(angle
) * height
+ cos(angle
) * width
) ,
613 (int) (y
+ cos(angle
) * height
- sin(angle
) * width
));
614 path
.AddLineToPoint((int) (x
+ cos(angle
) * width
) , (int) (y
- sin(angle
) * width
) );
616 DrawText( str
, x
,y
, angle
);
617 SetBrush( formerBrush
);
620 void wxGraphicsContext::StrokeLine( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
)
622 wxGraphicsPath path
= CreatePath();
623 path
.MoveToPoint(x1
, y1
);
624 path
.AddLineToPoint( x2
, y2
);
628 void wxGraphicsContext::DrawRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
)
630 wxGraphicsPath path
= CreatePath();
631 path
.AddRectangle( x
, y
, w
, h
);
635 void wxGraphicsContext::DrawEllipse( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
)
637 wxGraphicsPath path
= CreatePath();
638 path
.AddEllipse(x
,y
,w
,h
);
642 void wxGraphicsContext::DrawRoundedRectangle( wxDouble x
, wxDouble y
, wxDouble w
, wxDouble h
, wxDouble radius
)
644 wxGraphicsPath path
= CreatePath();
645 path
.AddRoundedRectangle(x
,y
,w
,h
,radius
);
649 void wxGraphicsContext::StrokeLines( size_t n
, const wxPoint2DDouble
*points
)
652 wxGraphicsPath path
= CreatePath();
653 path
.MoveToPoint(points
[0].m_x
, points
[0].m_y
);
654 for ( size_t i
= 1; i
< n
; ++i
)
655 path
.AddLineToPoint( points
[i
].m_x
, points
[i
].m_y
);
659 void wxGraphicsContext::DrawLines( size_t n
, const wxPoint2DDouble
*points
, int fillStyle
)
662 wxGraphicsPath path
= CreatePath();
663 path
.MoveToPoint(points
[0].m_x
, points
[0].m_y
);
664 for ( size_t i
= 1; i
< n
; ++i
)
665 path
.AddLineToPoint( points
[i
].m_x
, points
[i
].m_y
);
666 DrawPath( path
, fillStyle
);
669 void wxGraphicsContext::StrokeLines( size_t n
, const wxPoint2DDouble
*beginPoints
, const wxPoint2DDouble
*endPoints
)
672 wxGraphicsPath path
= CreatePath();
673 for ( size_t i
= 0; i
< n
; ++i
)
675 path
.MoveToPoint(beginPoints
[i
].m_x
, beginPoints
[i
].m_y
);
676 path
.AddLineToPoint( endPoints
[i
].m_x
, endPoints
[i
].m_y
);
681 // create a 'native' matrix corresponding to these values
682 wxGraphicsMatrix
wxGraphicsContext::CreateMatrix( wxDouble a
, wxDouble b
, wxDouble c
, wxDouble d
,
683 wxDouble tx
, wxDouble ty
) const
685 return GetRenderer()->CreateMatrix(a
,b
,c
,d
,tx
,ty
);
688 wxGraphicsPath
wxGraphicsContext::CreatePath() const
690 return GetRenderer()->CreatePath();
693 wxGraphicsPen
wxGraphicsContext::CreatePen(const wxPen
& pen
) const
695 return GetRenderer()->CreatePen(pen
);
698 wxGraphicsBrush
wxGraphicsContext::CreateBrush(const wxBrush
& brush
) const
700 return GetRenderer()->CreateBrush(brush
);
703 // sets the brush to a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
704 wxGraphicsBrush
wxGraphicsContext::CreateLinearGradientBrush( wxDouble x1
, wxDouble y1
, wxDouble x2
, wxDouble y2
,
705 const wxColour
&c1
, const wxColour
&c2
) const
707 return GetRenderer()->CreateLinearGradientBrush(x1
,y1
,x2
,y2
,c1
,c2
);
710 // sets the brush to a radial gradient originating at (xo,yc) with color oColor and ends on a circle around (xc,yc)
711 // with radius r and color cColor
712 wxGraphicsBrush
wxGraphicsContext::CreateRadialGradientBrush( wxDouble xo
, wxDouble yo
, wxDouble xc
, wxDouble yc
, wxDouble radius
,
713 const wxColour
&oColor
, const wxColour
&cColor
) const
715 return GetRenderer()->CreateRadialGradientBrush(xo
,yo
,xc
,yc
,radius
,oColor
,cColor
);
719 wxGraphicsFont
wxGraphicsContext::CreateFont( const wxFont
&font
, const wxColour
&col
) const
721 return GetRenderer()->CreateFont(font
,col
);
724 wxGraphicsContext
* wxGraphicsContext::Create( const wxWindowDC
& dc
)
726 return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc
);
729 wxGraphicsContext
* wxGraphicsContext::Create( const wxMemoryDC
& dc
)
731 return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc
);
735 wxGraphicsContext
* wxGraphicsContext::CreateFromNative( void * context
)
737 return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeContext(context
);
740 wxGraphicsContext
* wxGraphicsContext::CreateFromNativeWindow( void * window
)
742 return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromNativeWindow(window
);
745 wxGraphicsContext
* wxGraphicsContext::Create( wxWindow
* window
)
747 return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(window
);
750 wxGraphicsContext
* wxGraphicsContext::Create()
752 return wxGraphicsRenderer::GetDefaultRenderer()->CreateMeasuringContext();
755 //-----------------------------------------------------------------------------
756 // wxGraphicsRenderer
757 //-----------------------------------------------------------------------------
759 IMPLEMENT_ABSTRACT_CLASS(wxGraphicsRenderer
, wxObject
)
761 #endif // wxUSE_GRAPHICS_CONTEXT