BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: Tag value of an area with content  (Read 228 times)

T.Pierret

  • Newbie
  • *
  • Posts: 22
    • View Profile
Tag value of an area with content
« on: June 17, 2020, 08:18:19 AM »

Hi,
In order to create a "slidable" area with texts and images content, I first drew the content:
Code: [Select]
CLEAR_COLOR_RGB()
CLEAR(1 ,1 ,1)
CLEAR_TAG( 0 )
...
BITMAP_SOURCE()
BITMAP_LAYOUT()
BITMAP_SIZE()
BEGIN( BITMAPS )
...
CMD_TEXT()
...
Then I defined the area where the touch shall be used for scrolling :
Code: [Select]
COLOR_MASK(0 ,0 ,0 ,0)
TAG( value )
BEGIN(RECTS)
...
Touching the scrolling area, I expected to get the defined tag value. However, if the touch happens on a text or an image, the tag value 0 is obtained.
Is there a way to not get the tag value 0 and obtain the tag of the content area ?

Thanks in advance for any support.
Best regards
Logged

Rudolph

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: Tag value of an area with content
« Reply #1 on: June 17, 2020, 10:22:24 AM »

You can use the same tag value for several objects.
In your case I would just use an rectangle with the background color and the other objects on top of that.

TAG(10)
COLOR_RGB(Background)
..rect..window-size
..bitmaps
COLOR_RGB(Text)
CMD_TEXT()
TAG(0)

I usually do this with sliders to make them more useable by increasing the touch-area.

Oh, annother thing, avoid tag values below 10, for some reasons these do not give reliable touch events.
Logged

BRT Community

  • Administrator
  • Full Member
  • *****
  • Posts: 213
    • View Profile
Re: Tag value of an area with content
« Reply #2 on: June 17, 2020, 03:27:58 PM »

Hello,

Rudolphs suggestion is a suitable solution.
Is there any particular reason you would wish to tag the images and scrolling section with different tag values?

Best Regards,
BRT Community
Logged

avanti

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Tag value of an area with content
« Reply #3 on: June 17, 2020, 03:37:04 PM »

Oh, annother thing, avoid tag values below 10, for some reasons these do not give reliable touch events.
Is this really true!?  If so, I have a lot of code to revise.
Logged

T.Pierret

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Tag value of an area with content
« Reply #4 on: June 17, 2020, 03:42:34 PM »

Thanks for those answers.
The purpose is to not tag the content of the area while tagging the whole scrollable area.

I tried the solution proposed by @Rudolph, but it did not work. It is even worst since touching the scroll area itself also returns the 0 tag value  :o
To be noted : between the content and the scrollable area drawings, there are other tagged items (title bar, menu bar, ...), that overlay the content if this is too big for the display area.

Regards
Logged

Rudolph

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: Tag value of an area with content
« Reply #5 on: June 17, 2020, 05:25:00 PM »

Oh, annother thing, avoid tag values below 10, for some reasons these do not give reliable touch events.
Is this really true!?  If so, I have a lot of code to revise.

I am not quite sure.
I tested this the last time back in January with an EVE3-43G and before that found this behaviour with FT813.
At a tag-value of 1 the value was toggeling between 0 und 1.
At a tag-value of 5 the value was toggeling between 4 und 5.
At a tag-value of 9 the value was toggeling between 8 and 9.
Using other values was stable: 2, 3, 4, 6, 7, 8, 11, 15 and 19.
It was reproduceable, I had seen this before and I got a bug-report regarding this.

I just setup a new test with an EVE3-50G and the value is stable.
It just is freaking stable - as it should be.
No idea why, could not explain it back then either, just reading REG_TOUCH_TAG has a rather low potential for failure.

So well, ignore this, sorry.
Logged

darkjezter

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Tag value of an area with content
« Reply #6 on: June 17, 2020, 06:26:18 PM »

