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

rdkit svg flavors and rendering inline svg on django dev server

python django google-chrome svg rdkit

Hi I am trying to serve svg inline in a document rendered by a Django template where the svg ( 2D line drawings) and the document context are dynamically generated. The svg_string is put into my dj...

Why is curl storing my cookie in c:\

php cookies curl

I'm setting the curl cookiejar option with the following:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.