Jump to content

Created by: X

Newbies
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Created by: X

  1. i am trying to copy pixels from the "this.EnvironmentParameters.SourceSurface" using the fallowing code but the resulting image does not contain any of the expected pixels ... //nudHeight and nudWidth are numeric updown controls // info.BlockImage is a "Image" type //lbBlocks is a owner drawn listbox control so I can preview the block that was made //imageSource is set to "this.EnvironmentParameters.SourceSurface" private void button1_Click(object sender, EventArgs e) { InfoItem info = new InfoItem(); info.BlockImage = new Bitmap((int)this.nudWidth.Value, (int)this.nudHeight.Value, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(info.BlockImage); for (int idy = 0; idy < this.imageSource.Height; idy++) { for (int idx = 0; idx < this.imageSource.Width; idx++) { ColorBgra col; col = this.imageSource.GetPoint(idx, idy); g.DrawLine(new Pen(Color.FromArgb(col.A, col.R, col.G, col.), idx, idy, idx, idy); // g.DrawLine(new Pen(Color.FromArgb(Math.Abs(col.A - 255), col.R, col.G, col.), idx, idy, idx, idy); } } g = null; info.Name = "First block"; // this.blocks.Add(info); this.lbBlocks.Items.Add(info); } ... this is my first time trying to create a paint.net effect so bear with me. I am assuming that "this.EnvironmentParameters.SourceSurface" refers the the image. So my question really is how do I grab pixels or a rectangle of pixels and store them in a regular System.Drawing.Image obj?
×
×
  • Create New...