private void CreateObjects() { brSolid = new SolidBrushPlus(Color.CornflowerBlue); brHatch = new HatchBrush(HatchStyle.HatchStyle25Percent, Color.Black, Color.White); string bitmapPath = System.IO.Path.GetDirectoryName(GetType().Assembly.GetModules()[0].FullyQualifiedName); bitmapPath = System.IO.Path.Combine(bitmapPath, "brushPattern.bmp"); StreamOnFile sf = new StreamOnFile(bitmapPath); ImagePlus img = new ImagePlus(sf, false); brTexture = new TextureBrushPlus(img, WrapMode.WrapModeTile); brLinGrad = new LinearGradientBrush(new GpPointF(0, 0), new GpPointF(50, 50), Color.Black, Color.White); // Create rectangular path GraphicsPath path = new GraphicsPath(FillMode.FillModeAlternate); path.AddRectangle(new GpRectF( 0, 0, ClientRectangle.Width, ClientRectangle.Height / 5)); // Create rectangular gradient brush // with red in center and black in the corners brPathGrad = new PathGradientBrush(path); brPathGrad.SetCenterColor(Color.Red); int count = 2; brPathGrad.SetSurroundColors(new Color[] { Color.Black, Color.Black }, ref count); }
public GraphicsPlus(ImagePlus image) { GpGraphics Graphics = new GpGraphics(); if (image != null) { lastResult = NativeMethods.GdipGetImageGraphicsContext( image.nativeImage, out Graphics); } SetNativeGraphics(Graphics); }
ImagePlus GetImage() { GpImage image; SetStatus(NativeMethods.GdipGetTextureImage((GpTexture)nativeBrush, out image)); ImagePlus retimage = new ImagePlus(image, lastResult); return(retimage); }
// When creating a texture brush from a metafile image, the dstRect // is used to specify the size that the metafile image should be // rendered at in the device units of the destination graphics. // It is NOT used to crop the metafile image, so only the width // and height values matter for metafiles. TextureBrushPlus(ImagePlus image, WrapMode wrapMode, GpRectF dstRect) { GpTexture texture; lastResult = NativeMethods.GdipCreateTexture2( image.nativeImage, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out texture); SetNativeBrush(texture); }
TextureBrushPlus(ImagePlus image, GpRect dstRect, ImageAttributesPlus imageAttributes) { GpTexture texture; lastResult = NativeMethods.GdipCreateTextureIAI( image.nativeImage, (imageAttributes != null) ? imageAttributes.nativeImageAttr : new GpImageAttributes(), dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out texture ); SetNativeBrush(texture); }
public TextureBrushPlus(ImagePlus image, WrapMode wrapMode) { GpTexture texture; GpRectF rc; Unit unit; image.GetBounds(out rc, out unit); lastResult = NativeMethods.GdipCreateTextureIA( image.nativeImage, new GpImageAttributes(), rc.X, rc.Y, rc.Width, rc.Height, out texture); SetNativeBrush(texture); }
TextureBrushPlus(ImagePlus image, WrapMode wrapMode, int dstX, int dstY, int dstWidth, int dstHeight) { GpTexture texture; lastResult = NativeMethods.GdipCreateTexture2I( image.nativeImage, wrapMode, dstX, dstY, dstWidth, dstHeight, out texture); SetNativeBrush(texture); }
public GpStatus DrawImage(ImagePlus image, GpRectF rect) { GpRectF bounds; Unit unit; image.GetBounds(out bounds, out unit); return DrawImage(image, rect, 0, 0, bounds.Width, bounds.Height, unit, null); }
public GpStatus DrawImage(ImagePlus image, float x, float y) { return SetStatus(NativeMethods.GdipDrawImage(nativeGraphics, image != null ? image.nativeImage : null, x, y)); }
public static GraphicsPlus FromImage(ImagePlus image) { return new GraphicsPlus(image); }
TextureBrushPlus( ImagePlus image, WrapMode wrapMode, GpRect dstRect ) { GpTexture texture; lastResult = NativeMethods.GdipCreateTexture2I( image.nativeImage, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out texture); SetNativeBrush(texture); }
public GpStatus DrawImage(ImagePlus image, int x, int y, int width, int height) { return DrawImage(image, new GpRectF(x, y, width, height)); }
public GpStatus DrawImage(ImagePlus image, int x, int y) { GpRectF bounds; Unit unit; image.GetBounds(out bounds, out unit); bounds.Offset(x, y); return DrawImage(image, bounds, 0, 0, bounds.Width, bounds.Height, unit, null); }
ImagePlus GetImage() { GpImage image; SetStatus(NativeMethods.GdipGetTextureImage((GpTexture)nativeBrush, out image)); ImagePlus retimage = new ImagePlus(image, lastResult); return retimage; }
public GpStatus DrawImage(ImagePlus image, float x, float y, float width, float height) { GpRectF bounds; Unit unit; image.GetBounds(out bounds, out unit); return DrawImage(image, new GpRectF(x, y, width, height), 0, 0, bounds.Width, bounds.Height, unit, null); }
public GpStatus DrawImage(ImagePlus image, GpPoint point) { return DrawImage(image, point.X, point.Y); }
public GpStatus DrawImage(ImagePlus image, float x, float y, float srcx, float srcy, float srcwidth, float srcheight, Unit srcUnit) { GpRectF bounds; Unit unit; image.GetBounds(out bounds, out unit); return DrawImage(image, new GpRectF(x, y, srcwidth, srcheight), srcx, srcy, srcwidth, srcheight, srcUnit, null); }
public GpStatus DrawImage(ImagePlus image, GpRect rect) { return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); }
public GpStatus DrawImage(ImagePlus image, int x, int y, int srcx, int srcy, int srcwidth, int srcheight, Unit srcUnit) { return SetStatus(NativeMethods.GdipDrawImagePointRectI(nativeGraphics, image != null ? image.nativeImage : null, x, y, srcx, srcy, srcwidth, srcheight, srcUnit)); }
public GpStatus DrawImage(ImagePlus image, GpPoint[] destPoints) { int count = destPoints.Length; if (count != 3 && count != 4) return SetStatus(GpStatus.InvalidParameter); return SetStatus(NativeMethods.GdipDrawImagePointsI(nativeGraphics, image != null ? image.nativeImage : null, destPoints, count)); }
public GpStatus DrawImage(ImagePlus image, GpRectF destRect, float srcx, float srcy, float srcwidth, float srcheight, Unit srcUnit, ImageAttributesPlus imageAttributes) { return SetStatus(NativeMethods.GdipDrawImageRectRect(nativeGraphics, image != null ? image.nativeImage : null, destRect.X, destRect.Y, destRect.Width, destRect.Height, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes != null ? imageAttributes.nativeImageAttr : new GpImageAttributes(), IntPtr.Zero, IntPtr.Zero)); }
private ImagePlus(ImagePlus C) { NativeMethods.GdipCloneImage(C.nativeImage, out this.nativeImage); }
public GpStatus DrawImage(ImagePlus image, GpPoint[] destPoints, int srcx, int srcy, int srcwidth, int srcheight, Unit srcUnit, ImageAttributesPlus imageAttributes) { return SetStatus(NativeMethods.GdipDrawImagePointsRectI(nativeGraphics, image != null ? image.nativeImage : null, destPoints, destPoints.Length, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes != null ? imageAttributes.nativeImageAttr : new GpImageAttributes(), IntPtr.Zero, IntPtr.Zero)); }