kraftydevil
kraftydevil

Reputation: 5246

How can I generate iOS code to draw an image?

How can I consume a graphic and then generate objective-c code that can draw it? The code generation doesn't need to be written in objective-c, but must generate objective-c code.

Input: A.png

Output: Core Graphics code to generate a file A.png that would match the image of the original file, A.png.

For example, since I can find out the color and position of every pixel, what tool can I use to write iOS code that draws those pixels exactly.

Why inflate the bundle size with images or why wait to pull down images from a web service when the app itself could generate those images with the right instructions.

My intention is to use this in a white label solution.

Upvotes: 1

Views: 339

Answers (2)

Caleb
Caleb

Reputation: 124997

Why inflate the bundle size with images or why wait to pull down images from a web service when the app itself could generate those images with the right instructions

Because your code will still need to contain all the information contained in the image, plus all those drawing instructions, so you're going to end up with a larger product, not a smaller one. Additionally, building the image data into the code makes it that much harder to change.

Upvotes: 2

spring
spring

Reputation: 18487

Use PaintCode to create your graphics. You are done.

Upvotes: 1

Related Questions