public void GetBounds(out GpRectF rect) { rect.X = X; rect.Y = Y; rect.Width = Width; rect.Height = Height; }
public bool IntersectsWith(GpRectF rect) { return(GetLeft() < rect.GetRight() && GetTop() < rect.GetBottom() && GetRight() > rect.GetLeft() && GetBottom() > rect.GetTop()); }
public bool Equals(GpRectF rect) { return(X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height); }
GetBounds(out GpRectF rect, GraphicsPlus g) { return(SetStatus(NativeMethods.GdipGetRegionBounds(nativeRegion, g.nativeGraphics, out rect))); }
public GpStatus AddArc(GpRectF rect, float startAngle, float sweepAngle) { return AddArc(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); }
public GpStatus AddPie(GpRectF rect, float startAngle, float sweepAngle) { return(AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)); }
// Once this is called, the resultant path is made of line segments and // the original path information is lost. When matrix is null, the // identity matrix is assumed. public GpStatus Warp(GpPointF[] destPoints, GpRectF srcRect, Matrix matrix, WarpMode warpMode, float flatness) { GpMatrix nativeMatrix = new GpMatrix(); if (matrix != null) { nativeMatrix = matrix.nativeMatrix; } return(SetStatus(NativeMethods.GdipWarpPath( nativePath, nativeMatrix, destPoints, destPoints.Length, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode, flatness))); }
RegionPlus(GpRectF rect) { GpRegion region = new GpRegion(); lastResult = NativeMethods.GdipCreateRegionRect(ref rect, out region); SetNativeRegion(region); }
Matrix(GpRectF rect, GpPointF[] dstplg) { GpMatrix matrix; lastResult = NativeMethods.GdipCreateMatrix3(rect, dstplg, out matrix); SetNativeMatrix(matrix); }
Matrix( GpRectF rect, GpPointF[] dstplg) { GpMatrix matrix; lastResult = NativeMethods.GdipCreateMatrix3(rect, dstplg, out matrix); SetNativeMatrix(matrix); }
private void Draw(Graphics graphics, GraphicsPlus g) { StringFormat sf = new StringFormat(); sf.LineAlignment = sf.Alignment = System.Drawing.StringAlignment.Center; int deltaH = ClientRectangle.Height / 8; GpRectF rc = new GpRectF(0, 0, ClientRectangle.Width, deltaH); RectangleF rcf = new RectangleF(0, 0, ClientRectangle.Width, deltaH); using (SolidBrush brText = new SolidBrush(Color.Black)) using (Font fnt = new Font("Tahoma", 9, System.Drawing.FontStyle.Bold)) { penSolid.SetWidth(15); g.DrawLine(penSolid, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10); graphics.DrawString("Solid with caps", fnt, brText, rcf, sf); rcf.Y += deltaH; rc.Offset(0, deltaH); SmoothingMode mode = g.GetSmoothingMode(); g.SetSmoothingMode(SmoothingMode.SmoothingModeAntiAlias); penSolid.SetColor(Color.Blue); g.DrawLine(penSolid, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10); graphics.DrawString("Solid with caps and anitalising", fnt, brText, rcf, sf); rcf.Y += deltaH; rc.Offset(0, deltaH); g.DrawLine(penHatch, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10); graphics.DrawString("Hatched", fnt, brText, rcf, sf); rcf.Y += deltaH; rc.Offset(0, deltaH); penSolidTrans.SetWidth(20); penSolidTrans.SetLineCap(LineCap.LineCapRound, LineCap.LineCapDiamondAnchor, DashCap.DashCapRound); graphics.DrawString("Solid with transparency", fnt, brText, rcf, sf); g.DrawLine(penSolidTrans, 15, rcf.Top + 10, rc.Width - 30, rcf.Top + 10); rcf.Y += deltaH; rc.Offset(0, deltaH); g.SetSmoothingMode(SmoothingMode.SmoothingModeAntiAlias); brText.Color = Color.White; g.DrawLine(penSolidCustomCap, 15, rcf.Top + 15, rc.Width - 50, rcf.Top + 15); graphics.DrawString("Custom cap", fnt, brText, rcf, sf); rcf.Y += deltaH; rc.Offset(0, deltaH); g.SetSmoothingMode(mode); brText.Color = Color.Gray; g.DrawLine(penDash, 5, rcf.Top + 10, rc.Width - 10, rcf.Top + 10); graphics.DrawString("Dash (round)", fnt, brText, rcf, sf); rcf.Y += deltaH; rc.Offset(0, deltaH); brText.Color = Color.White; g.DrawLine(penGradient, 15, rcf.Top + 20, rc.Width - 30, rcf.Top + 20); graphics.DrawString("Gradient brush-based", fnt, brText, rcf, sf); rcf.Y += deltaH; rc.Offset(0, deltaH); } }
public GpStatus AddRectangle(GpRectF rect) { return(SetStatus(NativeMethods.GdipAddPathPolygon(nativePath, new GpPointF[] { new GpPointF(rect.X, rect.Y), new GpPointF(rect.X, rect.Y + rect.Height), new GpPointF(rect.X + rect.Width, rect.Y + rect.Height), new GpPointF(rect.X + rect.Width, rect.Y), }, 4))); }
IsVisible(GpRectF rect, GraphicsPlus g) { bool booln = false; SetStatus(NativeMethods.GdipIsVisibleRegionRect(nativeRegion, rect.X, rect.Y, rect.Width, rect.Height, (g == null) ? new GpGraphics() : g.nativeGraphics, out booln)); return(booln); }
static public bool Union(out GpRectF c, GpRectF a, GpRectF b) { float right = Math.Max(a.GetRight(), b.GetRight()); float bottom = Math.Max(a.GetBottom(), b.GetBottom()); float left = Math.Min(a.GetLeft(), b.GetLeft()); float top = Math.Min(a.GetTop(), b.GetTop()); c.X = left; c.Y = top; c.Width = right - left; c.Height = bottom - top; return(!c.IsEmptyArea()); }
public LinearGradientBrush(GpRectF rect, Color color1, Color color2, LinearGradientMode mode) { GpLineGradient brush; lastResult = NativeMethods.GdipCreateLineBrushFromRect(ref rect, color1.ToArgb(), color2.ToArgb(), mode, WrapMode.WrapModeTile, out brush); SetNativeBrush(brush); }
// 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); }
public TextureBrushPlus(ImagePlus image, GpRectF dstRect, ImageAttributesPlus imageAttributes) { GpTexture texture; lastResult = NativeMethods.GdipCreateTextureIA( image.nativeImage, (imageAttributes != null) ? imageAttributes.nativeImageAttr : new GpImageAttributes(), dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out texture ); SetNativeBrush(texture); }
LinearGradientBrush(GpRectF rect, Color color1, Color color2, float angle, bool isAngleScalable) { GpLineGradient brush; lastResult = NativeMethods.GdipCreateLineBrushFromRectWithAngle(ref rect, color1.ToArgb(), color2.ToArgb(), angle, isAngleScalable, WrapMode.WrapModeTile, out brush); SetNativeBrush(brush); }
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)); }
public GpStatus DrawEllipse(PenPlus pen, GpRectF rect) { return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); }
public GpStatus FillRectangles(BrushPlus brush, GpRectF[] rects) { return SetStatus(NativeMethods.GdipFillRectangles(nativeGraphics, brush.nativeBrush, rects, rects.Length)); }
public GpStatus FillPie(BrushPlus brush, GpRectF rect, float startAngle, float sweepAngle) { return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); }
GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg, out GpMatrix matrix);
GdipDrawRectangles(GpGraphics graphics, GpPen pen, GpRectF[] rects, int count);
GdipGetRegionBounds(GpRegion region, GpGraphics graphics, out GpRectF rect);
public static extern GpStatus GdipCreateMatrix3(GpRectF rect, GpPointF[] dstplg, out GpMatrix matrix);
public GpStatus GetBounds(out GpRectF srcRect, out Unit srcUnit) { return(SetStatus(NativeMethods.GdipGetImageBounds(nativeImage, out srcRect, out srcUnit))); }
GdipAddPathString(GpPath path, string str, int length, GpFontFamily family, int style, float emSize, GpRectF layoutRect, GpStringFormat format);
GdipGetClipBounds(GpGraphics graphics, out GpRectF rect);
public bool Contains(GpRectF rect) { return((X <= rect.X) && (rect.GetRight() <= GetRight()) && (Y <= rect.Y) && (rect.GetBottom() <= GetBottom())); }
public GpStatus GetRectangle(out GpRectF rect) { rect = new GpRectF(); return(SetStatus(NativeMethods.GdipGetPathGradientRect( (GpPathGradient)nativeBrush, out rect))); }
public bool Intersect(GpRectF rect) { return(Intersect(out this, this, rect)); }
Complement(GpRectF rect) { return(SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect, CombineMode.CombineModeComplement))); }
public GpStatus DrawRectangles(PenPlus pen, GpRectF[] rects) { return SetStatus(NativeMethods.GdipDrawRectangles(nativeGraphics, pen.nativePen, rects, rects.Length)); }
Exclude(GpRectF rect) { return(SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect, CombineMode.CombineModeExclude))); }
//GpStatus Clear( Color color) //{ // return SetStatus(NativeMethods.GdipGraphicsPlusClear( // nativeGraphics, // color.ToArgb())); //} public GpStatus FillRectangle(BrushPlus brush, GpRectF rect) { return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height); }
Complement(GpRectF rect) { return SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect, CombineMode.CombineModeComplement)); }
public GpStatus DrawArc(PenPlus pen, GpRectF rect, float startAngle, float sweepAngle) { return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); }
IsVisible(GpRectF rect, GraphicsPlus g) { bool booln = false; SetStatus(NativeMethods.GdipIsVisibleRegionRect(nativeRegion, rect.X, rect.Y, rect.Width, rect.Height, (g == null) ? new GpGraphics() : g.nativeGraphics, out booln)); return booln; }
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); }
GdipCombineRegionRect(GpRegion region, ref GpRectF rect, CombineMode combineMode);
GdipAddPathRectangles(GpPath path, GpRectF[] rects, int count);
public bool IntersectsWith(GpRectF rect) { return (GetLeft() < rect.GetRight() && GetTop() < rect.GetBottom() && GetRight() > rect.GetLeft() && GetBottom() > rect.GetTop()); }
GdipGetPathWorldBounds(GpPath path, GpRectF[] bounds, out GpMatrix matrix, out GpPen pen);
static public bool Union(out GpRectF c, GpRectF a, GpRectF b) { float right = Math.Max(a.GetRight(), b.GetRight()); float bottom = Math.Max(a.GetBottom(), b.GetBottom()); float left = Math.Min(a.GetLeft(), b.GetLeft()); float top = Math.Min(a.GetTop(), b.GetTop()); c.X = left; c.Y = top; c.Width = right - left; c.Height = bottom - top; return !c.IsEmptyArea(); }
GdipGetImageBounds(GpImage image, out GpRectF srcRect, out Unit srcUnit);
GdipFillRectangles(GpGraphics graphics, GpBrush brush, GpRectF[] rects, int count);
public GpStatus AddEllipse(GpRectF rect) { return(AddEllipse(rect.X, rect.Y, rect.Width, rect.Height)); }
GpStatus GetRectangle(out GpRectF rect) { return(SetStatus(NativeMethods.GdipGetLineRect((GpLineGradient)nativeBrush, out rect))); }
public bool Equals(GpRectF rect) { return X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height; }
Exclude(GpRectF rect) { return SetStatus(NativeMethods.GdipCombineRegionRect(nativeRegion, ref rect, CombineMode.CombineModeExclude)); }
public bool Contains(GpRectF rect) { return (X <= rect.X) && (rect.GetRight() <= GetRight()) && (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); }
GetBounds(out GpRectF rect, GraphicsPlus g) { return SetStatus(NativeMethods.GdipGetRegionBounds(nativeRegion, g.nativeGraphics, out rect)); }
public bool Intersect(GpRectF rect) { return Intersect(out this, this, rect); }
GetRegionScans( Matrix matrix, GpRectF[] rects, out int count) { count = rects.Length; return SetStatus(NativeMethods.GdipGetRegionScans(nativeRegion, rects, ref count, matrix.nativeMatrix)); }
GdipCreateRegionRect(ref GpRectF rect, out GpRegion region);