Manipulating individual pixels of a UIImage

I'm currently attempting to port a Java program over to iOs which utilzes BufferedImage's .setRGB method to individually manipulate images' pixels like so

image.setRGB(x, y, color);

In Objective-C I'm using UIImage in place of BufferedImage and what I'd like to know is if there is an equivalent way of doing Java's setRGB , or must I convert the image to a byte array, manipulate the pixels and then use ImageWithData?

Answers


You have to convert the image into a bitmap, use setRGB on the bitmap, then create an image with the bitmap and draw it or assign the new image to your image views contents.

Why? The pixels are likely in an opaque format on the other side of the GPU where an app's ARM code can't access them.


Need Your Help

Zend_Session lost when using regenerateId()

php zend-framework session

I've had this problem in a couple of ZF applications now and it's very frustrating:

startActivityForResult not working TabGroupActivity in android

android tabs paypal activitygroup

I have used Experience - Multiple Android Activities in a TabActivity to implement tab.