public ImagePicker() { InitializeComponent(); TexRefData = new ReferTextureData(); TexKey = ""; }
public ReferTexture(ReferTextureData trd) { this.Color = new Color(trd.Color.R, trd.Color.G, trd.Color.B, trd.Color.A); this.AddrModeX = trd.AdrModX; this.AddrModeY = trd.AdrModY; this.SourceRect = new Rectangle(trd.SrcRect.X, trd.SrcRect.Y, trd.SrcRect.Width, trd.SrcRect.Height); this.texture = (Texture2D)GameService.Instance.QueryModule<ContentModule>().GetContent(ContentType.Texture, trd.UID); this.name = trd.Key; }
private void ImagePicker_Click(object sender, EventArgs e) { PickImageForm ptf = new PickImageForm(); DialogResult dr = ptf.ShowDialog(); if (dr == DialogResult.OK) { TexRefData = ptf.TexRefData; Bitmap srcImg = getSourceImage(ptf.TexRefData.UID); Bitmap ssrImg = new Bitmap(ptf.TexRefData.SrcRect.Width, ptf.TexRefData.SrcRect.Height); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(ssrImg); g.DrawImage(srcImg, ptf.TexRefData.SrcRect); this.Image = ssrImg; TexKey = ptf.TexRefData.Key; } }