|
Post by richardf on Feb 19, 2019 9:19:01 GMT -8
I have a 7" display. I can display buttons and such all over the screen correctly.
When I draw rectangles, though, if I draw a rectangle past about x=448 the rectangles are not drawn correctly. See my example where if I draw to x=511 it works but doesn't work at x=512. There appears to be a 9-bit mask in Vertex2II
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>
void setup()
{
GD.begin(0);
GD.cmd_setrotate(0);
}
void loop()
{
GD.ClearColorRGB(0x000000);
GD.Clear();
GD.ColorRGB(0xffffff);
GD.cmd_text(GD.w / 2, GD.h / 2, 31, OPT_CENTER, "Hello world");
DrawColorBox();
GD.swap();
}
void DrawColorBox()
{
GD.Begin(RECTS);
GD.ColorRGB(0x0000ff);
GD.Vertex2ii(50, 50);
GD.Vertex2ii(512, 100); // works at 511
}
|
|
|
Post by tftlcdcyg on Feb 19, 2019 13:02:00 GMT -8
Try this
void DrawColorBox() { GD.Begin(RECTS); GD.ColorRGB(0x0000ff); GD.Vertex2f(50*16, 50*16); GD.Vertex2f(512*16, 100*16); // works beyond 511! }
|
|
|
Post by hillridge on Mar 18, 2019 12:18:35 GMT -8
The problem with using Vertex2f is that you can't use it with bitmap handles. If you don't need those, no problem, it's the easiest solution. You can get around the 0-511 limitation of Vertex2ii by using the vertex_translate_x and vertex_translate_y commands to set an offset. The offset is in 1/16ths of a pixel, so make sure to take that into account.
|
|
|
Post by hillridge on Mar 18, 2019 14:40:16 GMT -8
Actually, I think you can set handles and cells for vertex2f, but it takes extra commands.
|
|