Note that there are some explanatory texts on larger screens.

plurals
  1. PODrawing line on a CALayer in OSx
    primarykey
    data
    text
    <p>I would like to know if you can help me with painting on layers.</p> <p>The situation is this</p> <p>I am programming on this kind of screen <a href="http://multitouch.com" rel="nofollow">http://multitouch.com</a>, 12 touches simultaneously. In the app I am developing, I can manage multiple images. I can rotate, scale an move at the same time all images (maximum 12 touches on the screen!) To accomplish this I use ONLY layers for performances. Every image is represented by a CALayer, then I create my CALayer's and set the image as its 'contents'. The hierarchy is this.</p> <p>I have only a NSView.</p> <ul> <li>NSView "Container_View"</li> <li>CALayer "Images_Layer" as sublayer of the "Container_View" layer (they have the same frame)</li> <li>CALayer "Img_1_Layer", CALayer "Img_2_Layer", CALayer "Img_3_Layer", etc as sublayer of "Images_Layer"</li> </ul> <p>As I told you before, I can rotate, scale and move my Images.</p> <p>Double tap on a single image, I lock the whole screen, I can still rotate and move the image but ONLY with 2 fingers.</p> <p>Now I would like that user can draw with 1 finger on this image.</p> <p>The main problem is that I have not experience with graphics and all example on internet are about draw line on view.</p> <p>The question is How to draw with a finger on a CALayer. I have only CALayer, I cannot have NSView</p> <p>Many thantk in advance, Sergio</p> <hr> <p>Hi Mazyod, the CALayer class that provides the Image is very big.</p> <p>Please try to understand this context</p> <p>MainWindow as root naturally</p> <p>NSViewController called MainViewController with a custom NSView as root view - this view is called Container and it's set as contentView of the MainWindow</p> <p>CALayer called Images_Layer - it's a layer added as SubLayer of the Container's layer</p> <p>CALayer called Img_Layer - it's a layer added as SubLayer of the Images_Layer (I have one of this for each image, set as contents naturally, then an CGImageRef)</p> <p>When I click on an Image (ImgLayer), 3 methods are fired as usual:</p> <p>onTouchPointDown - with x, y etc onTouchPointMove - with x, y etc onTouchPointUp - with x, y etc</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. 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