[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Drawing2D/Gr...
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Drawing2D/Gr... |
Date: |
Mon, 13 Feb 2006 11:02:22 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Branch:
Changes by: Heiko Weiss <address@hidden> 06/02/13 11:02:22
Modified files:
. : ChangeLog
System.Drawing/Drawing2D: GraphicsPath.cs
Log message:
added functionality to draw text in graphics path
still a lot todo in graphics path!
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/ChangeLog.diff?tr1=1.2352&tr2=1.2353&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: pnetlib/ChangeLog
diff -u pnetlib/ChangeLog:1.2352 pnetlib/ChangeLog:1.2353
--- pnetlib/ChangeLog:1.2352 Mon Feb 13 07:44:59 2006
+++ pnetlib/ChangeLog Mon Feb 13 11:02:21 2006
@@ -1,5 +1,9 @@
2006-02-13 Heiko Weiss <address@hidden>
+ * System.Drawing/Drawing2D/GraphicsPath.cs: added functionality to draw
text in graphics path
+
+2006-02-13 Heiko Weiss <address@hidden>
+
* System.Windows.Forms/TabControl.cs: fixed drawing TabPage first time
(bug #15698)
2006-02-06 Heiko Weiss <address@hidden>
Index: pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs
diff -u pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs:1.3
pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs:1.4
--- pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs:1.3 Sun Aug 28
08:14:03 2005
+++ pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs Mon Feb 13 11:02:22 2006
@@ -510,7 +510,7 @@
int style, float emSize,
PointF origin, StringFormat
format)
{
- // TODO
+ AddPathObject( new StringPathObject( s, family,
style, emSize, origin, format ) );
}
public void AddString(String s, FontFamily family,
int style, float emSize,
@@ -524,7 +524,7 @@
int style, float emSize,
RectangleF layoutRect,
StringFormat format)
{
- // TODO
+ AddPathObject( new StringPathObject( s, family,
style, emSize, layoutRect, format ) );
}
// Clean all markers from this path.
@@ -707,6 +707,7 @@
{
last = obj;
}
+ obj = next;
}
}
@@ -971,8 +972,7 @@
public override void Fill(Graphics graphics, Brush brush,
Pen penBrush,
FillMode fillMode)
{
- graphics.DrawCurve(penBrush, points,
offset,
-
numberOfSegments, tension);
+ graphics.DrawCurve(penBrush, points,
offset, numberOfSegments, tension);
}
// Clone this path object.
@@ -1165,6 +1165,75 @@
}; // class RectanglePathObject
+ // String path objects.
+ private sealed class StringPathObject : PathObject
+ {
+ // Internal state.
+ String mString;
+ RectangleF mRect;
+ PointF mPoint;
+ StringFormat mFormat;
+ Font mFont;
+
+ // Constructor.
+ public StringPathObject( String s, FontFamily family, int
style, float emSize, PointF origin, StringFormat format ) :
+ this( s, family, style, emSize, origin,
RectangleF.Empty, format )
+ {
+ }
+
+ // Constructor.
+ public StringPathObject( String s, FontFamily family, int
style, float emSize, RectangleF layoutRect, StringFormat format ) :
+ this( s, family, style, emSize, PointF.Empty,
layoutRect, format )
+ {
+ }
+
+ private StringPathObject( String s, FontFamily family, int
style, float emSize, PointF origin, RectangleF layoutRect, StringFormat format
) :
+ this( s, new Font( family, emSize, (FontStyle)style ),
origin, layoutRect, format )
+ {
+ }
+
+ private StringPathObject( String s, Font font, PointF origin,
RectangleF layoutRect, StringFormat format )
+ {
+ mString = s;
+ mFont = font;
+ mPoint = origin;
+ mRect = layoutRect;
+ mFormat = format;
+ mFormat.FormatFlags |= StringFormatFlags.NoClip;
+ }
+
+
+ RectangleF GetRect(Graphics graphics ) {
+ if( RectangleF.Empty != mRect ) return mRect;
+ SizeF sz = graphics.MeasureString( mString, mFont,
mPoint, mFormat );
+ RectangleF rNew = new RectangleF( mPoint, sz );
+ return rNew;
+ }
+
+ // Draw this path object.
+ public override void Draw(Graphics graphics, Pen pen)
+ {
+ using( SolidBrush b = new SolidBrush(pen.Color) ) {
+ this.Fill( graphics, b, null,
FillMode.Alternate );
+ }
+ }
+
+ // Fill this path object.
+ public override void Fill(Graphics graphics, Brush brush,
+
Pen penBrush, FillMode fillMode)
+ {
+ RectangleF r = GetRect(graphics);
+ graphics.DrawString(mString, mFont, brush, r, mFormat);
+ }
+
+ // Clone this path object.
+ public override PathObject Clone()
+ {
+ return (PathObject) this.MemberwiseClone();
+ }
+
+ }; // class RectanglePathObject
+
}; // class GraphicsPath
}; // namespace System.Drawing.Drawing2D
- [dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Drawing2D/Gr...,
Heiko Weiss <=