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

Main Menu

Draw a couple lines on a button?

Started by bobgardner, May 16, 2019, 06:38:26 PM

Previous topic - Next topic

bobgardner

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.

BRT Community

#1
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):
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

bobgardner

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.

BRT Community

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

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)


Best Regards,
BRT Commuity

bobgardner

Trying to cvt my 208x86 png file to bin using img_cvt. Get error msg about L1.

bobgardner

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!

BRT Community

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

Best Regards,
BRT Community