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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - mmottola

Pages: [1]
1
Discussion - EVE / Re: Question for method BLENDING
« on: February 28, 2023, 06:22:29 PM »
Hi pauljiao,

Thanks for your answer, but please have a heart and read my specification. There are still alias effects and the ring should be 100% transparent and the surrounding area should not be.

The very simple problem seems to be more and more an unsolvable problem...

@ BRT Community: What does your development team say?

Apologies for bumping an old thread, but I believe the issue was with the aliasing on the inner portion of the ring. By adding an additional point with blending to @pauljiao provided snippet, anti-aliasing of the inner portion can be achieved while still allowing for transparency.

Code: [Select]
CLEAR_COLOR_RGB(255,255,255)
CLEAR_COLOR_A(255)
CLEAR(1, 1, 1)

CMD_GRADIENT(100, 207, 0x007FFF, 244, 189, 0x7FFF00)

SAVE_CONTEXT()

SCISSOR_XY(100, 100)
SCISSOR_SIZE(101, 101)

COLOR_RGB(255,255,255)
COLOR_A(255)

COLOR_MASK(0,0,0,1)
BLEND_FUNC(ZERO, ZERO)

BEGIN(RECTS)
VERTEX2F(1600, 1600)
VERTEX2F(3200, 3200)

COLOR_A(255) // Circle transparency
BLEND_FUNC(SRC_ALPHA, ZERO)
POINT_SIZE(800)
BEGIN(POINTS)
VERTEX2F(2400, 2400)

BLEND_FUNC(ZERO, ZERO)
POINT_SIZE(384)
BEGIN(POINTS)
VERTEX2F(2400, 2400)

//Anti-aliasing inner portion
BLEND_FUNC(ZERO, ONE_MINUS_SRC_ALPHA)
POINT_SIZE(416)
BEGIN(POINTS)
VERTEX2F(2400, 2400)

COLOR_RGB(245,58,41)
COLOR_A(255)
COLOR_MASK(1,1,1,1)
BLEND_FUNC(DST_ALPHA, ONE_MINUS_DST_ALPHA)

BEGIN(RECTS)
VERTEX2F(1600, 1600)
VERTEX2F(3200, 3200)

RESTORE_CONTEXT()

2
Discussion - EVE / Re: Stencils with Fonts
« on: February 07, 2023, 04:28:02 PM »
Hi,

For the partial characters, one way may be to reverse your operation and print text only where the stencil is a certain value. For example here the text is only visible in the grey box area where the stencil is 1.

Code: [Select]
CLEAR_COLOR_RGB(128,128,128)
CLEAR(1, 1, 1)

// increment stencil where the box is drawn
STENCIL_OP(INCR, INCR)
COLOR_A(128)
BEGIN(RECTS)
VERTEX2F(2144, 1728)
VERTEX2F(8000, 4800)
END()
// Stop the stencil incrementing
STENCIL_OP(KEEP, KEEP)

// Text only where the stencil is 1
COLOR_A(255)
STENCIL_FUNC(EQUAL, 1, 255)

CMD_TEXT(107, 144, 30, 0, "TESTS")

// return the function
STENCIL_FUNC(ALWAYS, 0, 255)

We have some explanation on using character widths for things like drawing highlighting using efficient rectangles, which are part of appnotes in development, and so we'll post some snippets from those here too.

Best Regards, BRT Community

Thanks, that approach appears to produce the desired results. Looking forward to the additional snippets.

3
Discussion - EVE / Re: Stencils with Fonts
« on: February 06, 2023, 07:10:51 PM »
Hello,

We will look into your questions,

Could you also advise what your overall intended purpose for the stencil operation was within your application? Was it to do a highlight effect or a background on a string or on only certain characters of the text? We may also be able to suggest alternative ways.

Best Regards, BRT Community

I'm creating a custom textbox widget. I have most of the functionality already developed, but it is currently limited to displaying full font characters. Since variable-width fonts can be used this creates odd gaps around the borders of the text where a full character can't fit within the box. Ideally I'd like to use something to mask the characters so only a portion of them would be shown, hence the use of the stencil operation. Attached is an image of how the textbox is currently displaying text and how I'd like it to display text. The input string is the following for reference.
Code: [Select]
"The quick brown fox\n"
"jumps over the lazy dog.\n"
"`1234567890-=[]\\;',./\n"
"This is another test\n"
"sentence to check the fit\n"
"of text in the textbox.\n"
"~!@#$%^&*()_+{}|:\"<>?"

In some cases the text within the box will accept user input and be editable so ideally I'd like to be able to highlight text as well to indicate the position of the cursor.