No matter where you touch the display, I'm pretty sure you should get a tag value of some kind.  When you clear the display, if you've set the bit to clear the tag, the the entire display will return the tag value determined by CLEAR_TAG which is zero by default.  As you draw, tag values are replaced in the region drawn by the current value of TAG (1 to 255 according to the doc, though Rudolph's example also uses zero).  Thus, if you draw your scroll region last, then any touches in it should report that tag value.  The only exception to this will be when using TAG_MASK, which you don't appear to be.

If you've tried Rudolph's suggestion and as a result are seeing tags of zero for your scrollable region, then it sounds like TAG(0) is supported in spite of the documentation, and you've either failed to set tag again before drawing your scrollable area, or drawn something over top of the scrollable area with TAG still set to zero.

Logged

T.Pierret

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Tag value of an area with content
« Reply #7 on: June 18, 2020, 03:24:25 PM »

Hi,

You are right, the behaviour is not the one I explained. However I often observe a tag value of 0 at the beginning of a sliding movement. Here is some recorded samples of the case:

  Event         Time Smoothstep    Read   Tag Pressure
"Touch pressed" 18516  172 203    172  203  0    957
"Touch moved"   18521  172 202    473  148  0   1318
"Touch moved"   18526  172 201    501  148  0   1021
"Touch moved"   18531  172 200    534  140  0    899
"Touch moved"   18536  172 199    509  154 16    865
"Touch moved"   18793  237 190    568  150 16    416
"Touch moved"   19078  302 185    568  169 16    479
"Touch moved"   19335  342 187    546  198 16    477
"Touch moved"   19592  375 194    545  234 16    452
"Touch moved"   19849  406 204    565  260 16    564
"Touch moved"   20106  430 215    558  277 16    553
"Touch moved"   20363  449 227    551  293 16    535
"Touch moved"   20620  465 240    547  312 16    529
"Touch moved"   20877  477 256    543  342 16    607
"Touch moved"   21134  487 273    540  363 16    547
"Touch moved"   21391  497 289    548  373 16    556
"Touch released"21648  505 302  32768 32768 16  32767

where the scrollable area (tag value=16) is defined as (80,80) -> (799,479).

Why the first tag values are 0 ? Yet the touch coordinates are well in the 16-tagged area.

Supplementary: why the 1st touch coordinates may be so different of the rest ?

Thanks in advance for any support.
Regards
« Last Edit: June 18, 2020, 03:26:08 PM by T.Pierret »
Logged

BRT Community

  • Administrator
  • Full Member
  • *****
  • Posts: 213
    • View Profile
Re: Tag value of an area with content
« Reply #8 on: June 18, 2020, 04:01:59 PM »

Hello,

Can you provide an example display list of how you are tagging the different objects on your screen?
I would like to investigate this behaviour further.

Best Regards,
BRT Community
Logged

BRT Community

  • Administrator
  • Full Member
  • *****
  • Posts: 213
    • View Profile
Re: Tag value of an area with content
« Reply #9 on: June 18, 2020, 04:09:53 PM »

Hello,

The REG_TOUCH_TAGs default value is 0, however this normally indicates that no touch is detected. It may be that you are reading the register before the frame has fully scanned out.

Can you provide an example display list of how you are tagging the different objects on your screen?
I would like to investigate this behaviour further.

Best Regards,
BRT Community
Logged

Rudolph

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: Tag value of an area with content
« Reply #10 on: June 18, 2020, 06:34:18 PM »

though Rudolph's example also uses zero).

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.


Logged

darkjezter

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Tag value of an area with content
« Reply #11 on: June 18, 2020, 10:01:03 PM »

"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.
Logged

T.Pierret

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Tag value of an area with content
« Reply #12 on: June 19, 2020, 08:09:26 AM »

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: [Select]
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()

where the draw_image function acts as this:

Code: [Select]
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()

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
Logged

T.Pierret

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Tag value of an area with content
« Reply #13 on: June 25, 2020, 07:50:05 AM »

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.
Logged