InDesignerMan Posted November 18, 2013 Share Posted November 18, 2013 (edited) Hi all, I would like to loop through a rows and columns, like looping through pixels in a image, square by square, block by block, this is my initial code and it works fine: imagePixels = picture.getPixels(); for( y = 0; y < height ; y ++ ) { for ( x = 0; x < width; x ++ ) { // Reads the image row by row, from top to bottom } } WHAT I NEED HELP WITH? I can read an image row by row, starting from top to bottom as you can see from the loop above, however how would I go about Selected 4 pixels at a time? Like loop through it by chunks, 4 pixels at a time... example: Edited November 18, 2013 by InDesignerMan Quote Link to comment Share on other sites More sharing options...
Rifts Posted November 18, 2013 Share Posted November 18, 2013 (edited) editing Edited November 18, 2013 by Rifts Quote Link to comment Share on other sites More sharing options...
InDesignerMan Posted November 18, 2013 Author Share Posted November 18, 2013 (edited) so while you are editing there Rifts, I was thinking, what if I did (x,y + 1), (x + 1, y +1), (x,y) and (x+1,y) ? while doing for ( int y=0 ; y<height ; y+=2 ) { for ( int x=0 ; x<width ; x+=2 ) { }; }; Edited November 18, 2013 by InDesignerMan Quote 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.