Image Processing - problem with copying data
-
Hi, I would like to generate a bigger ouptut texture from the small sample. I lock bits and copy them to byte array. Next I copy bytes to the output byte array and again lock bits and create output Bitmap. Everything works properly when OutputImage.Width % 4 = 0, if output image width (in pixels) is diffrent than 0 I get strange image! I tryed to make something with PixelFormat, but it didn't give any effects. thanks for any help :)
-
Hi, I would like to generate a bigger ouptut texture from the small sample. I lock bits and copy them to byte array. Next I copy bytes to the output byte array and again lock bits and create output Bitmap. Everything works properly when OutputImage.Width % 4 = 0, if output image width (in pixels) is diffrent than 0 I get strange image! I tryed to make something with PixelFormat, but it didn't give any effects. thanks for any help :)
Images have logical dimensions (width and height), and their in memory representation has physical dimensions. They typically have a "stride", which equals the number of bytes (or pixels?) you should advance in order to get to the next scanline. Assuming all numbers are positive, stride>=width will hold true, stride==width may or may not be true. See also BitmapData.Stride :)
Luc Pattyn