4
Discussion - EVE / Stencils with Fonts
« on: February 02, 2023, 06:40:04 PM »
I'm trying to use the stencil buffer to mask text outside of a set region. Below are the commands run in ESE. My intuition was that the text could be treated as a rectangular box which appears incorrect. I'm assuming the issue is related to how the font's bitmap cells may be overlapping?
  • Any explanation of how the stencil buffer is being incremented with regards to a font's bitmap cells and why there appears to be artifacts from some of these cells?
  • How can I achieve the desired effect shown in RECTS Ref 1 but with text?

Code: [Select]
CLEAR_COLOR_RGB(128,128,128)
CLEAR(1, 1, 1)

STENCIL_OP(INCR, INCR)
COLOR_A(128)
BEGIN(RECTS)
VERTEX2F(720, 576)
VERTEX2F(16383, 9600)
END()
COLOR_A(255)
STENCIL_FUNC(GEQUAL, 0, 255) // Ref 0-4
COLOR_RGB(96,96,96)
BEGIN(RECTS)
VERTEX2F(720, 0)
VERTEX2F(1504, 1152)
END()
COLOR_RGB(255,255,255)

//BEGIN(RECTS)
//VERTEX2F(0, 768)
//VERTEX2F(1504, 960)
//END()

CMD_TEXT(0, 36, 30, 0, "TESTS")

5
Discussion - EVE / Issues Porting ESD Exports with Animations
« on: November 17, 2022, 06:56:40 PM »
I am attempting to port an exported ESD project to the STM32H743/753 series MCUs by following this guide.
https://brtchip.com/wp-content/uploads/2021/06/ESD-4.10-Exported-Project-Porting-Guide-for-STM32L4-Discovery-Board-and-FreeRTOS.pdf
The ports of "EVE_HalImpl_....c" & "EVE_Platform_....h" for the STM32 were derived from the files found here.
https://github.com/kaetemi/nuklear_eve/tree/master/samples/STM32L476GDISCOVERY/Src/Eve/dependencies/eve_hal

The screen would appear as a white blinding effect and glitches whenever an animation was displayed. I verified that the flash was properly functioning and programmed with the flash file from the ESD exported project Data folder using the EAB. In addition to the EVChargePoint project, I exported and ported the PlayAnimation project. Similar issues were encountered, and the attached GIFs show what occurred.
  • AnimationIssue_Init.gif: Following powerup, the last calibration point is touched
  • AnimationIssue_Start.gif: Following calibration, the location where "Start" pushbutton should be displayed is touched
  • AnimationIssue_Stop.gif: Following starting the animation, the location where "Stop" pushbutton should be displayed is touched

Here's the output when running the project:
Code: [Select]
Copyright (C) Bridgetek Pte Ltd
sizeof(Esd_GpuHandle): 4
sizeof(Esd_ResourceInfo): 16
sizeof(Esd_FontInfo): 44
sizeof(Esd_RomFontInfo): 8
EVE ROM_CHIPID after wake up 0
EVE ROM_CHIPID after wake up 0
EVE ROM_CHIPID after wake up ffffffff
EVE chip id 817 1.0
EVE register ID after wake up 7c
EVE clock frequency set to 72 MHz
Single channel SPI
All engines are ready
Display refresh rate set to
Configure coprocessor defaults
EVE configuration ready
Esd_Calibrate: Start Frame
Esd_Calibrate: End Frame
Touch screen transform values are A 0x1069c,B 0xffffed07,C 0xef03a,D 0x335,E 0xffc3, F 0xfff3f012
Flash OK
Use handle 0, font 31
Use handle 1, font 27

