0

I have a matrix of 1s and 0s and I need a way to show that matrix graphically. For example painting a dot in a UIScrollView with every 1 I find. I'm trying to do it with Quartz 2D and things like

CGContextSetStrokeColor(c, blue);
CGContextBeginPath(c);
CGContextMoveToPoint(c, 0.0f, 0.0f);
CGContextAddLineToPoint(c, 1.0f, 1.0f);

It looks that it is working but I'm not sure if is the correct way.Above all taking into account that the matrix is VERY VERY big (actually I'm trying only with littles examples) and I'm gonna need to move and zoom in/out to see all the painting.

Thanks.

STW
  • 44,917
  • 17
  • 105
  • 161
Sergiodiaz53
  • 1,268
  • 2
  • 14
  • 23
  • 2
    There is no such things as the "correct way." Either it works well enough for your purposes or it doesn't. – borrrden Jun 21 '12 at 08:39
  • yes, but I don't know if that way will be OK in the future when I want to zoom in/zoom out the view, select lines, etc and, for example, isn't there anything like CGContextAddPointToPoint??? Thanks anyway! – Sergiodiaz53 Jun 25 '12 at 11:53
  • Then in that case you need to implement them and find out. Nobody can guess if it will be good enough or not. You need to experiment, profile, experiment, profile. That being said, if by "dot" then you mean "pixel" then you should just construct a byte array out of the data (RGBA-32) and use it to generate a context ^^ – borrrden Jun 25 '12 at 13:54

0 Answers0