[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: |
Richard Baumann |
Subject: |
[dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Graphics.cs |
Date: |
Wed, 03 May 2006 15:13:44 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnetlib
Branch:
Changes by: Richard Baumann <address@hidden> 06/05/03 15:13:44
Modified files:
. : ChangeLog
System.Drawing : Graphics.cs
Log message:
Fix image drawing with graphics transformations.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/ChangeLog.diff?tr1=1.2384&tr2=1.2385&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnetlib/System.Drawing/Graphics.cs.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
Patches:
Index: pnetlib/ChangeLog
diff -u pnetlib/ChangeLog:1.2384 pnetlib/ChangeLog:1.2385
--- pnetlib/ChangeLog:1.2384 Mon Apr 24 13:38:33 2006
+++ pnetlib/ChangeLog Wed May 3 15:13:44 2006
@@ -1,20 +1,31 @@
+2006-05-03 Richard Baumann <address@hidden>
+
+ * System.Drawing/Graphics.cs: fixed image drawing with
+ graphics transformations by applying only unit conversion, instead
+ of full device transformation, to source coordinates.
+
+ * ChangeLog: fixed some formatting errors.
+
2006-04-24 Heiko Weiss <address@hidden>
- * pnetlib/System.Drawing/ColorConverter.cs: fixed ConvertFrom.
-
+ * System.Drawing/ColorConverter.cs: fixed ConvertFrom
+
2006-04-13 Heiko Weiss <address@hidden>
- * pnetlib/runtime/System/Collections/ArrayList.cs: fixed memory leak.
- * pnetlib/runtime/System/Collections/Queue.cs: fixed memory leak.
- * pnetlib/runtime/System/Collections/SortedList.cs: fixed memory leak.
- * pnetlib/runtime/System/Private/NumberFormat/CustomFormatter.cs: fixed
bug with formatting floats.
- * pnetlib/runtime/System/Private/NumberFormat/Formatter.cs: fixed bug
with formatting floats.
- * pnetlib/runtime/System/Private/NumberFormat/ScientificFormatter.cs:
fixed bug with formatting floats.
- * pnetlib/runtime/System/Private/NumberFormat/GeneralFormatter.cs:
fixed bug with formatting floats.
+ * runtime/System/Collections/ArrayList.cs,
+ runtime/System/Collections/Queue.cs,
+ runtime/System/Collections/SortedList.cs: fixed memory leaks.
+
+ * runtime/System/Private/NumberFormat/CustomFormatter.cs,
+ runtime/System/Private/NumberFormat/Formatter.cs,
+ runtime/System/Private/NumberFormat/ScientificFormatter.cs,
+ runtime/System/Private/NumberFormat/GeneralFormatter.cs: fixed bugs
+ with formatting floats.
2006-04-13 Heiko Weiss <address@hidden>
- * runtime/System/Collections/Stack.cs: Fixed a memory leak in
Stack.Pop() and Stack.Clear().
+ * runtime/System/Collections/Stack.cs: Fixed a memory leak in
+ Stack.Pop() and Stack.Clear().
2006-04-12 Radek Polak <address@hidden>
@@ -133,7 +144,8 @@
2006-03-08 Heiko Weiss <address@hidden>
- * System.Windows.Forms/Control.cs: Fixed not processing mouse events if
Control is not enabled.
+ * System.Windows.Forms/Control.cs: Fixed not processing mouse events
+ if Control is not enabled.
2006-03-04 Gopal V <address@hidden>
@@ -353,7 +365,8 @@
2005-11-23 Peter Flaig <address@hidden>
- * System.Windows.Forms/Control.cs : fixed, map toolkitwindow to screen
only if size greater 0
+ * System.Windows.Forms/Control.cs : fixed, map toolkitwindow to screen
+ only if size greater 0
2005-11-22 Klaus Treichel <address@hidden>
@@ -380,7 +393,8 @@
2005-11-21 Heiko Weiss <address@hidden>
- *
runtime/System/Runtime/Serialization/Formatters/Binary/BinaryValueReader.cs:
removed unneccessary property calls
+ *
runtime/System/Runtime/Serialization/Formatters/Binary/BinaryValueReader.cs:
+ removed unneccessary property calls
* runtime/System/Array.cs: removed unneccessary property calls
* runtime/System/String.cs: removed unneccessary property calls
@@ -752,7 +766,7 @@
* samples/jscript/lispisms.js: Test out simple functional
programming and ensure the scopes are merged properly.
-2005-08-20 Rainer Größlinger <address@hidden>
+2005-08-20 Rainer GröÃlinger <address@hidden>
* System/Text/RegularExpressions/*: Latest updates from
SVN HEAD as of 12th August 2005. Removed match.cs, added
@@ -990,7 +1004,7 @@
* DotGNU.Misc/Profiling.cs: added comments
-2005-04-23 Erich Kitzmüller <address@hidden>
+2005-04-23 Erich Kitzmüller <address@hidden>
* System.Windows.Forms/Themes/DefaultThemePainter.cs: disabled text
more legible. (patch #3929 applied by drobosson)
@@ -3841,7 +3855,7 @@
2004-05-03 Rhys Weatherley <address@hidden>
* runtime/System/Security/SecurityElement.cs: apply a small patch
- from Carl-Adam Brengesjö <address@hidden> to fix attribute
+ from Carl-Adam Brengesjö <address@hidden> to fix attribute
setting in "SecurityElement".
2004-05-02 Gopal V <address@hidden>
Index: pnetlib/System.Drawing/Graphics.cs
diff -u pnetlib/System.Drawing/Graphics.cs:1.50
pnetlib/System.Drawing/Graphics.cs:1.51
--- pnetlib/System.Drawing/Graphics.cs:1.50 Tue Oct 25 13:32:37 2005
+++ pnetlib/System.Drawing/Graphics.cs Wed May 3 15:13:44 2006
@@ -618,22 +618,22 @@
}
// Draw a Bezier spline.
- public void FillBezier(Brush brush, Point pt1, Point
pt2,
-
Point pt3, Point pt4, FillMode fillMode)
+ public void FillBezier(Brush brush, Point pt1, Point pt2,
+ Point pt3, Point pt4, FillMode fillMode)
{
FillBezier(brush, (float)(pt1.X),
(float)(pt1.Y),
(float)(pt2.X), (float)(pt2.Y),
(float)(pt3.X), (float)(pt3.Y),
(float)(pt4.X), (float)(pt4.Y), fillMode);
}
- public void FillBezier(Brush brush, PointF pt1, PointF
pt2,
-
PointF pt3, PointF pt4, FillMode fillMode)
+ public void FillBezier(Brush brush, PointF pt1, PointF pt2,
+ PointF pt3, PointF pt4, FillMode fillMode)
{
FillBezier(brush, pt1.X, pt1.Y, pt2.X, pt2.Y,
pt3.X,
pt3.Y, pt4.X, pt4.Y, fillMode);
}
- public void FillBezier(Brush brush, float x1, float y1,
float x2, float y2,
-
float x3, float y3, float x4, float y4,
FillMode fillMode)
+ public void FillBezier(Brush brush, float x1, float y1, float x2, float
y2,
+ float x3, float y3, float x4, float y4, FillMode
fillMode)
{
int dx1, dy1, dx2, dy2;
@@ -913,7 +913,7 @@
else
{
// Stretch and draw the image.
- Point[] src = ConvertRectangle3
+ Point[] src = ConvertUnits
(0, 0, icon.Width, icon.Height,
GraphicsUnit.Pixel);
Point[] dest = ConvertRectangle3
(targetRect.X, targetRect.Y,
@@ -954,7 +954,7 @@
{
height = targetRect.Height;
}
- Point[] src = ConvertRectangle3
+ Point[] src = ConvertUnits
(0, 0, width, height,
GraphicsUnit.Pixel);
Point[] dest = ConvertRectangle3
(targetRect.X, targetRect.Y,
width, height, pageUnit);
@@ -1003,7 +1003,7 @@
public void DrawImage(Image image, Point[] destPoints)
{
- Point[] src = ConvertRectangle3(0, 0,
image.Width, image.Height, GraphicsUnit.Pixel);
+ Point[] src = ConvertUnits(0, 0, image.Width,
image.Height, GraphicsUnit.Pixel);
Point[] dest = ConvertPoints(destPoints, 3,
pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1015,21 +1015,21 @@
public void DrawImage(Image image, PointF[] destPoints)
{
- Point[] src = ConvertRectangle3(0, 0,
image.Width, image.Height, GraphicsUnit.Pixel);
+ Point[] src = ConvertUnits(0, 0, image.Width,
image.Height, GraphicsUnit.Pixel);
Point[] dest = ConvertPoints(destPoints, 3,
pageUnit);
ToolkitDrawImage(image, src, dest);
}
public void DrawImage(Image image, Rectangle rect)
{
- Point[] src = ConvertRectangle3(0, 0,
image.Width, image.Height, GraphicsUnit.Pixel);
+ Point[] src = ConvertUnits(0, 0, image.Width,
image.Height, GraphicsUnit.Pixel);
Point[] dest = ConvertRectangle3(rect.X,
rect.Y, rect.Width, rect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
public void DrawImage(Image image, RectangleF rect)
{
- Point[] src = ConvertRectangle3(0, 0,
image.Width, image.Height, GraphicsUnit.Pixel);
+ Point[] src = ConvertUnits(0, 0, image.Width,
image.Height, GraphicsUnit.Pixel);
Point[] dest = ConvertRectangle3(rect.X,
rect.Y, rect.Width, rect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1053,7 +1053,7 @@
public void DrawImage(Image image, Point[] destPoints,
Rectangle srcRect,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+ Point[] src = ConvertUnits(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
Point[] dest = ConvertPoints(destPoints, 3,
pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1061,7 +1061,7 @@
public void DrawImage(Image image, PointF[] destPoints,
RectangleF srcRect,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+ Point[] src = ConvertUnits(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
Point[] dest = ConvertPoints(destPoints, 3,
pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1069,7 +1069,7 @@
public void DrawImage(Image image, Rectangle destRect,
Rectangle srcRect,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+ Point[] src = ConvertUnits(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
Point[] dest = ConvertRectangle3(destRect.X,
destRect.Y, destRect.Width, destRect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1077,20 +1077,20 @@
public void DrawImage(Image image, RectangleF destRect,
RectangleF srcRect,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+ Point[] src = ConvertUnits(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
Point[] dest = ConvertRectangle3(destRect.X,
destRect.Y, destRect.Width, destRect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
public void DrawImage(Image image, int x, int y, int width, int height)
{
- Point[] src = ConvertRectangle3(0, 0,
image.Width, image.Height, GraphicsUnit.Pixel);
+ Point[] src = ConvertUnits(0, 0, image.Width,
image.Height, GraphicsUnit.Pixel);
Point[] dest = ConvertRectangle3(x, y, width,
height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
public void DrawImage(Image image, int x, int y,
Rectangle srcRect,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+ Point[] src = ConvertUnits(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
Point[] dest = ConvertRectangle3(x, y, 0, 0,
pageUnit);
dest[1].X = image.Width;
dest[2].Y = image.Height;
@@ -1099,14 +1099,14 @@
public void DrawImage(Image image, float x, float y,
RectangleF srcRect,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+ Point[] src = ConvertUnits(srcRect.X,
srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
Point[] dest = ConvertRectangle3(x, y,
srcRect.Width, srcRect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
public void DrawImage(Image image, float x, float y,
float width, float height)
{
- Point[] src = ConvertRectangle3(0, 0,
image.Width, image.Height, GraphicsUnit.Pixel);
+ Point[] src = ConvertUnits(0, 0, image.Width,
image.Height, GraphicsUnit.Pixel);
Point[] dest = ConvertRectangle3(x, y, width,
height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1114,7 +1114,7 @@
int srcX, int srcY, int
srcWidth, int srcHeight,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcX, srcY,
srcWidth, srcHeight, srcUnit);
+ Point[] src = ConvertUnits(srcX, srcY,
srcWidth, srcHeight, srcUnit);
Point[] dest = ConvertRectangle3(destRect.X,
destRect.Y, destRect.Width, destRect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -1124,7 +1124,7 @@
float srcWidth, float
srcHeight,
GraphicsUnit srcUnit)
{
- Point[] src = ConvertRectangle3(srcX, srcY,
srcWidth, srcHeight, srcUnit);
+ Point[] src = ConvertUnits(srcX, srcY,
srcWidth, srcHeight, srcUnit);
Point[] dest = ConvertRectangle3(destRect.X,
destRect.Y, destRect.Width, destRect.Height, pageUnit);
ToolkitDrawImage(image, src, dest);
}
@@ -4207,7 +4207,6 @@
points[2] = new Point(pt3x, pt3y);
return points;
}
-
private Point[] ConvertRectangle3(float x, float y, float width, float
height, GraphicsUnit unit)
{
Point[] points = new Point[3];
@@ -4327,6 +4326,83 @@
}
}
+ // Convert a rectangle into a set of 3 device unit co-ordinates.
+ private Point[] ConvertUnits(int x, int y, int width, int height,
+ GraphicsUnit unit)
+ {
+ // get the unit adjustment vector
+ PointF adjust = ConvertUnitsAdjustVector(unit);
+
+ // calculate the unit adjusted rectangle bounds
+ int x0 = (int)((x + 0) * adjust.X);
+ int x1 = (int)((x + width) * adjust.X);
+ int y0 = (int)((y + 0) * adjust.Y);
+ int y1 = (int)((y + height) * adjust.Y);
+
+ // create the unit adjusted rectangle points
+ Point[] points = new Point[]
+ {
+ new Point(x0, y0),
+ new Point(x1, y0),
+ new Point(x0, y1)
+ };
+
+ // return the unit adjusted rectangle points
+ return points;
+ }
+ private Point[] ConvertUnits(float x, float y, float width, float
height,
+ GraphicsUnit unit)
+ {
+ // get the unit adjustment vector
+ PointF adjust = ConvertUnitsAdjustVector(unit);
+
+ // calculate the unit adjusted rectangle bounds
+ int x0 = (int)((x + 0) * adjust.X);
+ int x1 = (int)((x + width) * adjust.X);
+ int y0 = (int)((y + 0) * adjust.Y);
+ int y1 = (int)((y + height) * adjust.Y);
+
+ // create the unit adjusted rectangle points
+ Point[] points = new Point[]
+ {
+ new Point(x0, y0),
+ new Point(x1, y0),
+ new Point(x0, y1)
+ };
+
+ // return the unit adjusted rectangle points
+ return points;
+ }
+
+ // Get the unit adjustment vector for the ConvertUnits methods.
+ private PointF ConvertUnitsAdjustVector(GraphicsUnit unit)
+ {
+ // create and return the unit adjustment vector
+ switch(unit)
+ {
+ case GraphicsUnit.World:
+ case GraphicsUnit.Pixel:
+ default:
+ { return new PointF(1.0f,
1.0f); }
+
+ case GraphicsUnit.Display:
+ { return new PointF((DpiX /
75.0f), (DpiY / 75.0f)); }
+
+ case GraphicsUnit.Point:
+ { return new PointF((DpiX /
72.0f), (DpiY / 72.0f)); }
+
+ case GraphicsUnit.Inch:
+ { return new PointF(DpiX,
DpiY); }
+
+ case GraphicsUnit.Document:
+ { return new PointF((DpiX /
300.0f), (DpiY / 300.0f)); }
+
+ case GraphicsUnit.Millimeter:
+ { return new PointF((DpiX /
25.4f), (DpiY / 25.4f)); }
+ }
+ }
+
+
// Get the toolkit graphics object underlying this object.
internal IToolkitGraphics ToolkitGraphics
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ./ChangeLog System.Drawing/Graphics.cs,
Richard Baumann <=