public PenPlus(BrushPlus brush, float width) { Unit unit = Unit.UnitWorld; nativePen = null; lastResult = GdiPlus.GdipCreatePen2(brush.nativeBrush, width, unit, out nativePen); }
public GpStatus SetSurroundColors(Color[] colors, ref int count) { int count1 = GetPointCount(); if ((count > count1) || (count1 <= 0)) { return(SetStatus(GpStatus.InvalidParameter)); } count1 = count; int[] argbs = new int[count1]; for (int i = 0; i < count1; i++) { argbs[i] = colors[i].ToArgb(); } SetStatus(GdiPlus.GdipSetPathGradientSurroundColorsWithCount( (GpPathGradient)nativeBrush, argbs, ref count1)); if (lastResult == GpStatus.Ok) { count = count1; } return(lastResult); }
public GpStatus SetBlend(float[] blendFactors, float[] blendPositions) { return(SetStatus(GdiPlus.GdipSetPathGradientBlend( (GpPathGradient)nativeBrush, blendFactors, blendPositions, blendFactors.Length))); }
//public LinearGradientBrush(RectangleF rect, // Color color1, // Color color2, // LinearGradientMode mode) //{ // GpLineGradient brush; // lastResult = GdiPlus.GdipCreateLineBrushFromRect(ref rect, // color1.ToArgb(), // color2.ToArgb(), // mode, // WrapMode.WrapModeTile, // out brush); // SetNativeBrush(brush); //} //LinearGradientBrush(Rectangle rect, // Color color1, // Color color2, // LinearGradientMode mode) //{ // GpLineGradient brush; // lastResult = GdiPlus.GdipCreateLineBrushFromRectI(ref rect, // color1.ToArgb(), // color2.ToArgb(), // mode, // WrapMode.WrapModeTile, // out brush); // SetNativeBrush(brush); //} //LinearGradientBrush(RectangleF rect, // Color color1, // Color color2, // float angle, // bool isAngleScalable) //{ // GpLineGradient brush; // lastResult = GdiPlus.GdipCreateLineBrushFromRectWithAngle(ref rect, // color1.ToArgb(), // color2.ToArgb(), // angle, // isAngleScalable, // WrapMode.WrapModeTile, // out brush); // SetNativeBrush(brush); //} //LinearGradientBrush(Rectangle rect, // Color color1, // Color color2, // float angle, // bool isAngleScalable) //{ // GpLineGradient brush = new GpLineGradient(); // lastResult = GdiPlus.GdipCreateLineBrushFromRectWithAngleI(ref rect, // color1.ToArgb(), // color2.ToArgb(), // angle, // isAngleScalable, // WrapMode.WrapModeTile, // out brush); // SetNativeBrush(brush); //} #endregion GpStatus SetLinearColors(Color color1, Color color2) { return(SetStatus(GdiPlus.GdipSetLineColors((GpLineGradient)nativeBrush, color1.ToArgb(), color2.ToArgb()))); }
public GpStatus GetSurroundColors(Color[] colors, ref int count) { int count1; SetStatus(GdiPlus.GdipGetPathGradientSurroundColorCount( (GpPathGradient)nativeBrush, out count1)); if (lastResult != GpStatus.Ok) { return(lastResult); } if ((count < count1) || (count1 <= 0)) { return(SetStatus(GpStatus.InsufficientBuffer)); } int[] argbs = new int[count1]; SetStatus(GdiPlus.GdipGetPathGradientSurroundColorsWithCount( (GpPathGradient)nativeBrush, argbs, out count1)); if (lastResult == GpStatus.Ok) { for (int i = 0; i < count1; i++) { colors[i] = Color.FromArgb(argbs[i]); } count = count1; } return(lastResult); }
//public void DrawImage(ImagePlus image, // PointF[] destPoints, // float srcx, // float srcy, // float srcwidth, // float srcheight, // Unit srcUnit, // ImageAttributesPlus imageAttributes) //{ // SetStatus(GdiPlus.GdipDrawImagePointsRect(nativeGraphics, // image != null ? image.nativeImage // : null, // destPoints, destPoints.Length, // srcx, srcy, // srcwidth, // srcheight, // srcUnit, // imageAttributes != null // ? imageAttributes.nativeImageAttr // : new GpImageAttributes(), // IntPtr.Zero, // IntPtr.Zero)); //} //public void DrawImage(ImagePlus image, // int x, // int y, // int srcx, // int srcy, // int srcwidth, // int srcheight, // Unit srcUnit) //{ // SetStatus(GdiPlus.GdipDrawImagePointRectI(nativeGraphics, // image != null ? image.nativeImage // : null, // x, // y, // srcx, // srcy, // srcwidth, // srcheight, // srcUnit)); //} //public void DrawImage(ImagePlus image, // Rectangle destRect, // int srcx, // int srcy, // int srcwidth, // int srcheight, // Unit srcUnit, // ImageAttributesPlus imageAttributes) //{ // SetStatus(GdiPlus.GdipDrawImageRectRectI(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)); //} public void DrawImage(ImagePlus image, Point[] destPoints, int srcx, int srcy, int srcwidth, int srcheight, Unit srcUnit, ImageAttributesPlus imageAttributes) { SetStatus(GdiPlus.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)); }
public void DrawImage(ImagePlus image, RectangleF destRect, float srcx, float srcy, float srcwidth, float srcheight, Unit srcUnit, ImageAttributesPlus imageAttributes) { SetStatus(GdiPlus.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)); }
public void FillRectangles(BrushPlus brush, RectangleF[] rects) { SetStatus(GdiPlus.GdipFillRectangles(nativeGraphics, brush.nativeBrush, rects, rects.Length)); }
public Color GetColor() { int argb; SetStatus(GdiPlus.GdipGetPenColor(nativePen, out argb)); return(Color.FromArgb(argb)); }
public GraphicsPath(GraphicsPath path) { GpPath clonepath = null; SetStatus(GdiPlus.GdipClonePath(path.nativePath, out clonepath)); SetNativePath(clonepath); }
public void DrawLines(PenPlus pen, Point[] points) { SetStatus(GdiPlus.GdipDrawLinesI(nativeGraphics, pen.nativePen, points, points.Length)); }
public bool IsOutlineVisible(GraphicsPlus g, float x, float y, PenPlus pen) { bool ret; SetStatus(GdiPlus.GdipIsOutlineVisiblePathPoint(nativePath, x, y, pen.nativePen, g.nativeGraphics, out ret)); return(ret); }
public bool IsVisible(GraphicsPlus g, float x, float y) { bool ret; SetStatus(GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret)); return(ret); }
public bool IsVisible(GraphicsPlus g, int x, int y) { bool ret; GdiPlus.GdipIsVisiblePathPoint(nativePath, x, y, g.nativeGraphics, out ret); return(ret); }
public void AddBeziers(PointF[] points) { int count = points.Length; count -= (count - 4) % 3; SetStatus(GdiPlus.GdipAddPathBeziers(nativePath, points, count)); }
// Set/get line caps: start, end, and dash // Line cap and join APIs by using LineCap and LineJoin enums. public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap) { SetStatus(GdiPlus.GdipSetPenLineCap197819(nativePen, startCap, endCap, dashCap)); }
public PenPlus(Color color, float width) { Unit unit = Unit.UnitWorld; nativePen = null; lastResult = GdiPlus.GdipCreatePen1(color.ToArgb(), width, unit, out nativePen); }
public void DrawPath(PenPlus pen, GraphicsPath path) { SetStatus(GdiPlus.GdipDrawPath(nativeGraphics, pen != null ? pen.nativePen : null, path != null ? path.nativePath : null)); }
public RectangleF GetBounds(out Unit srcUnit) { RectangleF srcRect; SetStatus(GdiPlus.GdipGetImageBounds(nativeImage, out srcRect, out srcUnit)); return(srcRect); }
public float GetDashOffset() { float dashOffset; SetStatus(GdiPlus.GdipGetPenDashOffset(nativePen, out dashOffset)); return(dashOffset); }
public int GetPointCount() { int count = 0; SetStatus(GdiPlus.GdipGetPointCount(nativePath, out count)); return(count); }
public void Dispose() { if (nativeImage != IntPtr.Zero) { GdiPlus.GdipDisposeImage(nativeImage); nativeImage = null; } }
public GraphicsPath Clone() { GpPath clonepath = null; SetStatus(GdiPlus.GdipClonePath(nativePath, out clonepath)); return(new GraphicsPath(clonepath)); }
public DashStyle GetDashStyle() { DashStyle dashStyle; SetStatus(GdiPlus.GdipGetPenDashStyle(nativePen, out dashStyle)); return(dashStyle); }
private FillMode GetFillMode() { FillMode fillmode = FillMode.Alternate; SetStatus(GdiPlus.GdipGetPathFillMode(nativePath, out fillmode)); return(fillmode); }
public int GetDashPatternCount() { int count = 0; SetStatus(GdiPlus.GdipGetPenDashCount(nativePen, out count)); return(count); }
public void GetPhysicalDimension(out SizeF size) { float width, height; SetStatus(GdiPlus.GdipGetImageDimension(nativeImage, out width, out height)); size = new SizeF(width, height); }
public PenPlus Clone() { GpPen clonePen = null; lastResult = GdiPlus.GdipClonePen(nativePen, out clonePen); return(new PenPlus(clonePen, lastResult)); }
public System.Drawing.Imaging.PixelFormat GetPixelFormat() { System.Drawing.Imaging.PixelFormat format; SetStatus(GdiPlus.GdipGetImagePixelFormat(nativeImage, out format)); return(format); }
public float GetWidth() { float width; SetStatus(GdiPlus.GdipGetPenWidth(nativePen, out width)); return(width); }