General Category > Discussion - EVE

Tag value of an area with content

<< < (3/3)

Rudolph:

--- Quote from: darkjezter on June 17, 2020, 06:26:18 PM ---though Rudolph's example also uses zero).

--- End quote ---

As zero is an invalid value and also the default CLEAR_TAG value, I just use TAG(0)
for objects I do not need touch events for.


darkjezter:
"Why the first tag values are 0 ?"

I got this one.  Reported tag values only update once per video frame (due to the scanout mentioned above)  So touch will almost always be reported first, but expect the corresponding tag update to lag until the next video frame interval.

In my use of this, I've implemented a sticky tag system.  Touch events are tracked separately from tags, and reported tag values of zero are more or less ignored.  Once a non-zero tag comes in, I latch it internally, remembering its value until touch is released.  New tag values besides the one selected are ignored (only activate one control per touch event), and I also make use of this mechanism to keep a button activated until touch is released, or the finger drags outside of the control (based on position, not tag) plus a margin.  All done without additional drawing commands to the display, and also allowing overlapping release areas between adjacent controls.

Most of this was made necessary by the fact that we're using a resistive touchscreen, and that we need the screens to be usable with work gloves on.

T.Pierret:
Hi,

Here is the simplest display list where the trouble can be observed. It's dynamically built. Hence it is extracted from our mockup code. Small errors may appear in coordinates (hope not).


--- Code: ---CLEAR_COLOR_RGB(10, 10, 60)
CLEAR(1 ,1 ,1)
CLEAR_TAG( 0 )
TAG( CONTENT_TAG_ID )                     // Start drawing content
SAVE_CONTEXT()
draw_image(KITE_ICON_ID, 88, 88, 64, 64)
RESTORE_CONTEXT()
SAVE_CONTEXT()
COLOR_RGB(255, 255, 255)
CMD_TEXT(140, 96, 26, 0, "Blablabla")
CMD_TEXT(252, 136, 26, 0, "Blabla: blabla bla bla")
RESTORE_CONTEXT()
SAVE_CONTEXT()
draw_image(SAIL_ICON_ID, 752, 200, 64, 64)
RESTORE_CONTEXT()
TAG( 0 )                                  // End of the content
SAVE_CONTEXT()
BEGIN(RECTS) );
COLOR_RGB(80, 80, 80)                     // Title bar background
VERTEX2F(0 * 16, 0 * 16)
VERTEX2F(79 * 16, 799 * 16)
COLOR_RGB(60, 60, 60)                     // Menu bar background
VERTEX2F(0 * 16, 80 * 16)
VERTEX2F(79 * 16, 479 * 16)
COLOR_RGB(0, 0, 0)                        // Selection area background
VERTEX2F(0 * 16, y * 16)
VERTEX2F(79 * 16, 79 * 16)
END()
RESTORE_CONTEXT()
SAVE_CONTEXT()               // Status led
draw_image(STATUS_GREEN_ID, 704, 16, 40, 40);
RESTORE_CONTEXT()
SAVE_CONTEXT()                            // Icons
TAG( HOME_TAG_ID )                        // Home icon
draw_image(HOME_ICON_ID, 8, 8, 64, 64 );
RESTORE_CONTEXT()
SAVE_CONTEXT()
TAG( BACK_TAG_ID )                        // Back icon
draw_image(BACK_ICON_ID, 88, 8, 64, 64);
TAG( SETTINGS_TAG_ID )                    // Settings icon
draw_image(SETTINGS_ICON_ID, 712, 8, 64, 64);
TAG( mpCurrentState->tags[i] )            // Function icon
draw_image(FUNCTION_ICON_ID, 8, 88, 64, 64);
RESTORE_CONTEXT()
COLOR_RGB(240, 240, 240)                  // Title
CMD_TEXT(400, 8, 31, OPT_CENTERX, "Tests")
COLOR_MASK(0 ,0 ,0 ,0)                    // Content area
TAG(CONTENT_TAG_ID)
BEGIN(RECTS)
VERTEX2F(80 * 16, 80 * 16)
VERTEX2F(799 * 16, 479 * 16)
END()
--- End code ---

where the draw_image function acts as this:


--- Code: ---draw_image( id, x, y, w, h ):
  BITMAP_SOURCE( images[id].ram_address )
  BITMAP_LAYOUT( images[id].pImage->format, images[id].pImage->stride, images[id].pImage->height )
  BITMAP_SIZE( NEAREST, BORDER, BORDER, images[id].pImage->width, images[id].pImage->height )
  BEGIN( BITMAPS )
  if ( images[id].pImage->width != w )
  {
    factor = images[id].pImage->width * 256 / w;
    BITMAP_TRANSFORM_A(factor)
  }
  if ( images[id].pImage->height != h )
  {
    factor = images[id].pImage->height * 256 / h;
    BITMAP_TRANSFORM_E(factor)
  }
  VERTEX2F( x * 16, y * 16 )
  END()
--- End code ---

All the icons are ARGB2 images (white drawing on transparent background), but the status led image is an ARGB555 image.

Thanks in advance for your support
Best regards

T.Pierret:
Hi,

As stated in the http://www.brtcommunity.com/index.php?topic=143.15, the trouble is solved by using data from the REG_TOUCH_TAG_XY register instead of the REG_TOUCH_SCREEN_XY register. The tag value now appears as expected by the real touch.

Thanks for your support.

Regards.

Navigation

[0] Message Index

[*] Previous page

Go to full version