private bool disposed = false;
private static float defDpiX = 0;
private static float defDpiY = 0;
+#if NET_2_0
+ private IntPtr deviceContextHdc;
+#endif
#if !NET_2_0
[ComVisible(false)]
throw new NotImplementedException ();
}
-
public GraphicsContainer BeginContainer ()
{
- int state;
+ uint state;
Status status;
status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
GDIPlus.CheckStatus (status);
return new GraphicsContainer(state);
}
-
+
+ [MonoTODO ("rectangles and unit aren't supported in libgdiplus")]
public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
{
- int state;
+ uint state;
Status status;
- status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
+ status = GDIPlus.GdipBeginContainerI (nativeObject, ref dstrect, ref srcrect, unit, out state);
GDIPlus.CheckStatus (status);
return new GraphicsContainer (state);
}
-
+ [MonoTODO ("rectangles and unit aren't supported in libgdiplus")]
public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
{
- int state;
+ uint state;
Status status;
- status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
+ status = GDIPlus.GdipBeginContainer (nativeObject, ref dstrect, ref srcrect, unit, out state);
GDIPlus.CheckStatus (status);
return new GraphicsContainer (state);
public void DrawIcon (Icon icon, Rectangle targetRect)
{
- Image img = icon.ToBitmap ();
- DrawImage (img, targetRect);
+ using (Image img = icon.ToBitmap ()) {
+ DrawImage (img, targetRect);
+ }
}
public void DrawIcon (Icon icon, int x, int y)
{
- Image img = icon.ToBitmap ();
- DrawImage (img, x, y);
+ using (Image img = icon.ToBitmap ()) {
+ DrawImage (img, x, y);
+ }
}
public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
{
- Image img = icon.ToBitmap ();
- DrawImageUnscaled (img, targetRect);
+ using (Image img = icon.ToBitmap ()) {
+ DrawImageUnscaled (img, targetRect);
+ }
}
public void DrawImage (Image image, RectangleF rect)
public void EndContainer (GraphicsContainer container)
{
+#if NET_2_0
if (container == null)
throw new ArgumentNullException ("container");
+#endif
Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
GDIPlus.CheckStatus (status);
}
{
if (brush == null)
throw new ArgumentNullException ("brush");
-
+ if (rects == null)
+ throw new ArgumentNullException ("rects");
+
Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
GDIPlus.CheckStatus (status);
}
{
if (brush == null)
throw new ArgumentNullException ("brush");
-
+ if (rects == null)
+ throw new ArgumentNullException ("rects");
+
Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
GDIPlus.CheckStatus (status);
}
{
IntPtr hdc;
GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out hdc));
+#if NET_2_0
+ deviceContextHdc = hdc;
+#endif
return hdc;
}
{
Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
GDIPlus.CheckStatus (status);
+#if NET_2_0
+ if (hdc == deviceContextHdc)
+ deviceContextHdc = IntPtr.Zero;
+#endif
}
+
#if NET_2_0
- public void ReleaseHdc()\r
+ public void ReleaseHdc ()\r
{\r
- \r
+ if (deviceContextHdc == IntPtr.Zero)
+ throw new ArgumentException ("Invalid Handle");
+
+ ReleaseHdc (deviceContextHdc);
}
#endif
+
[MonoTODO]
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Never)]
}
}
+ [MonoTODO ("not supported by libgdiplus")]
public PixelOffsetMode PixelOffsetMode {
get {
PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
}
}
+ [MonoTODO ("not supported by libgdiplus")]
public int TextContrast {
get {
int contrast;
#if NET_2_0
[MonoTODO]
+ [EditorBrowsable (EditorBrowsableState.Never)]
public object GetContextInfo ()
{
throw new NotImplementedException ();