In a new STM32 project I implemented a similar approach to drawing animations using a modified version of Rudolph's library and a simple 250x250 2 frame gif converted to an animation.
https://github.com/RudolphRiedel/FT800-FT813
The commented lines labeled TEST CODE were uncommented to match the commands being executed within the exported project file Esd_lion.c's Esd_lion_lionStart_Signal, Esd_lion_lionEnd_Signal, & Esd_lion_Render_Signal functions. Regardless, calling the below SAMAPP_Animation function within the main while loop resulted in the animation being rendered properly as shown in the AnimationSimple.gif.
Code: [Select]
static void SAMAPP_Animation(uint8_t *init, uint8_t *refresh, Button_Param_s **buttons, uint8_t num_buttons, uint8_t* anim_state)
{
  uint32_t rd32_val;
  static uint8_t anim_state_prev = 0;
 
  if(*init){
    if(!cmd_fifo_busy_blk()){
      *anim_state = 0;
      anim_state_prev = 0;
   
      cmd_fifo_buffer_clr();
      cmd_fifo_buffer_wr(CMD_DLSTART);
      cmd_fifo_buffer_wr(CLEAR(1, 1, 1));
     
      cmd_fifo_buffer_wr(BEGIN(RECTS));
      cmd_fifo_buffer_wr(TAG(SAMAPP_ANIMATION_TOUCHTAGS_BACKGROUND));
      cmd_fifo_buffer_wr(COLOR_RGB(0,0,0));
      cmd_fifo_buffer_wr(VERTEX2F(0, 0));
      cmd_fifo_buffer_wr(VERTEX2F(16383, 9600));
      cmd_fifo_buffer_wr(END());
     
      cmd_fifo_buffer_wr(BEGIN(RECTS));
      cmd_fifo_buffer_wr(TAG(SAMAPP_ANIMATION_TOUCHTAGS_ANIMATION));
      cmd_fifo_buffer_wr(COLOR_RGB(255,255,255));
      cmd_fifo_buffer_wr(VERTEX2F(6192, 2800));
      cmd_fifo_buffer_wr(VERTEX2F(10192, 6800));
      cmd_fifo_buffer_wr(END());
     
      cmd_animframe(EVE_HSIZE/2,EVE_VSIZE/2,SIMP_ANIM_ADDR,0);
//      cmd_animdraw(1); // XXX: TEST CODE
           
      button_widget_loop_cfb(buttons,num_buttons);
     
      cmd_fifo_buffer_wr(DISPLAY());
      cmd_fifo_buffer_wr(CMD_SWAP);
      cmd_fifo_buffer_tx_blk();
     
      *init = 0;
    }
  }
  else if( *refresh || *anim_state ){
    if(!cmd_fifo_busy_blk()){
   
      host_rd32_blk(REG_DLSWAP,&rd32_val);
      if( 0 == rd32_val ){
        cmd_fifo_buffer_clr();
        cmd_fifo_buffer_wr(CMD_DLSTART);
        cmd_fifo_buffer_wr(CLEAR(1, 1, 1));
       
        cmd_fifo_buffer_wr(BEGIN(RECTS));
        cmd_fifo_buffer_wr(TAG(SAMAPP_ANIMATION_TOUCHTAGS_BACKGROUND));
        cmd_fifo_buffer_wr(COLOR_RGB(0,0,0));
        cmd_fifo_buffer_wr(VERTEX2F(0, 0));
        cmd_fifo_buffer_wr(VERTEX2F(16383, 9600));
        cmd_fifo_buffer_wr(END());
       
        cmd_fifo_buffer_wr(BEGIN(RECTS));
        cmd_fifo_buffer_wr(TAG(SAMAPP_ANIMATION_TOUCHTAGS_ANIMATION));
        cmd_fifo_buffer_wr(COLOR_RGB(255,255,255));
        cmd_fifo_buffer_wr(VERTEX2F(6192, 2800));
        cmd_fifo_buffer_wr(VERTEX2F(10192, 6800));
        cmd_fifo_buffer_wr(END());
       
        if( *anim_state != anim_state_prev ){
          if(*anim_state){
            cmd_animstart(1,SIMP_ANIM_ADDR,ANIM_LOOP);
            cmd_animxy(1,EVE_HSIZE/2,EVE_VSIZE/2);
            cmd_animdraw(1);
          }
          else{
            cmd_animstop(1);
            cmd_animframe(EVE_HSIZE/2,EVE_VSIZE/2,SIMP_ANIM_ADDR,0);
//            cmd_animdraw(1); // XXX: TEST CODE
          }
          anim_state_prev = *anim_state;
        }
        else{
          if(*anim_state){
//            cmd_animxy(1,EVE_HSIZE/2,EVE_VSIZE/2); // XXX: TEST CODE
            cmd_animdraw(1);
          }
          else{
            cmd_animframe(EVE_HSIZE/2,EVE_VSIZE/2,SIMP_ANIM_ADDR,0);
//            cmd_animdraw(1); // XXX: TEST CODE
          }
        }
       
        button_widget_loop_cfb(buttons,num_buttons);
       
        cmd_fifo_buffer_wr(DISPLAY());
        cmd_fifo_buffer_wr(CMD_SWAP);
        cmd_fifo_buffer_tx_blk();
      }
    }
  }
}

Following that I updated the displays flash with the exported projects bin file and changed the programs SIMP_ANIM_ADDR to point to the location of the lion animation object. The white blinding effect and glitches appeared again. I also tried to rebuild the bin file using the lion.anim file in EAB, but as expected there wasn't a difference between the files and the issues still occurred. I'm assuming there is some issue relating to the lion.anim file (and AnimationScreensaver.bin). Any idea what could be the underlying issue or potential limitations with respect to displaying animations on the physical hardware that may not appear within ESD?

Pages: [1]