/// <summary> 清除整个绘图面并以指定背景色填充 /// </summary> /// <param name="color">System.Drawing.Color 结构,它表示绘图面的背景色</param> public void Clear(Color color) { //this.DxRenderInfos.Clear(); if (color == Color.Transparent) { this.target.RenderTarget.Clear(DxConvert.ToColor4(color)); if (this.target is DUIWindowRenderTarget dUIWindowRenderTarget) { Control control = Control.FromHandle(dUIWindowRenderTarget.Handle); if (control != null) { using (Graphics ownerGraphics = Graphics.FromHwnd(dUIWindowRenderTarget.Handle)) using (DUIImage image = new DUIImage(control.ClientSize.Width, control.ClientSize.Height)) using (Graphics targetGraphics = Graphics.FromImage(image)) { IntPtr ownerDC = ownerGraphics.GetHdc(); IntPtr targetDC = targetGraphics.GetHdc(); DirectUI.Win32.NativeMethods.BitBlt(targetDC, 0, 0, control.ClientSize.Width, control.ClientSize.Height, ownerDC, 0, 0, 13369376); ownerGraphics.ReleaseHdc(ownerDC); targetGraphics.ReleaseHdc(targetDC); image.RenderTarget = this.target; this.target.RenderTarget.DrawBitmap(image, DxConvert.ToRectF(0, 0, control.ClientSize.Width, control.ClientSize.Height), 1, SharpDX.Direct2D1.BitmapInterpolationMode.NearestNeighbor, DxConvert.ToRectF(0, 0, image.Width, image.Height)); } } } } else { this.target.RenderTarget.Clear(DxConvert.ToColor4(color)); } }
public void DrawImage(DUIImage image, PointF[] polygon, GraphicsUnit srcUnit, float opacity) { if (image == null || polygon.Length < 3) { return; } this.iDUIGraphics.DrawImage(image, polygon, srcUnit, opacity); }
public void DrawImage(DUIImage image, PointF[] destTriangle, PointF[] srcTriangle, GraphicsUnit srcUnit, float opacity) { if (image == null || destTriangle.Length != 3 || srcTriangle.Length != 3) { return; } this.iDUIGraphics.DrawImage(image, destTriangle, srcTriangle, srcUnit, opacity); }
public void DrawImage(DUIImage image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, float opacity) { if (image == null || destRect.Width == 0 || destRect.Height == 0 || srcRect.Width == 0 || srcRect.Height == 0) { return; } this.iDUIGraphics.DrawImage(image, destRect, srcRect, srcUnit, opacity); }
public void DrawImage(DUIImage image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, float opacity) { ColorMatrix clrMatrix = new ColorMatrix(new float[][] { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new float[] { 0, 0, 0, (float)opacity, 0 }, new float[] { 0, 0, 0, 0, 1 } }); ImageAttributes imgAttributes = new ImageAttributes(); imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);//设置图像的颜色属性 this.graphics.DrawImage(image, Rectangle.Ceiling(destRect), srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, GraphicsUnit.Pixel, imgAttributes); //this.graphics.DrawImage(image, destRect, srcRect, GraphicsUnit.Pixel); }
public void DrawImage(DUIImage image, PointF[] polygon, GraphicsUnit srcUnit, float opacity) { ColorMatrix clrMatrix = new ColorMatrix(new float[][] { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new float[] { 0, 0, 0, (float)opacity, 0 }, new float[] { 0, 0, 0, 0, 1 } }); ImageAttributes imgAttributes = new ImageAttributes(); imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);//设置图像的颜色属性 using (TextureBrush tb = new TextureBrush(image, new Rectangle(0, 0, image.Width, image.Height), imgAttributes)) { tb.WrapMode = WrapMode.Clamp; this.graphics.FillPolygon(tb, polygon); } }
public void DrawImage(DUIImage image, PointF[] polygon, GraphicsUnit srcUnit, float opacity) { image.RenderTarget = this.target; using (DirectUI.Common.DUIBitmapBrush dbs = new DirectUI.Common.DUIBitmapBrush(image, DUIExtendMode.Clamp, opacity)) using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory)) using (SharpDX.Direct2D1.GeometrySink gs1 = pathGeometry.Open()) { dbs.RenderTarget = this.target; gs1.SetFillMode(SharpDX.Direct2D1.FillMode.Alternate); gs1.BeginFigure(DxConvert.ToVector2(polygon[0]), SharpDX.Direct2D1.FigureBegin.Filled); for (int i = 1; i < polygon.Length; i++) { gs1.AddLine(DxConvert.ToVector2(polygon[i])); } gs1.EndFigure(SharpDX.Direct2D1.FigureEnd.Closed); gs1.Close(); this.target.RenderTarget.FillGeometry(pathGeometry, dbs); } }
public void DrawImage(DUIImage image, PointF[] destTriangle, PointF[] srcTriangle, GraphicsUnit srcUnit, float opacity) { PointF t1 = destTriangle[0]; PointF t2 = destTriangle[1]; PointF t3 = destTriangle[2]; image.RenderTarget = this.target; using (DirectUI.Common.DUIBitmapBrush dbs = new DirectUI.Common.DUIBitmapBrush(image, DUIExtendMode.Clamp, opacity)) using (SharpDX.Direct2D1.PathGeometry pathGeometry = new SharpDX.Direct2D1.PathGeometry(this.target.RenderTarget.Factory)) using (SharpDX.Direct2D1.GeometrySink gs1 = pathGeometry.Open()) { dbs.RenderTarget = this.target; gs1.SetFillMode(SharpDX.Direct2D1.FillMode.Alternate); gs1.BeginFigure(DxConvert.ToVector2(t1), SharpDX.Direct2D1.FigureBegin.Filled); gs1.AddLine(DxConvert.ToVector2(t2)); gs1.AddLine(DxConvert.ToVector2(t3)); gs1.EndFigure(SharpDX.Direct2D1.FigureEnd.Closed); gs1.Close(); dbs.Transform = MatrixTools.ThreePointsAffine(srcTriangle, destTriangle); this.target.RenderTarget.FillGeometry(pathGeometry, dbs); } }
public void DrawImage(DUIImage image, float x, float y) { this.DrawImage(image, x, y, 1); }
public void DrawImage(DUIImage image, PointF point) { this.DrawImage(image, point.X, point.Y); }
public void DrawImage(DUIImage image, PointF point, float opacity) { this.DrawImage(image, point.X, point.Y, opacity); }
public void DrawImage(DUIImage image, Point[] polygon, GraphicsUnit srcUnit, float opacity) { this.DrawImage(image, polygon.Select(p => (PointF)p).ToArray(), srcUnit, opacity); }
public void DrawImage(DUIImage image, Point[] polygon, float opacity) { this.DrawImage(image, polygon, GraphicsUnit.Pixel, opacity); }
public void DrawImage(DUIImage image, Point[] polygon) { this.DrawImage(image, polygon, GraphicsUnit.Pixel, 1); }
public void DrawImage(DUIImage image, RectangleF rect) { this.DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); }
public void DrawImage(DUIImage image, PointF[] destTriangle, PointF[] srcTriangle) { this.DrawImage(image, destTriangle, srcTriangle, GraphicsUnit.Pixel, 1); }
public DUIBitmapBrush(Image image, DUIExtendMode dUIExtendMode = DUIExtendMode.Wrap, float opacity = 1F) : this(DUIImage.FromImage(image), dUIExtendMode, opacity) { }
public void DrawImage(DUIImage image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, float opacity) { this.DrawImage(image, (RectangleF)destRect, (RectangleF)srcRect, srcUnit, opacity); }
public void DrawImage(DUIImage image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit) { this.DrawImage(image, destRect, srcRect, srcUnit, 1); }
public void DrawImage(DUIImage image, RectangleF rect, float opacity) { this.DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height, opacity); }
public void DrawImage(DUIImage image, int x, int y, float opacity) { this.DrawImage(image, (float)x, (float)y, opacity); }
public void DrawImage(DUIImage image, int x, int y, int width, int height, float opacity) { this.DrawImage(image, (float)x, (float)y, (float)width, (float)height, opacity); }
public void DrawImage(DUIImage image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, float opacity) { image.RenderTarget = this.target; this.target.RenderTarget.DrawBitmap(image, DxConvert.ToRectF(destRect), opacity, SharpDX.Direct2D1.BitmapInterpolationMode.NearestNeighbor, DxConvert.ToRectF(srcRect)); }
public void DrawImage(DUIImage image, float x, float y, float width, float height, float opacity) { this.DrawImage(image, new RectangleF(x, y, width, height), new RectangleF(0, 0, image.Width, image.Height), GraphicsUnit.Pixel, opacity); }
public void DrawImage(DUIImage image, Point[] destTriangle, Point[] srcTriangle, GraphicsUnit srcUnit, float opacity) { this.DrawImage(image, destTriangle.Select(p => (PointF)p).ToArray(), srcTriangle.Select(p => (PointF)p).ToArray(), srcUnit, opacity); }
public DUIBitmapBrush(DUIImage image, DUIExtendMode dUIExtendMode = DUIExtendMode.Wrap, float opacity = 1F) { this.image = image; this.dUIExtendMode = dUIExtendMode; this.opacity = opacity; }