2

I am developing an application for viewing images. I used the example of PhotoScroller Apple to implement this application. In my application I want to be able to draw on the image.

I had the idea to put a UIView on top with transparent background and draw the lines via touch events. This solution has become very slow because the generated images are very large, around 3700x2000 pixels.

I also tried a solution with the example of Apple GLPaint that uses OpenGL, but it has a size limitation of 2048x2048 pixels.

Anyone have any idea or example of how I implement this?

Adam Wenger
  • 17,100
  • 6
  • 52
  • 63
Callebe
  • 21
  • 1
  • 3

1 Answers1

2

I think you should try and tile your image.

One option is using CATiledLayer. Have a look at this short tutorial.

Or you could try and use CGContextDrawTiledImage to get your stuff done. Possibly this post from S.O. could help you getting started.

Community
  • 1
  • 1
sergio
  • 68,819
  • 11
  • 102
  • 123
  • i want to draw lines with finger on image. the image is loaded fine, but the drawing with finger is not good. it is slow. I created a UIView and get de points of touches events and draw lines between points, but it is slow. – Callebe Dec 05 '11 at 19:08
  • don't you think that slowness could be related to image size? – sergio Dec 05 '11 at 19:12
  • Yes, i do! So. i want to draw images, zooming and save it. To view the original image i used CATiledLayer. To drawing, i'm using an other view with transparent background and drawing lines on it. I want an app like a windows paint app. I think i'm not being clear. – Callebe Dec 05 '11 at 19:34
  • Maybe you can use tiled image as your target for drawing also, not only for the base image? – jv42 Dec 06 '11 at 09:18