private void renderGear(Graphics g, Gear gear, Point origin) { if (g == null || gear == null) { return; } Pen pen = GearGraphics.GetGearItemBorderPen(gear.Grade); if (pen != null) { Point[] path = GearGraphics.GetIconBorderPath(origin.X, origin.Y - 32); g.DrawLines(pen, path); } g.DrawImage(Resource.Item_shadow, origin.X + 3, origin.Y - 6); if (gear.IconRaw.Bitmap != null) { g.DrawImage(gear.IconRaw.Bitmap, origin.X - gear.IconRaw.Origin.X, origin.Y - gear.IconRaw.Origin.Y); } if (gear.Cash) { /* * int value; * if (gear.Props.TryGetValue(GearPropType.royalSpecial, out value) && value > 0) * g.DrawImage(Resource.CashItem_label_0, origin.X + 20, origin.Y - 12); * else if (gear.Props.TryGetValue(GearPropType.masterSpecial, out value) && value > 0) * g.DrawImage(Resource.CashItem_label_3, origin.X + 20, origin.Y - 12); * else */ g.DrawImage(Resource.CashItem_0, origin.X + 20, origin.Y - 12); } }
private void drawGearIcon(Gear gear, Graphics g, int x, int y) { if (gear == null || g == null) { return; } if (gear.State == GearState.disable) { g.DrawImage(Resource.Equip_character_disabled, x, y); } Pen pen = GearGraphics.GetGearItemBorderPen(gear.Grade); if (pen != null) { Point[] path = GearGraphics.GetIconBorderPath(x, y); g.DrawLines(pen, path); } g.DrawImage(gear.Icon.Bitmap, x - gear.Icon.Origin.X, y + 32 - gear.Icon.Origin.Y); }
private void renderGear(Graphics g, Gear gear, Point origin) { if (g == null || gear == null) { return; } Pen pen = GearGraphics.GetGearItemBorderPen(gear.Grade); if (pen != null) { Point[] path = GearGraphics.GetIconBorderPath(origin.X, origin.Y - 32); g.DrawLines(pen, path); } g.DrawImage(Resource.Item_shadow, origin.X + 3, origin.Y - 6); if (gear.IconRaw.Bitmap != null) { g.DrawImage(gear.IconRaw.Bitmap, origin.X - gear.IconRaw.Origin.X, origin.Y - gear.IconRaw.Origin.Y); } if (gear.Cash) { g.DrawImage(Resource.CashItem_0, origin.X + 20, origin.Y - 12); } }
public override Bitmap Render() { if (this.gear == null) { return(null); } int picHeight, iconY, picHeight2, picHeight3; Bitmap left = renderBase(out picHeight, out iconY); Bitmap add = renderAddition(out picHeight2); Bitmap set = renderSetItem(out picHeight3); //整合图像 int width = 252; if (add != null) { width += 252; } if (set != null) { width += 252; } Bitmap tooltip = new Bitmap(width, Math.Max(Math.Max(picHeight, picHeight2), picHeight3)); Graphics g = Graphics.FromImage(tooltip); bool epic = gear.Epic; width = 0; //绘制主图 if (left != null) { g.FillRectangle(epic ? GearGraphics.EpicGearBackBrush : GearGraphics.GearBackBrush, 2, 2, 248, picHeight - 4); g.CompositingMode = CompositingMode.SourceCopy; g.FillRectangle(epic ? GearGraphics.EpicGearIconBackBrush : GearGraphics.GearIconBackBrush, 14, iconY, 68, 68); g.CompositingMode = CompositingMode.SourceOver; g.DrawImage(left, 0, 0, new Rectangle(0, 0, 252, picHeight - 2), GraphicsUnit.Pixel); //绘制外边框 g.DrawLines(epic ? GearGraphics.EpicGearBackPen : GearGraphics.GearBackPen, GearGraphics.GetBorderPath(0, 252, picHeight)); //绘制等级边框 Pen pen = GearGraphics.GetGearItemBorderPen(gear.Grade); if (pen != null) { g.DrawLines(pen, getRankBorderPath(picHeight)); } width += 252; } //绘制addition if (add != null) { //底色和边框 g.FillRectangle(epic ? GearGraphics.EpicGearBackBrush : GearGraphics.GearBackBrush, width + 2, 2, 248, picHeight - 4); g.DrawLines(epic ? GearGraphics.EpicGearBackPen : GearGraphics.GearBackPen, GearGraphics.GetBorderPath(width, 252, picHeight)); //复制原图 g.DrawImage(add, width, 0, new Rectangle(0, 0, 252, picHeight2), GraphicsUnit.Pixel); add.Dispose(); width += 252; } //绘制setitem if (set != null) { //底色和边框 g.FillRectangle(GearGraphics.GearBackBrush, width + 2, 2, 248, picHeight3 - 4); g.DrawLines(GearGraphics.GearBackPen, GearGraphics.GetBorderPath(width, 252, picHeight3)); //复制原图 g.DrawImage(set, width, 0, new Rectangle(0, 0, 252, picHeight3), GraphicsUnit.Pixel); set.Dispose(); width += 252; } // GearGraphics.DrawGearDetailNumber(g, 2, 2, gear.ItemID.ToString("d8"), true); g.Dispose(); return(tooltip); }