Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The graphics context returned by <code>UIGraphicsGetCurrentContext</code> in <code>drawRect:</code> is owned by the system and cleared at the start of a drawing pass. Create your own <code>CGContext</code> to record your drawing and render it to the <code>drawRect:</code> context as needed.</p> <p>Create a paired <code>CGBitmapContext</code> and <code>CGImage</code> that refer to the same <code>CGDataProvider</code> and have the same size, color space and other properties. Draw into that context when and how you see fit, then in <code>drawRect:</code> use <code>CGContextDrawImage</code> to display it.</p> <p>Or if you are just doing a series of lines, you can build a <code>CGMutablePath</code> and render it to the system context.</p> <p>Edit:</p> <p>Look at <code>CGImageCreate</code> and <code>CGBitmapContextCreate</code> in their respective header files. Most of the arguments are the same. The bitmap context expects a raw data pointer, while the image expects a CGDataProvider. Here is a rough sketch of what the code would look like. In the end you can draw into the context then use the image to render into another context.</p> <pre><code>size_t width = 400; size_t height = 300; CFMutableDataRef data = CFDataCreateMutable( NULL , width * height * 4 ); // 4 is bytes per pixel CGDataProviderRef provider = CGDataProviderCreateWithCFData( data ); CGImageRef image = CGImageCreate( width , height , ... , provider , ... ); CGBitmapContextRef context = CGBitmapContextCreate( CFDataGetMutableBytePtr( data ) , width , height , ... ); CFRelease( data ); // retained by provider I think CGDataProviderRelease( provider ); // retained by image </code></pre> <p>There are a lot of blanks to fill in, but this should get you started. You could use malloc instead of CFData for the buffer.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload