Fusseldieb Active Member Licensed User Longtime User Aug 17, 2015 #1 Hi, I use getPixels() to get pixels from the entire image and I realize that I can read one pixel at a time defining 0,0 or 0,1 and so on, but everytime I use that funcion, it slows the app down. Knowing that, I want to read the entire image at once, store it into an Integer and read later with x and y. Code: Copy Dim p() As Int p=getPixels(Canvas1.Bitmap,0,X,Y,Canvas1.Bitmap.Width,Canvas1.Bitmap.Height) Here I read the entire image, but how can i later read an x and y coordinate? Like this: Code: Copy p(12,49) Obviously that doesn't work, but I can't figure out how to make that work.
Hi, I use getPixels() to get pixels from the entire image and I realize that I can read one pixel at a time defining 0,0 or 0,1 and so on, but everytime I use that funcion, it slows the app down. Knowing that, I want to read the entire image at once, store it into an Integer and read later with x and y. Code: Copy Dim p() As Int p=getPixels(Canvas1.Bitmap,0,X,Y,Canvas1.Bitmap.Width,Canvas1.Bitmap.Height) Here I read the entire image, but how can i later read an x and y coordinate? Like this: Code: Copy p(12,49) Obviously that doesn't work, but I can't figure out how to make that work.
stevel05 Expert Licensed User Longtime User Aug 18, 2015 #2 From a quick test it appears that the returned array holds rows of pixels in sequence. So if the bitmap is 10 x 10, the contents of the array indices 0-9 will be row 1, 10 - 19 will be row 2 etc. So you can access each pixel as Code: Copy Pixels(X + Y * ImageWidth) Upvote 0
From a quick test it appears that the returned array holds rows of pixels in sequence. So if the bitmap is 10 x 10, the contents of the array indices 0-9 will be row 1, 10 - 19 will be row 2 etc. So you can access each pixel as Code: Copy Pixels(X + Y * ImageWidth)