public EdgeDisplay(LedEdge edge, LedSubarea pSub) { this.ledEdge = edge; this.ledSub = pSub; this.subSize = pSub.Size; this.circular = (this.subSize.Width + this.subSize.Height) * 2; this.circularCount = 0m; lock (LedGlobal.LedEdgeList[edge.Index]) { if (this.ledEdge.Enabled) { this.AlphaBitmap = new System.Drawing.Bitmap((this.subSize.Width + this.subSize.Height) * 2, edge.Height); this.EdgeBitmap = new System.Drawing.Bitmap((this.subSize.Width + this.subSize.Height) * 2, edge.Height); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(this.EdgeBitmap); System.Drawing.TextureBrush brush = new System.Drawing.TextureBrush(LedGlobal.LedEdgeList[edge.Index]); graphics.FillRectangle(brush, new System.Drawing.Rectangle(0, 0, this.EdgeBitmap.Width, this.EdgeBitmap.Height)); if (this.ledEdge.Mode != LedEdgeMode.Clockwise && this.ledEdge.Mode == LedEdgeMode.CounterClockwise) { this.EdgeBitmap = this.SetCornerAlpha(this.EdgeBitmap); } this.StaticBitmap = new System.Drawing.Bitmap(this.subSize.Width, this.subSize.Height); System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(this.StaticBitmap); graphics2.DrawImage(this.EdgeBitmap, new System.Drawing.Point(0, 0)); graphics2.TranslateTransform(0f, 0f); graphics2.RotateTransform(90f); graphics2.DrawImage(this.EdgeBitmap, new System.Drawing.Rectangle(0, -this.subSize.Width, this.subSize.Height, this.ledEdge.Height), new System.Drawing.Rectangle(this.subSize.Width, -1, this.subSize.Height, this.ledEdge.Height), System.Drawing.GraphicsUnit.Pixel); graphics2.DrawImage(this.EdgeBitmap, new System.Drawing.Rectangle(0, -this.subSize.Width, this.subSize.Height, this.ledEdge.Height), new System.Drawing.Rectangle(this.subSize.Width, 0, this.subSize.Height, this.ledEdge.Height), System.Drawing.GraphicsUnit.Pixel); graphics2.RotateTransform(90f); graphics2.DrawImage(this.EdgeBitmap, new System.Drawing.Rectangle(-this.subSize.Width, -this.subSize.Height, this.subSize.Width, this.ledEdge.Height), new System.Drawing.Rectangle(this.subSize.Width + this.subSize.Height, -1, this.subSize.Width, this.ledEdge.Height), System.Drawing.GraphicsUnit.Pixel); graphics2.RotateTransform(90f); graphics2.DrawImage(this.EdgeBitmap, new System.Drawing.Rectangle(-this.subSize.Height, 0, this.subSize.Height, this.ledEdge.Height), new System.Drawing.Rectangle(this.subSize.Width * 2 + this.subSize.Height, 0, this.subSize.Height, this.ledEdge.Height), System.Drawing.GraphicsUnit.Pixel); } } }
public EdgeDisplay(LedEdge edge, LedItem pItem) { this.ledEdge = edge; this.ledItem = pItem; this.subSize = new System.Drawing.Size(pItem.ParentPanel.Width, pItem.ParentPanel.Height); this.circular = (this.subSize.Width + this.subSize.Height) * 2; this.circularCount = 0m; if (this.ledEdge.Enabled) { this.AlphaBitmap = new System.Drawing.Bitmap((this.subSize.Width + this.subSize.Height) * 2, edge.Height); this.EdgeBitmap = new System.Drawing.Bitmap((this.subSize.Width + this.subSize.Height) * 2, edge.Height); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(this.EdgeBitmap); System.Drawing.TextureBrush brush = new System.Drawing.TextureBrush(LedGlobal.LedEdgeList[edge.Index]); graphics.FillRectangle(brush, new System.Drawing.Rectangle(0, 0, this.EdgeBitmap.Width, this.EdgeBitmap.Height)); if (this.ledEdge.Mode == LedEdgeMode.Static | this.ledEdge.Mode == LedEdgeMode.Blink) { this.EdgeBitmap = this.SetCornerAlpha(this.EdgeBitmap); this.SplitBitmapToItemEdge(this.EdgeBitmap); } } }