I would like to know if anyone can point me in the right direction regarding what frameworks/methods
to use when replacing a block of pixels in an image with another block of pixels.
For example lets say I have a simple image colored fully red and I consider my pixel block size as 5×5
pixels. Now every 3 blocks I want to replace the 3rd block with a blue colored block (5×5 pixels) so
that it would result in a red image with blue blocks appearing every 3 red blocks.
I’ve found information regarding pixel replacement but am trying to figure out how to determine and process pixel blocks. Any advice would be appreciated.. and any code would be a wet dream.
Although it may sound like a simple question, it’s not quite easy to do something like that. You need a lot of background information to get everything going. It also depends on where the image comes from, and what you want to do with it.
I will not provide you with a working example, but here’s some pointers:
Reading in an image:
Creating your own “graphics context” to draw on:
Painting your image onto your (current) context:
Doing some other painting:
Transforming the bitmap context to an image again:
And then, either:
Show the image to the audience, from within a view controller:
Or write the image as jpeg:
Or as PNG:
For those last ones you would need to have a filename, which is not so trivial either (given the phone environment you live in). That’s another topic on which you’ll find a lot, search for things like:
This is the general outline, I might have made some errors but this should get you going at least.