52 #ifndef __PCL_Graphics_h
53 #define __PCL_Graphics_h
57 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
69 #ifndef __PCL_GRAPHICS_DONT_REMOVE_PREVIOUS_DECLARATIONS
77 #endif // !__PCL_GRAPHICS_DONT_REMOVE_PREVIOUS_DECLARATIONS
79 #endif // !__PCL_BUILDING_PIXINSIGHT_APPLICATION
134 namespace CompositionOp
163 NumberOfCompositionOps
191 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
214 using composition_op = CompositionOp::value_type;
219 using fill_rule = FillRule::value_type;
293 bool BeginPaint(
Control& control );
298 bool BeginPaint(
Bitmap& bitmap );
303 bool BeginPaint(
SVG& svg );
308 bool IsPainting()
const;
317 bool IsTransformationEnabled()
const;
321 void EnableTransformation(
bool =
true );
327 EnableTransformation( !disable );
332 Matrix TransformationMatrix()
const;
336 void SetTransformationMatrix(
const Matrix& M );
341 double m21,
double m22,
double m23,
342 double m31,
double m32,
double m33 )
344 SetTransformationMatrix(
Matrix( m11, m12, m13, m21, m22, m23, m31, m32, m33 ) );
349 void MultiplyTransformationMatrix(
const Matrix& M );
354 double m21,
double m22,
double m23,
355 double m31,
double m32,
double m33 )
357 MultiplyTransformationMatrix(
Matrix( m11, m12, m13, m21, m22, m23, m31, m32, m33 ) );
362 void RotateTransformation(
double angleRadians );
366 void ScaleTransformation(
double xScale,
double yScale );
372 ScaleTransformation( scale, scale );
377 void TranslateTransformation(
double dx,
double dy );
383 TranslateTransformation( d, d );
388 void ShearTransformation(
double sx,
double sy );
394 ShearTransformation( s, s );
399 void ResetTransformation();
403 void Transform(
double& x,
double& y )
const;
413 Transform( a.Begin(), a.Length() );
421 Transform( p1.
x, p1.
y );
430 Transform( r1.
x0, r1.
y0 );
431 Transform( r1.
x1, r1.
y1 );
446 bool IsClippingEnabled()
const;
450 void EnableClipping(
bool =
true );
456 EnableClipping( !disable );
461 bool IsAntialiasingEnabled()
const;
465 void EnableAntialiasing(
bool =
true );
471 EnableAntialiasing( !disable );
476 bool IsTextAntialiasingEnabled()
const;
480 void EnableTextAntialiasing(
bool =
true );
486 EnableTextAntialiasing( !disable );
491 bool IsSmoothInterpolationEnabled()
const;
495 void EnableSmoothInterpolation(
bool =
true );
501 EnableSmoothInterpolation( !disable );
506 composition_op CompositionOperator()
const;
510 void SetCompositionOperator( composition_op );
516 SetCompositionOperator( CompositionOp::SourceOver );
521 double Opacity()
const;
525 void SetOpacity(
double op );
537 bool IsTransparentBackground()
const;
543 return !IsTransparentBackground();
548 void SetTransparentBackground(
bool =
true );
554 SetTransparentBackground( !opaque );
589 return this->
Brush();
631 void* CloneHandle()
const override;
735 SetClipRect( r.
x0, r.
y0, r.
x1, r.
y1 );
740 void SetClipRect(
int x0,
int y0,
int x1,
int y1 );
746 SetClipRect( ClipRect().Intersection( r ) );
753 IntersectClipRect(
pcl::Rect( x0, y0, x1, y1 ) );
760 SetClipRect( ClipRect().Union( r ) );
767 UniteClipRect(
pcl::Rect( x0, y0, x1, y1 ) );
778 SetBrushOrigin( p.
x, p.
y );
783 void SetBrushOrigin(
int x,
int y );
789 DrawPoint( p.
x, p.
y );
794 void DrawPoint(
int x,
int y );
800 DrawLine( p0.
x, p0.
y, p1.
x, p1.
y );
805 void DrawLine(
int x0,
int y0,
int x1,
int y1 );
809 void DrawRect(
int x0,
int y0,
int x1,
int y1 );
826 StrokeRect( r.
x0, r.
y0, r.
x1, r.
y1, pen );
837 FillRect( r.
x0, r.
y0, r.
x1, r.
y1, brush );
844 FillRect( x0, y0, x1, y1, BackgroundBrush() );
851 EraseRect( r.
x0, r.
y0, r.
x1, r.
y1 );
856 void DrawRoundedRect(
int x0,
int y0,
int x1,
int y1,
double rx,
double ry );
862 DrawRoundedRect( x0, y0, x1, y1, rxy, rxy );
869 DrawRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rx, ry );
876 DrawRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rxy, rxy );
881 void StrokeRoundedRect(
int x0,
int y0,
int x1,
int y1,
double rx,
double ry,
const pcl::Pen& pen =
pcl::Pen::Null() );
887 StrokeRoundedRect( x0, y0, x1, y1, rxy, rxy, pen );
894 StrokeRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rx, ry, pen );
901 StrokeRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rxy, rxy, pen );
912 FillRoundedRect( x0, y0, x1, y1, rxy, rxy, brush );
919 FillRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rx, ry, brush );
926 FillRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rxy, rxy, brush );
933 FillRoundedRect( x0, y0, x1, y1, rx, ry, BackgroundBrush() );
940 EraseRoundedRect( x0, y0, x1, y1, rxy, rxy );
947 EraseRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rx, ry );
954 EraseRoundedRect( r.
x0, r.
y0, r.
x1, r.
y1, rxy, rxy );
959 void DrawEllipse(
int x0,
int y0,
int x1,
int y1 );
965 DrawEllipse( r.
x0, r.
y0, r.
x1, r.
y1 );
976 StrokeEllipse( r.
x0, r.
y0, r.
x1, r.
y1, pen );
987 FillEllipse( r.
x0, r.
y0, r.
x1, r.
y1, brush );
994 FillEllipse( x0, y0, x1, y1, BackgroundBrush() );
1001 EraseEllipse( r.
x0, r.
y0, r.
x1, r.
y1 );
1008 DrawEllipse( xc-r, yc-r, xc+r+1, yc+r+1 );
1015 DrawCircle( c.
x, c.
y, r );
1022 StrokeEllipse( xc-r, yc-r, xc+r+1, yc+r+1, pen );
1029 StrokeCircle( c.
x, c.
y, r, pen );
1036 FillEllipse( xc-r, yc-r, xc+r+1, yc+r+1, brush );
1043 FillCircle( c.
x, c.
y, r, brush );
1050 FillCircle( xc, yc, r, BackgroundBrush() );
1057 EraseCircle( c.
x, c.
y, r );
1069 DrawPolygon( c.Begin(), c.Length(), rule );
1081 StrokePolygon( c.Begin(), c.Length(), pen, rule );
1093 FillPolygon( c.Begin(), c.Length(), brush, rule );
1100 FillPolygon( p, n, BackgroundBrush(), rule );
1108 ErasePolygon( c.Begin(), c.Length(), rule );
1120 DrawPolyline( c.Begin(), c.Length() );
1125 void DrawEllipticArc(
int x0,
int y0,
int x1,
int y1,
double start,
double span );
1131 DrawEllipticArc( r.
x0, r.
y0, r.
x1, r.
y1, start, span );
1136 void DrawArc(
int xc,
int yc,
int r,
double start,
double span )
1138 DrawEllipticArc( xc-r, yc-r, xc+r+1, yc+r+1, start, span );
1145 DrawArc( c.
x, c.
y, r, start, span );
1150 void DrawEllipticChord(
int x0,
int y0,
int x1,
int y1,
double start,
double span );
1156 DrawEllipticChord( r.
x0, r.
y0, r.
x1, r.
y1, start, span );
1161 void StrokeEllipticChord(
int x0,
int y0,
int x1,
int y1,
double start,
double span,
const pcl::Pen& pen =
pcl::Pen::Null() );
1167 StrokeEllipticChord( r.
x0, r.
y0, r.
x1, r.
y1, start, span, pen );
1172 void FillEllipticChord(
int x0,
int y0,
int x1,
int y1,
double start,
double span,
const pcl::Brush& brush =
pcl::Brush::Null() );
1178 FillEllipticChord( r.
x0, r.
y0, r.
x1, r.
y1, start, span, brush );
1185 FillEllipticChord( x0, y0, x1, y1, start, span, BackgroundBrush() );
1192 EraseEllipticChord( r.
x0, r.
y0, r.
x1, r.
y1, start, span );
1197 void DrawChord(
int xc,
int yc,
int r,
double start,
double span )
1199 DrawEllipticChord( xc-r, yc-r, xc+r+1, yc+r+1, start, span );
1206 DrawChord( c.
x, c.
y, r, start, span );
1213 StrokeEllipticChord( xc-r, yc-r, xc+r+1, yc+r+1, start, span, pen );
1220 StrokeChord( c.
x, c.
y, r, start, span, pen );
1227 FillEllipticChord( xc-r, yc-r, xc+r+1, yc+r+1, start, span, brush );
1234 FillChord( c.
x, c.
y, r, start, span, brush );
1239 void EraseChord(
int xc,
int yc,
int r,
double start,
double span )
1241 FillChord( xc, yc, r, start, span, BackgroundBrush() );
1248 EraseChord( c.
x, c.
y, r, start, span );
1253 void DrawEllipticPie(
int x0,
int y0,
int x1,
int y1,
double start,
double span );
1259 DrawEllipticPie( r.
x0, r.
y0, r.
x1, r.
y1, start, span );
1264 void StrokeEllipticPie(
int x0,
int y0,
int x1,
int y1,
double start,
double span,
const pcl::Pen& pen =
pcl::Pen::Null() );
1270 StrokeEllipticPie( r.
x0, r.
y0, r.
x1, r.
y1, start, span, pen );
1275 void FillEllipticPie(
int x0,
int y0,
int x1,
int y1,
double start,
double span,
const pcl::Brush& brush =
pcl::Brush::Null() );
1281 FillEllipticPie( r.
x0, r.
y0, r.
x1, r.
y1, start, span, brush );
1288 FillEllipticPie( x0, y0, x1, y1, start, span, BackgroundBrush() );
1295 EraseEllipticPie( r.
x0, r.
y0, r.
x1, r.
y1, start, span );
1300 void DrawPie(
int xc,
int yc,
int r,
double start,
double span )
1302 DrawEllipticPie( xc-r, yc-r, xc+r+1, yc+r+1, start, span );
1309 DrawPie( c.
x, c.
y, r, start, span );
1316 StrokeEllipticPie( xc-r, yc-r, xc+r+1, yc+r+1, start, span, pen );
1323 StrokePie( c.
x, c.
y, r, start, span, pen );
1330 FillEllipticPie( xc-r, yc-r, xc+r+1, yc+r+1, start, span, brush );
1337 FillPie( c.
x, c.
y, r, start, span, brush );
1342 void ErasePie(
int xc,
int yc,
int r,
double start,
double span )
1344 FillPie( xc, yc, r, start, span, BackgroundBrush() );
1351 ErasePie( c.
x, c.
y, r, start, span );
1356 void DrawBitmap(
int x,
int y,
const Bitmap& );
1362 DrawBitmap( p.
x, p.
y, bm );
1367 void DrawBitmapRect(
int x,
int y,
const Bitmap&,
int x0,
int y0,
int x1,
int y1 );
1373 DrawBitmapRect( p.
x, p.
y, bm, r.
x0, r.
y0, r.
x1, r.
y1 );
1378 void DrawScaledBitmap(
int x0,
int y0,
int x1,
int y1,
const Bitmap& );
1384 DrawScaledBitmap( r.
x0, r.
y0, r.
x1, r.
y1, bm );
1389 void DrawScaledBitmapRect(
int dx0,
int dy0,
int dx1,
int dy1,
const Bitmap&,
int sx0,
int sy0,
int sx1,
int sy1 );
1395 DrawScaledBitmapRect( dst.
x0, dst.
y0, dst.
x1, dst.
y1, bm, src.
x0, src.
y0, src.
x1, src.
y1 );
1400 void DrawTiledBitmap(
int x0,
int y0,
int x1,
int y1,
const Bitmap&,
int xOffset = 0,
int yOffset = 0 );
1406 DrawTiledBitmap( r.
x0, r.
y0, r.
x1, r.
y1, bm, offset.x, offset.y );
1411 void DrawText(
int x,
int y,
const String& );
1417 DrawText( p.
x, p.
y, s );
1428 DrawTextRect( r.
x0, r.
y0, r.
x1, r.
y1, s, a );
1439 return TextRect( r.
x0, r.
y0, r.
x1, r.
y1, s, a );
1448 friend class InterfaceDispatcher;
1553 SetClipRect( r.x0, r.y0, r.x1, r.y1 );
1558 void SetClipRect(
double x0,
double y0,
double x1,
double y1 );
1565 SetClipRect( ClipRect().Intersection( r ) );
1572 IntersectClipRect(
pcl::DRect( x0, y0, x1, y1 ) );
1580 SetClipRect( ClipRect().Union( r ) );
1587 UniteClipRect(
pcl::DRect( x0, y0, x1, y1 ) );
1599 SetBrushOrigin( p.x, p.y );
1604 void SetBrushOrigin(
double x,
double y );
1611 DrawPoint( p.x, p.y );
1616 void DrawPoint(
double x,
double y );
1620 template <
class P0,
class P1>
1623 DrawLine( p0.x, p0.y, p1.x, p1.y );
1628 void DrawLine(
double x0,
double y0,
double x1,
double y1 );
1632 void DrawRect(
double x0,
double y0,
double x1,
double y1 );
1639 DrawRect( r.x0, r.y0, r.x1, r.y1 );
1651 StrokeRect( r.x0, r.y0, r.x1, r.y1, pen );
1663 FillRect( r.x0, r.y0, r.x1, r.y1, brush );
1668 void EraseRect(
double x0,
double y0,
double x1,
double y1 )
1670 FillRect( x0, y0, x1, y1, BackgroundBrush() );
1678 EraseRect( r.x0, r.y0, r.x1, r.y1 );
1683 void DrawRoundedRect(
double x0,
double y0,
double x1,
double y1,
double rx,
double ry );
1689 DrawRoundedRect( x0, y0, x1, y1, rxy, rxy );
1697 DrawRoundedRect( r.x0, r.y0, r.x1, r.y1, rx, ry );
1705 DrawRoundedRect( r.x0, r.y0, r.x1, r.y1, rxy, rxy );
1710 void StrokeRoundedRect(
double x0,
double y0,
double x1,
double y1,
double rx,
double ry,
const pcl::Pen& pen =
pcl::Pen::Null() );
1716 StrokeRoundedRect( x0, y0, x1, y1, rxy, rxy, pen );
1724 StrokeRoundedRect( r.x0, r.y0, r.x1, r.y1, rx, ry, pen );
1732 StrokeRoundedRect( r.x0, r.y0, r.x1, r.y1, rxy, rxy, pen );
1737 void FillRoundedRect(
double x0,
double y0,
double x1,
double y1,
double rx,
double ry,
const pcl::Brush& brush =
pcl::Brush::Null() );
1743 FillRoundedRect( x0, y0, x1, y1, rxy, rxy, brush );
1751 FillRoundedRect( r.x0, r.y0, r.x1, r.y1, rx, ry, brush );
1759 FillRoundedRect( r.x0, r.y0, r.x1, r.y1, rxy, rxy, brush );
1766 FillRoundedRect( x0, y0, x1, y1, rx, ry, BackgroundBrush() );
1773 EraseRoundedRect( x0, y0, x1, y1, rxy, rxy );
1781 EraseRoundedRect( r.x0, r.y0, r.x1, r.y1, rx, ry );
1789 EraseRoundedRect( r.x0, r.y0, r.x1, r.y1, rxy, rxy );
1794 void DrawEllipse(
double x0,
double y0,
double x1,
double y1 );
1801 DrawEllipse( r.x0, r.y0, r.x1, r.y1 );
1806 void StrokeEllipse(
double x0,
double y0,
double x1,
double y1,
const pcl::Pen& pen =
pcl::Pen::Null() );
1813 StrokeEllipse( r.x0, r.y0, r.x1, r.y1, pen );
1825 FillEllipse( r.x0, r.y0, r.x1, r.y1, brush );
1832 FillEllipse( x0, y0, x1, y1, BackgroundBrush() );
1840 EraseEllipse( r.x0, r.y0, r.x1, r.y1 );
1847 DrawEllipse( xc-r, yc-r, xc+r, yc+r );
1855 DrawCircle( c.x, c.y, r );
1862 StrokeEllipse( xc-r, yc-r, xc+r, yc+r, pen );
1870 StrokeCircle( c.x, c.y, r, pen );
1877 FillEllipse( xc-r, yc-r, xc+r, yc+r, brush );
1885 FillCircle( c.x, c.y, r, brush );
1892 FillCircle( xc, yc, r, BackgroundBrush() );
1900 EraseCircle( c.x, c.y, r );
1912 DrawPolygon( c.Begin(), c.Length(), rule );
1924 StrokePolygon( c.Begin(), c.Length(), pen, rule );
1936 FillPolygon( c.Begin(), c.Length(), brush, rule );
1943 FillPolygon( p, n, BackgroundBrush(), rule );
1951 ErasePolygon( c.Begin(), c.Length(), rule );
1963 DrawPolyline( c.Begin(), c.Length() );
1968 void DrawEllipticArc(
double x0,
double y0,
double x1,
double y1,
double start,
double span );
1975 DrawEllipticArc( r.x0, r.y0, r.x1, r.y1, start, span );
1980 void DrawArc(
double xc,
double yc,
double r,
double start,
double span )
1982 DrawEllipticArc( xc-r, yc-r, xc+r, yc+r, start, span );
1988 void DrawArc(
const P& c,
double r,
double start,
double span )
1990 DrawArc( c.x, c.y, r, start, span );
1995 void DrawEllipticChord(
double x0,
double y0,
double x1,
double y1,
double start,
double span );
2002 DrawEllipticChord( r.x0, r.y0, r.x1, r.y1, start, span );
2007 void StrokeEllipticChord(
double x0,
double y0,
double x1,
double y1,
double start,
double span,
const pcl::Pen& pen =
pcl::Pen::Null() );
2014 StrokeEllipticChord( r.x0, r.y0, r.x1, r.y1, start, span, pen );
2019 void FillEllipticChord(
double x0,
double y0,
double x1,
double y1,
double start,
double span,
const pcl::Brush& brush =
pcl::Brush::Null() );
2026 FillEllipticChord( r.x0, r.y0, r.x1, r.y1, start, span, brush );
2033 FillEllipticChord( x0, y0, x1, y1, start, span, BackgroundBrush() );
2041 EraseEllipticChord( r.x0, r.y0, r.x1, r.y1, start, span );
2046 void DrawChord(
double xc,
double yc,
double r,
double start,
double span )
2048 DrawEllipticChord( xc-r, yc-r, xc+r, yc+r, start, span );
2054 void DrawChord(
const P& c,
double r,
double start,
double span )
2056 DrawChord( c.x, c.y, r, start, span );
2063 StrokeEllipticChord( xc-r, yc-r, xc+r, yc+r, start, span, pen );
2071 StrokeChord( c.x, c.y, r, start, span, pen );
2078 FillEllipticChord( xc-r, yc-r, xc+r, yc+r, start, span, brush );
2086 FillChord( c.x, c.y, r, start, span, brush );
2091 void EraseChord(
double xc,
double yc,
double r,
double start,
double span )
2093 FillChord( xc, yc, r, start, span, BackgroundBrush() );
2099 void EraseChord(
const P& c,
double r,
double start,
double span )
2101 EraseChord( c.x, c.y, r, start, span );
2106 void DrawEllipticPie(
double x0,
double y0,
double x1,
double y1,
double start,
double span );
2113 DrawEllipticPie( r.x0, r.y0, r.x1, r.y1, start, span );
2118 void StrokeEllipticPie(
double x0,
double y0,
double x1,
double y1,
double start,
double span,
const pcl::Pen& pen =
pcl::Pen::Null() );
2125 StrokeEllipticPie( r.x0, r.y0, r.x1, r.y1, start, span, pen );
2130 void FillEllipticPie(
double x0,
double y0,
double x1,
double y1,
double start,
double span,
const pcl::Brush& brush =
pcl::Brush::Null() );
2137 FillEllipticPie( r.x0, r.y0, r.x1, r.y1, start, span, brush );
2144 FillEllipticPie( x0, y0, x1, y1, start, span, BackgroundBrush() );
2152 EraseEllipticPie( r.x0, r.y0, r.x1, r.y1, start, span );
2157 void DrawPie(
double xc,
double yc,
double r,
double start,
double span )
2159 DrawEllipticPie( xc-r, yc-r, xc+r, yc+r, start, span );
2165 void DrawPie(
const P& c,
double r,
double start,
double span )
2167 DrawPie( c.x, c.y, r, start, span );
2174 StrokeEllipticPie( xc-r, yc-r, xc+r, yc+r, start, span, pen );
2182 StrokePie( c.x, c.y, r, start, span, pen );
2189 FillEllipticPie( xc-r, yc-r, xc+r, yc+r, start, span, brush );
2197 FillPie( c.x, c.y, r, start, span, brush );
2202 void ErasePie(
double xc,
double yc,
double r,
double start,
double span )
2204 FillPie( xc, yc, r, start, span, BackgroundBrush() );
2210 void ErasePie(
const P& c,
double r,
double start,
double span )
2212 ErasePie( c.x, c.y, r, start, span );
2217 void DrawBitmap(
double x,
double y,
const Bitmap& );
2224 DrawBitmap( p.x, p.y, bm );
2229 void DrawBitmapRect(
double x,
double y,
const Bitmap&,
double x0,
double y0,
double x1,
double y1 );
2233 template <
class P,
class R>
2236 DrawBitmapRect( p.x, p.y, bm, r.x0, r.y0, r.x1, r.y1 );
2241 void DrawScaledBitmap(
double x0,
double y0,
double x1,
double y1,
const Bitmap& );
2248 DrawScaledBitmap( r.x0, r.y0, r.x1, r.y1, bm );
2253 void DrawScaledBitmapRect(
double dx0,
double dy0,
double dx1,
double dy1,
const Bitmap&,
double sx0,
double sy0,
double sx1,
double sy1 );
2257 template <
class R1,
class R2>
2260 DrawScaledBitmapRect( dst.x0, dst.y0, dst.x1, dst.y1, bm, src.x0, src.y0, src.x1, src.y1 );
2265 void DrawTiledBitmap(
double x0,
double y0,
double x1,
double y1,
const Bitmap&,
double xOffset = 0,
double yOffset = 0 );
2269 template <
class R,
class P>
2272 DrawTiledBitmap( r.x0, r.y0, r.x1, r.y1, bm, offset.x, offset.y );
2277 void DrawText(
double x,
double y,
const String& );
2284 DrawText( p.x, p.y, s );
2289 void DrawTextRect(
double x0,
double y0,
double x1,
double y1,
const String&,
TextAlignmentFlags = TextAlign::Default );
2296 DrawTextRect( r.x0, r.y0, r.x1, r.y1, s, a );
2308 return TextRect( r.x0, r.y0, r.x1, r.y1, s, a );
2317 friend class InterfaceDispatcher;
2322 #endif // !__PCL_BUILDING_PIXINSIGHT_APPLICATION
2326 #endif // __PCL_Graphics_h