[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ChangeLog System.Drawing/Graphics.cs
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] pnetlib ChangeLog System.Drawing/Graphics.cs |
Date: |
Mon, 25 Sep 2006 08:26:03 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Changes by: Heiko Weiss <brubbel> 06/09/25 08:26:03
Modified files:
. : ChangeLog
System.Drawing : Graphics.cs
Log message:
allow rotation of arcs and ellipses
by drawing and filling them with graphics path.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2436&r2=1.2437
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Drawing/Graphics.cs?cvsroot=dotgnu-pnet&r1=1.53&r2=1.54
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2436
retrieving revision 1.2437
diff -u -b -r1.2436 -r1.2437
--- ChangeLog 25 Sep 2006 05:27:37 -0000 1.2436
+++ ChangeLog 25 Sep 2006 08:26:03 -0000 1.2437
@@ -1,3 +1,7 @@
+2006-09-25 Heiko Weiss <address@hidden>
+
+ * System.Drawing/Graphics.cs: allow rotation of arcs and ellipses
+ by drawing and filling them with graphics path.
2006-09-25 Gopal V <address@hidden>
Index: System.Drawing/Graphics.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Drawing/Graphics.cs,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- System.Drawing/Graphics.cs 1 Jun 2006 11:55:04 -0000 1.53
+++ System.Drawing/Graphics.cs 25 Sep 2006 08:26:03 -0000 1.54
@@ -555,6 +555,19 @@
public void DrawArc(Pen pen, int x, int y, int width, int height,
float startAngle, float
sweepAngle)
{
+ // Bail out now if there's nothing to draw.
+ if(pen.PenType == PenType.SolidColor &&
pen.Color.A == 0)
+ {
+ return;
+ }
+
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddArc(
x,y,width,height,startAngle,sweepAngle);
+ DrawPath( pen, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -562,6 +575,7 @@
ToolkitGraphics.DrawArc(rect,
startAngle, sweepAngle);
}
}
+ }
public void DrawArc(Pen pen, float x, float y, float width, float
height,
float startAngle, float
sweepAngle)
{
@@ -571,6 +585,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddArc(
x,y,width,height,startAngle,sweepAngle);
+ DrawPath( pen, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -578,6 +599,7 @@
ToolkitGraphics.DrawArc(rect,
startAngle, sweepAngle);
}
}
+ }
// Draw a Bezier spline.
public void DrawBezier(Pen pen, Point pt1, Point pt2,
@@ -857,6 +879,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddEllipse( x,y,width,height);
+ DrawPath( pen, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -864,6 +893,7 @@
ToolkitGraphics.DrawArc(rect, 0.0f,
360.0f);
}
}
+ }
public void DrawEllipse(Pen pen, float x, float y,
float width, float
height)
{
@@ -873,6 +903,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddEllipse( x,y,width,height);
+ DrawPath( pen, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -880,6 +917,7 @@
ToolkitGraphics.DrawArc(rect, 0.0f,
360.0f);
}
}
+ }
// Draw an unstretched complete icon via the toolkit.
private void ToolkitDrawIcon(Icon icon, int x, int y)
@@ -1613,7 +1651,6 @@
return font;
}
-
public void DrawString(String s, Font font, Brush brush, float x, float
y)
{
DrawString(s, font, brush, x, y, null);
@@ -1994,6 +2031,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddEllipse( x,y,width,height);
+ FillPath( brush, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -2001,6 +2045,7 @@
ToolkitGraphics.FillPie(rect, 0.0f,
360.0f);
}
}
+ }
public void FillEllipse(Brush brush, float x, float y,
float width, float
height)
{
@@ -2010,6 +2055,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddEllipse( x,y,width,height);
+ FillPath( brush, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -2017,6 +2069,7 @@
ToolkitGraphics.FillPie(rect, 0.0f,
360.0f);
}
}
+ }
// Fill the interior of a path.
public void FillPath(Brush brush, GraphicsPath path)
@@ -2064,6 +2117,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddPie(
x,y,width,height,startAngle,sweepAngle);
+ FillPath( brush, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -2071,6 +2131,7 @@
ToolkitGraphics.FillPie(rect,
startAngle, sweepAngle);
}
}
+ }
public void FillPie(Brush brush, float x, float y,
float width, float height,
float startAngle, float
sweepAngle)
@@ -2081,6 +2142,13 @@
return;
}
+ // if transform is set use graphics path to
draw or fill, since the transformation works for this then.
+ if( null != transform ) {
+ GraphicsPath path = new GraphicsPath();
+ path.AddPie(
x,y,width,height,startAngle,sweepAngle);
+ FillPath( brush, path );
+ }
+ else {
Point[] rect = ConvertRectangle(x +
baseWindow.X, y + baseWindow.Y, width, height, pageUnit);
lock(this)
{
@@ -2088,6 +2156,7 @@
ToolkitGraphics.FillPie(rect,
startAngle, sweepAngle);
}
}
+ }
// Fill a polygon.
public void FillPolygon(Brush brush, Point[] points)
@@ -4466,14 +4535,27 @@
{
throw new
ObjectDisposedException("graphics");
}
- IToolkitPen tpen = pen.GetPen(graphics.Toolkit);
- if(pen.PenType == PenType.SolidColor)
+
+ Pen penNew = pen;
+ if( transform != null ) {
+ // calculation new pen size, if a
transformation is set
+ // using the workaround for Font scaling
+ float penWidth = pen.Width;
+ float newWidth =
transform.TransformFontSize(penWidth);
+ if( penWidth != newWidth ) {
+ penNew = (Pen) pen.Clone();
+ penNew.Width = newWidth;
+ }
+ }
+
+ IToolkitPen tpen =
penNew.GetPen(graphics.Toolkit);
+ if(penNew.PenType == PenType.SolidColor)
{
tpen.Select(graphics);
}
else
{
- IToolkitBrush tbrush =
pen.Brush.GetBrush(graphics.Toolkit);
+ IToolkitBrush tbrush =
penNew.Brush.GetBrush(graphics.Toolkit);
tpen.Select(graphics, tbrush);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ChangeLog System.Drawing/Graphics.cs,
Heiko Weiss <=