/// <summary> /// 创建一个图形实例 /// </summary> /// <param name="center">图形的中心点</param> /// <param name="type">图形类型</param> /// <returns></returns> public static GraphicsBase Create(Point center, GraphicsType type) { switch (type) { case GraphicsType.Ellipse: { return(new GraphicsEllipse() { Width = GraphicsRectangle.DefaultWidth, Height = GraphicsRectangle.DefaultHeight, Point1X = center.X - GraphicsRectangle.DefaultWidth / 2, Point1Y = center.Y - GraphicsRectangle.DefaultHeight / 2 }); } case GraphicsType.Rectangle: { return(new GraphicsRectangle() { Width = GraphicsRectangle.DefaultWidth, Height = GraphicsRectangle.DefaultHeight, Point1X = center.X - GraphicsRectangle.DefaultWidth / 2, Point1Y = center.Y - GraphicsRectangle.DefaultHeight / 2 }); } default: throw new NotImplementedException(); } }
public void AddGraphics(GraphicsType type, System.Collections.ArrayList arraylist) { CustomClass.Cell newCell = new EasyPhoto.CustomClass.Cell(type, this.baseImage, arraylist); this.arrayList.Add(newCell); Graphics backg = Graphics.FromImage(backImage); newCell.CellPaint(backg); this.OnPaint(null); //this.Parent.Invalidate(); }
/** * */ private static IGraphicsElement CreateElement(GraphicsType type) { return(type switch { GraphicsType.Ellipse => new Ellipse(), GraphicsType.Line => new Line(), GraphicsType.Polygon => new Polygon(), GraphicsType.Rectangle => new Rectangle(), GraphicsType.Triangle => new Triangle(), _ => throw new Exception("Error creating graphics element") });
public static System.Drawing.Drawing2D.GraphicsPath GenerateGraphicsPath(GraphicsType type, System.Drawing.Rectangle rectangle, Direction direction = Direction.NULL) { if (type == GraphicsType.Triangle && direction != Direction.NULL) { return(GenerateTrianglePath(rectangle, direction)); } else if (type == GraphicsType.Square) { return(GenerateSquarePath(rectangle)); } return(null); }
public override void Test(GraphicsType graphicsType) { Console.WriteLine("[{0}_{1}]", Title, graphicsType); int time = 0; var option = new EngineOption { IsFullScreen = false, GraphicsType = graphicsType, IsMultithreadingMode = true, }; var result = Engine.Initialize(Title, 640, 480, option); if (!result) { throw new Exception("ACEの初期化に失敗しました。"); } OnStart(); while (Engine.DoEvents()) { OnUpdating(); Engine.Update(); OnUpdated(); if (time == TimeForExit) { if (!Directory.Exists(PathOfSS)) { Directory.CreateDirectory(PathOfSS); } var path = string.Format("{0}/{1}_{2}.png", PathOfSS, Title, graphicsType); Engine.TakeScreenshot(path); } else if (time == TimeForExit + 2) { break; } ++time; } OnFinish(); Engine.Terminate(); }
void Init(int width, int height, DrawType drawType = DrawType.NOIMAGE) { cacheRootScLayer = rootScLayer; this.drawType = drawType; this.graphicsType = GraphicsType.D2D; if (drawType == DrawType.NOIMAGE) { control = new ScLayerControl(this); control.Width = width; control.Height = height; control.Dock = DockStyle.Fill; } else { bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); var wicFactory = new ImagingFactory(); wicBitmap = new WicBitmap(wicFactory, width, height, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); } GraphicsType = graphicsType; D2DGraphics d2dGraph = (D2DGraphics)graphics; Size2 pixelSize = d2dGraph.renderTarget.PixelSize; Size2F logicSize = d2dGraph.renderTarget.Size; sizeScale = new SizeF(logicSize.Width / pixelSize.Width, logicSize.Height / pixelSize.Height); rootScLayer.ScMgr = this; rootScLayer.Dock = ScDockStyle.Fill; rootScLayer.Name = "__root__"; rootScLayer.D2DPaint += RootScControl_D2DPaint; rootParent = new ScLayer(this); rootParent.DirectionRect = rootScLayer.DirectionRect; rootParent.DrawBox = rootScLayer.DirectionRect; rootParent.Add(rootScLayer); RegControlEvent(); }
void Init(UpdateLayerFrm form) { cacheRootScLayer = rootScLayer; drawType = DrawType.IMAGE; controlType = ControlType.UPDATELAYERFORM; form.scMgr = this; control = form; bitmap = new Bitmap(control.Width, control.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); var wicFactory = new ImagingFactory(); wicBitmap = new WicBitmap( wicFactory, control.Width, control.Height, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); form.bitmap = bitmap; this.graphicsType = GraphicsType.D2D; GraphicsType = GraphicsType.D2D; D2DGraphics d2dGraph = (D2DGraphics)graphics; Size2 pixelSize = d2dGraph.renderTarget.PixelSize; Size2F logicSize = d2dGraph.renderTarget.Size; sizeScale = new SizeF(logicSize.Width / pixelSize.Width, logicSize.Height / pixelSize.Height); rootScLayer.ScMgr = this; rootScLayer.Dock = ScDockStyle.Fill; rootScLayer.Name = "__root__"; rootScLayer.D2DPaint += RootScControl_D2DPaint; rootParent = new ScLayer(this); rootParent.DirectionRect = rootScLayer.DirectionRect; rootParent.DrawBox = rootScLayer.DirectionRect; rootParent.Add(rootScLayer); RegControlEvent(); }
public ScMgr(int width, int height, GraphicsType graphicsType = GraphicsType.D2D, DrawType drawType = DrawType.NOIMAGE) { cacheRootScLayer = rootScLayer; this.drawType = drawType; this.graphicsType = graphicsType; if (drawType == DrawType.NOIMAGE) { control = new ScLayerControl(this); control.Width = width; control.Height = height; } else { bitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); if (graphicsType == GraphicsType.D2D) { var wicFactory = new ImagingFactory(); wicBitmap = new WicBitmap(wicFactory, width, height, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); } } GraphicsType = graphicsType; rootScLayer.ScMgr = this; rootScLayer.Dock = ScDockStyle.Fill; rootScLayer.Name = "__root__"; rootScLayer.D2DPaint += RootScControl_D2DPaint; rootParent = new ScLayer(this); rootParent.Add(rootScLayer); RegControlEvent(); }
public ScMgr(UpdateLayerFrm form, GraphicsType graphicsType = GraphicsType.D2D) { cacheRootScLayer = rootScLayer; drawType = DrawType.IMAGE; controlType = ControlType.UPDATELAYERFORM; form.scMgr = this; control = form; bitmap = new Bitmap(control.Width, control.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); if (graphicsType == GraphicsType.D2D) { var wicFactory = new ImagingFactory(); wicBitmap = new WicBitmap(wicFactory, control.Width, control.Height, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); } form.bitmap = bitmap; this.graphicsType = graphicsType; GraphicsType = graphicsType; rootScLayer.ScMgr = this; rootScLayer.Dock = ScDockStyle.Fill; rootScLayer.Width = control.Width; rootScLayer.Height = control.Height; rootScLayer.D2DPaint += RootScControl_D2DPaint; rootParent = new ScLayer(this); rootParent.DirectionRect = rootScLayer.DirectionRect; rootParent.DrawBox = rootScLayer.DirectionRect; rootParent.Add(rootScLayer); rootScLayer.Layout(); RegControlEvent(); }
public void ChangeGraphics(GraphicsType graphics) { _settingsController.Graphics = graphics; QualitySettings.SetQualityLevel((int)graphics); OnGraphicChange?.Invoke(); }
/** * <summary>Creates a graphics element of a given type</summary> * <param name="type">Type of graphics element to be made</param> */ public IGraphicsElement Create(GraphicsType type) { return(CreateElement(type)); }
public void LoadSettingsData(SettingsLoadObject data) { Language = EnumParse.ParseStringToEnum <LanguageType>(data.language); Graphics = EnumParse.ParseStringToEnum <GraphicsType>(data.graphics); }