GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, PointF point)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Point [] destPoints)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Point point)
{
if (image == null)
DrawImage (image, point.X, point.Y);
}
-
public void DrawImage (Image image, Rectangle rect)
{
if (image == null)
DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
}
-
public void DrawImage (Image image, PointF [] destPoints)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, int x, int y)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, float x, float y)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
ImageAttributes imageAttr)
{
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
ImageAttributes imageAttr)
{
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
{
if (image == null)
GDIPlus.CheckStatus (status);
}
-
public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
{
if (image == null)
public void DrawImageUnscaled (Image image, Point point)
{
- if (image == null)
- throw new ArgumentNullException ("image");
DrawImageUnscaled (image, point.X, point.Y);
}
public void DrawImageUnscaled (Image image, Rectangle rect)
{
- if (image == null)
- throw new ArgumentNullException ("image");
DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
}
{
if (image == null)
throw new ArgumentNullException ("image");
- Image tmpImg = new Bitmap (width, height);
- Graphics g = FromImage (tmpImg);
- g.DrawImage (image, 0, 0, image.Width, image.Height);
- this.DrawImage (tmpImg, x, y, width, height);
- tmpImg.Dispose ();
- g.Dispose ();
+
+ // avoid creating an empty, or negative w/h, bitmap...
+ if ((width <= 0) || (height <= 0))
+ return;
+
+ using (Image tmpImg = new Bitmap (width, height)) {
+ using (Graphics g = FromImage (tmpImg)) {
+ g.DrawImage (image, 0, 0, image.Width, image.Height);
+ DrawImage (tmpImg, x, y, width, height);
+ }
+ }
}
#if NET_2_0
public void DrawImageUnscaledAndClipped (Image image, Rectangle rect)
{
- int height, width;
- width = (image.Width > rect.Width) ? rect.Width : image.Width;
- height = (image.Height > rect.Height) ? rect.Height : image.Height;
+ if (image == null)
+ throw new ArgumentNullException ("image");
+
+ int width = (image.Width > rect.Width) ? rect.Width : image.Width;
+ int height = (image.Height > rect.Height) ? rect.Height : image.Height;
DrawImageUnscaled (image, rect.X, rect.Y, width, height);
}