Hello;

ext Murray Cumming wrote:
> On Tue, 2008-02-26 at 17:28 +0000, Matthew Allum wrote:
>   
>> So clutter has 2 painting modes - the regular one you see and the
>> picking one - which essentially just renders offscreen per reactive
>> actor color coded silhouettes (usually just quads) of actors so it can
>> quickly figure out what actor a pointer event relates to. Thats
>> basically what the above is doing though Im not sure why we are checking
>> the mapped flag - that probably isn't needed - pippin, ebassi ?
>>     
>
>
> Thanks. I'd really like some more clues about this because I hate to
> write about something I don't understand. I understand that all
> containers must call clutter_actor_pick() on all their children(), 
> but I don't understand what regular actors should do in their
> ClutterActor::pick(): implementation.
>
> Most of the pick() implementations in core clutter just use the default
> implementation in ClutterActor, which draws a rectangle. I can't find
> any non-container pick() implementation in clutter or tidy that doesn't
> use that. 
>
>   

One use-case I can think of is that actor's visual shape would be
different than it's input region. Then for pick-operation the actor
would paint the 'input-shape', not the visual shape.

> Below are some more that I found in Tidy, but I don't see a pattern yet,
> so I don't see what they are actually trying to achieve. If this is just
> for some kind of cursor-is-inside-the-shape detection then why is the
> color significant? Why do some just call their paint() function instead
> of drawing an outline?
>
>
> static void
> tidy_frame_pick (ClutterActor       *actor,
>                  const ClutterColor *pick_color)
> {
>   /* chain up, so we get a box with our coordinates */
>   CLUTTER_ACTOR_CLASS (tidy_frame_parent_class)->pick (actor,
> pick_color);
>
>   /* paint our child, if any */
>   if (CLUTTER_ACTOR_IS_MAPPED (actor))
>     {
>       TidyFramePrivate *priv = TIDY_FRAME (actor)->priv;
>
>       if (priv->child && CLUTTER_ACTOR_IS_MAPPED (priv->child))
>         clutter_actor_paint (priv->child);
>     }
> }
>
> static void
> tidy_scroll_view_pick (ClutterActor *actor, const ClutterColor *color)
> {
>   gint x, y, width, height;
>   TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (actor)->priv;
>   
>   /* Paint a background */
>   cogl_color (color);
>   x = CLUTTER_UNITS_TO_INT (priv->box.x1);
>   y = CLUTTER_UNITS_TO_INT (priv->box.y1);
>   width = CLUTTER_UNITS_TO_INT (priv->box.x2) - x;
>   height = CLUTTER_UNITS_TO_INT (priv->box.y2) - y;
>   cogl_rectangle (x, y, width, height);
>   
>   tidy_scroll_view_paint (actor);
> }
>
> static void
> tidy_notebook_pick (ClutterActor       *self,
>                     const ClutterColor *color)
> {
>   tidy_notebook_paint (self);
> }
>
> static void
> tidy_viewport_pick (ClutterActor       *self,
>                     const ClutterColor *color)
> {
>   tidy_viewport_paint (self);
> }
>
>
>
>   


// Tapani Pälli

-- 
Software Engineer
Open Source Software Operations 

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to