[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Drawing2D/Ma...
From: |
Heiko Weiss |
Subject: |
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Drawing2D/Ma... |
Date: |
Thu, 04 May 2006 09:44:26 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Branch:
Changes by: Heiko Weiss <address@hidden> 06/05/04 09:44:26
Modified files:
. : ChangeLog
System.Drawing/Drawing2D: Matrix.cs
System.Drawing : Graphics.cs
Log message:
added a workaround for DrawString with graphics transformations.
This only works for scaling yet!!!
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/ChangeLog.diff?tr1=1.2385&tr2=1.2386&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Drawing/Drawing2D/Matrix.cs.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Drawing/Graphics.cs.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
Patches:
Index: pnetlib/ChangeLog
diff -u pnetlib/ChangeLog:1.2385 pnetlib/ChangeLog:1.2386
--- pnetlib/ChangeLog:1.2385 Wed May 3 15:13:44 2006
+++ pnetlib/ChangeLog Thu May 4 09:44:26 2006
@@ -1,3 +1,10 @@
+2006-05-04 Heiko Weiss <address@hidden>
+
+ * System.Drawing/Graphics.cs: added a workaround for DrawString
+ with graphics transformations.
+ This only works for scaling yet!!!
+ * System.Drawing/Drawing2D/Matrix.cs: added calculaion new font size
when scaling is set (Workaround only).
+
2006-05-03 Richard Baumann <address@hidden>
* System.Drawing/Graphics.cs: fixed image drawing with
Index: pnetlib/System.Drawing/Drawing2D/Matrix.cs
diff -u pnetlib/System.Drawing/Drawing2D/Matrix.cs:1.9
pnetlib/System.Drawing/Drawing2D/Matrix.cs:1.10
--- pnetlib/System.Drawing/Drawing2D/Matrix.cs:1.9 Tue Jan 4 22:44:06 2005
+++ pnetlib/System.Drawing/Drawing2D/Matrix.cs Thu May 4 09:44:26 2006
@@ -604,6 +604,13 @@
{
return this.m11 * this.m22 - this.m12 * this.m21;
}
+
+ // Workaround for calculation new font size, if a transformation is set
+ // this does only work for scaling, not for rotation or multiply
transformations
+ // Normally we should stretch or shrink the font.
+ internal float TransformFontSize( float fIn ) {
+ return Math.Min( this.m11, this.m22 ) * fIn;
+ }
}; // class Matrix
}; // namespace System.Drawing.Drawing2D
Index: pnetlib/System.Drawing/Graphics.cs
diff -u pnetlib/System.Drawing/Graphics.cs:1.51
pnetlib/System.Drawing/Graphics.cs:1.52
--- pnetlib/System.Drawing/Graphics.cs:1.51 Wed May 3 15:13:44 2006
+++ pnetlib/System.Drawing/Graphics.cs Thu May 4 09:44:26 2006
@@ -1581,9 +1581,12 @@
// attempt to draw the text
try
{
+ // Workaround for calculation
new font size, if a transformation is set
+ // this does only work for
scaling, not for rotation or multiply transformations
+
// draw the text
textLayoutManager.Draw
- (this, s, font,
deviceLayout, format, brush);
+ (this, s,
this.TransformFont(font), deviceLayout, format, brush);
}
finally
{
@@ -1592,6 +1595,24 @@
}
}
}
+
+ // Workaround for calculation new font size, if a transformation is set
+ // this does only work for scaling, not for rotation or multiply
transformations
+ // Normally we should stretch or shrink the font.
+ Font TransformFont( Font font_in )
+ {
+ Font font = font_in;
+
+ if( transform != null ) {
+ float sizeOld = font_in.Size;
+ float sizeNew = transform.TransformFontSize( sizeOld );
+ if( sizeOld != sizeNew ) {
+ font = new Font( font_in.FontFamily, sizeNew,
font_in.Style, font_in.Unit, font_in.GdiCharSet, font_in.GdiVerticalFont );
+ }
+ }
+ return font;
+ }
+
public void DrawString(String s, Font font, Brush brush, float x, float
y)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Drawing2D/Ma...,
Heiko Weiss <=