BRT Community

General Category => Discussion - EVE => Topic started by: bobgardner on May 16, 2019, 06:38:26 PM

Title: Draw a couple lines on a button?
Post by: bobgardner on May 16, 2019, 06:38:26 PM
Hello EVE programmers. I have a matrix orbital 29a tft and the arduino shield. I can draw a big button 208x86 in the middle of the screen which is 320x102. Now I'd like to add a couple of 1 pixel wide horz lines at the top of the button like from 58,10 to 250,10 and 2 lines below that. Here's what Ive got
//------------------------------------------
void MakeScreen_Kln(void)
{
  Send_CMD(CMD_DLSTART);
  Send_CMD(CLEAR_COLOR_RGB(0,0,0));   
  Send_CMD(CLEAR(1,1,1));
 
  Send_CMD(COLOR_RGB(60,60,60));       //color gray                     
  Cmd_FGcolor(0xffffff);               //white 

  Send_CMD(CMD_SETROTATE);    //works
  Send_CMD(1);                //inverted landscape

  //---------x   y  w    h   fnt opt   
  Cmd_Button(56, 8, 208, 86, 28, 0xff, "208x86"); //gets here! 

  //  Send_CMD(LINE_WIDTH(1));             //these 7 lines dont work
  Cmd_FGcolor(0x000000);     //black 
  Send_CMD(BEGIN(LINES));
  Send_CMD(VERTEX2F(58,10)); //thin horz line
  Send_CMD(VERTEX2F(250,10));
  Send_CMD(VERTEX2F(58,12)); //thin horz line
  Send_CMD(VERTEX2F(250,12));

  Send_CMD(DISPLAY());
  Send_CMD(CMD_SWAP); 
  UpdateFIFO();                                            // Trigger the CoProcessor to start processing the FIFO
}

I guess you see I am using the matrix orbital arduino example, please forgive me. Any idea how to get the lines to draw at the top of the button? Thanks.
Title: Re: Draw a couple lines on a button?
Post by: BRT Community on May 17, 2019, 01:28:05 PM
Hello,

The LINE_WIDTH() command sets the width of a line in 1/16 of a pixel increments. So using LINE_WIDTH(1) will set the line to 1/16 of a pixel wide. This is also the same with the VERTEX2F() command, it works on 1/16 of a pixel accuracy.

Also you've set the color of the lines to be black, which is also the background color for your display.

Try either selecting a different color for the background color, or line color and using VERTEX2II (or adjusting the values in VERTEX2F accordingly):
Code: [Select]
CLEAR_COLOR_RGB(255, 0, 0)
CLEAR(1,1,1)
COLOR_RGB(60,60,60)
CMD_FGCOLOR(0XFFFFFF)
CMD_BUTTON(56, 8, 208, 86, 28, OPT_FLAT, "208x86")
COLOR_RGB(0, 0, 0)
BEGIN(LINES)
VERTEX2II(55, 7, 0, 0)
VERTEX2II(55, 95, 0, 0)
VERTEX2II(265, 95, 0, 0)
VERTEX2II(55, 95, 0, 0)
VERTEX2II(265, 95, 0, 0)
VERTEX2II(265, 7, 0, 0)
VERTEX2II(55, 7, 0, 0)
VERTEX2II(265, 7, 0, 0)
END()

Best Regards,
BRT Community
Title: Re: Draw a couple lines on a button?
Post by: bobgardner on May 17, 2019, 06:45:48 PM
My Big Picture is: I have a bunch o 208x86 1bpp screens that I was shifting out to a crt. Now I have this eve2-29a tft thats 320x102, but it fits exactly in the hole where the crt went. In the previous question, I really did want to draw a couple of 1 pixel lines with a 1 pix space between them, just to test the resolution. Seems to work fine if I set line width(0) which is 1 pixel, and use vertex2f. All good so far. Now I want to load a 208x86 screen bitmap into eve ram somewhere, and scale it up in x by 320/208, and scale it up in y by 102/80. Since scale uses a 16bit frac part, I guess its 320*65536/208. So I'd love to see cmds to load the bitmap from the arduino flash array 2236 bytes, and how to scale it to the screen. Thanks so much folks.
Title: Re: Draw a couple lines on a button?
Post by: BRT Community on May 20, 2019, 11:01:09 AM
Hello,

section 7 of the following application note covers several ways to load images to EVE, this is based on PIC code, but the procedure will be the same for Arduino:
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/BRT_AN_014_FT81X_Simple_PIC_Library_Examples.pdf (https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/BRT_AN_014_FT81X_Simple_PIC_Library_Examples.pdf)

You can then look at our main Sample Application, the SAMAPP_CoPro_Matrix() function provides some examples of scaling bitmaps, this sample includes Arduino code:
https://brtchip.com/SoftwareExamples-eve/#Sample%20App(+EVE2) (https://brtchip.com/SoftwareExamples-eve/#Sample%20App(+EVE2))


Best Regards,
BRT Commuity
Title: img_cvt doesnt like L1?
Post by: bobgardner on May 20, 2019, 07:40:11 PM
Trying to cvt my 208x86 png file to bin using img_cvt. Get error msg about L1.
Title: Re: Draw a couple lines on a button?
Post by: bobgardner on May 21, 2019, 08:52:39 PM
OK, if I use 1 as the format instead of L1, the converter works and creates the directory and bin and raw files. How bout someone look at that tif file and figger out a way to get it on the eve tft? Thanx!
Title: Re: Draw a couple lines on a button?
Post by: BRT Community on May 22, 2019, 09:28:47 AM
Hello,

The previous linked BRT_AN_014 includes examples for using images in your application, please refer to this.

The following application note may also be helpful:
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/AN_314_FT800_Advanced-Techniques_Working-with-Bitmaps.pdf (https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/AN_314_FT800_Advanced-Techniques_Working-with-Bitmaps.pdf)

Best Regards,
BRT Community