Added to bugzilla: http://bugzilla.enlightenment.org/show_bug.cgi?id=105 (evas patch) http://bugzilla.enlightenment.org/show_bug.cgi?id=106 (edje patch)
BR Andrunko On 7/16/07, Andre Magalhaes <[EMAIL PROTECTED]> wrote: > Hi, > > On 7/16/07, The Rasterman Carsten Haitzler <[EMAIL PROTECTED]> wrote: > > On Mon, 9 Jul 2007 19:20:57 -0300 "Andre Magalhaes" <[EMAIL PROTECTED]> > > babbled: > > > > > Hey Raster, > > > > > > On 7/9/07, The Rasterman Carsten Haitzler <[EMAIL PROTECTED]> wrote: > > > > On Fri, 6 Jul 2007 18:00:08 -0300 "Andre Magalhaes" <[EMAIL PROTECTED]> > > > > babbled: > > > > > > > > > Hi all, > > > > > > > > > > As this is my first post here, let me introduce myself. I am Andre > > > > > Moreira Magalhaes, aka andrunko, and I work for INdT in Brazil. > > > > > > > > hey andre :) > > > > > > > > > Now let's go to the point. I am working on a project that requires > > > > > that an Evas_Object to have a custom click area. This object is a > > > > > non-retangular object (a circle for eg) with a transparent backgroung. > > > > > When i click on the background of this object, if the click was in a > > > > > transparent area this object shouldn't receive any event. I was > > > > > investigating the Evas code and i found 3 ways that this could be > > > > > done. > > > > > > > > currently evas doesn't do this. in theory it could - but it doesn't. > > > > > > > > > 1 - Change evas_object_was_in_output_rect to always return 0 if the > > > > > rect is in a transparent area of the object (not desired) > > > > > 2 - Change evas_object_event_callback_call to return a boolean value > > > > > indicating if the object handled the event and if not, keep sending > > > > > event to the other objects in the list. If the object handled the > > > > > event, stop there. This would require a lot of changes. > > > > > 3 - Change evas_object_was_in_output_rect to check a for a custom > > > > > "in_output_rect" method on the object, and if this method is set, use > > > > > it to check if the rect is in output rect. This would require a new > > > > > function, evas_object_is_in_output_rect_cb_set (or something similar) > > > > > that could be implemented whenever is needed. If this method is not > > > > > set, check the clip rectangle as it's done today. > > > > > > > > actually i already designed for this. there is an is_inside and > > > > was_inside > > > > method for objects. only line and polygon objects provide them and they > > > > just > > > > return 1 - these CAN be called if a point is inside the object rect and > > > > the > > > > code wants to determine if an event is still inside the object based on > > > > private object data (eg polygon outline, image pixel alpha channel data > > > > etc.). right now it basically isn't used - but its intent was to be used > > > > for this. the problem is this is actually relatively slow/expensive to > > > > do. > > > > you probably also want a way of enabling or disabling this level of > > > > event > > > > processing per object to save cost. so we probably need to add an object > > > > flag to use these methods, if they exist, or disable them (disabled by > > > > default), then provide methods for image objects at the least - then > > > > actually use them, if they are provided, and the flag is enabled for > > > > that > > > > object. implementing this won't be too hrd, but it won't be trivial. you > > > > need to be able to figure otu any x,y co-ord within the object and what > > > > pixel of the image that may map to based on paremeters of the object, > > > > then > > > > go check that pixel's alpha channel (if the image has an alpha channel). > > > > for polygon nd line objects you need to do some half-plane point > > > > intersection math (easy but its order(n) where n is the number of sides > > > > of > > > > the polygon). for lines its strange - you might want perfect inclusion, > > > > but > > > > that's a very small space unless its a thick line (doesn't exist > > > > currently). for text... thats hard as you need to figure out what > > > > character > > > > is in that x,y (that's easy) and then check the character glyph pixels > > > > to > > > > see if its inside... > > > > > > > > but anyway - i added this mechanism in at the very start but have never > > > > used it (or really needed it enough to implement the rest of it). > > > hmmm, i didn't know about this is_inside method, it's similar to what > > > > not surprising. it's hidden away for "one day when i might want to use it" > > :) > > > > > i wanted but with some improvements :D. Attached there is a patch to > > > implement it on evas_object_image and edje, and a callback to > > > enable/disable it. I didn't like the name convention but this is > > > something easy to change. I tested it here and it seems to be working. > > > This is my first patch to evas, so please let me know where i can > > > improve. Any comment is welcome > > > > you seem to have only implemented the evas-side of using this method and a > > very > > simple/primitive "get pixel" in evas_object_image_is_inside (). This doesn't > > handle border scaling and any form of fills other than "Scaling" fills. i > > think > > you really need to implement this - you need to take the x,y in > > canvas-co-ordinates, then convert this to a, x,y in the pixel array for the > > image (remember there is a fill origin and size so the image may get scaled > > differently to the size of the object, also its original can be offset. also > > there is border scaling that removes scaling for specified edges of the > > image > > that you need to account for in converting the canvas co-ord x,y into a > > pixel > > x,y reference). > hmmm, ok, i will fix this. > > > and as gustavo mentioned - this only covers argb32 images - doesn't handle > > yuv > > (though yuv will ALWAYS be "in" as there is no alpha channel so you can > > detect > > this and skip the check and return 1), and the 16bpp engine images too... > > alpha > > is a separate plane at the end. > This is already done in the last patch with stride support. It returns > 1 for yuv cspace and handles 32 and 16 bpp images. > > I will attach the last version of the patches again in case you missed it > > BR > Andrunko > > > > > > In the current code, i could do repeat_events=1 to make both objects > > > > > receive the event, and do nothing on the circle object if the clicked > > > > > area is a transparent area. The problem is that this won't work for > > > > > the lower widget, as it's always receive the event, even if the circle > > > > > handled it. > > > > > > > > see above - also add a flag to edje to enable or disable this event > > > > processing and bingo... all done. :) > > > > > > > > > Any other ideas on how to do it? I am willing to write a patch if you > > > > > agree. I would vote for number 3, as it's extensible, does not require > > > > > a lot of changes and does not impact on performance in the default > > > > > case (no custom is_in_output_rect method). > > > > > > > > none of the above - see my suggestion :) > > > > > > > > > Any help is appreciate, > > > > > BR > > > > > Andrunko > > > > > > > > > > ------------------------------------------------------------------------- > > > > > This SF.net email is sponsored by DB2 Express > > > > > Download DB2 Express C - the FREE version of DB2 express and take > > > > > control of your XML. No limits. Just data. Click to get it now. > > > > > http://sourceforge.net/powerbar/db2/ > > > > > _______________________________________________ > > > > > enlightenment-devel mailing list > > > > > enlightenment-devel@lists.sourceforge.net > > > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > > > > > > > > > > > > > > > > -- > > > > ------------- Codito, ergo sum - "I code, therefore I am" -------------- > > > > The Rasterman (Carsten Haitzler) [EMAIL PROTECTED] > > > > 裸好多 > > > > Tokyo, Japan (東京 日本) > > > > > > > > > > BR > > > Andrunko > > > > > > > > > -- > > ------------- Codito, ergo sum - "I code, therefore I am" -------------- > > The Rasterman (Carsten Haitzler) [EMAIL PROTECTED] > > 裸好多 > > Tokyo, Japan (東京 日本) > > > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel