Created by: X Posted May 19, 2008 Share Posted May 19, 2008 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? Quote Link to comment Share on other sites More sharing options...
BoltBait Posted May 19, 2008 Share Posted May 19, 2008 Drawing to the source surface is bad, mkay? ...like "crossing the streams" bad. Don't do it. If you've never written an effect before, you should probably start here: http://www.boltbait.com/pdn/codelab/help/overview.html If you have additional questions after reading that page (and any linked pages that look interesting), just post them. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.