|
Post by lightcalamar on Feb 22, 2017 4:30:07 GMT -8
With tools gd2asset convert. After this post link need more than 15 handles, please How to convert this image with 2 cells? My code convert this; gd2asset -o logo.h logo.jpg,format=ARGB4 Only one cell. why?
|
|
|
Post by jamesbowman on Feb 22, 2017 9:58:45 GMT -8
#include <EEPROM.h> #include <SPI.h> #include <GD2.h>
#include "logo.h"
void setup() { GD.begin(); LOAD_ASSETS(); GD.BitmapLayout(ARGB4, 2 * 64, 64); // override the bitmap layout }
void loop() { GD.cmd_gradient(0, 0, 0x103010, 480, 480, 0x101030); GD.Begin(BITMAPS); GD.Vertex2ii(100, 100, 0, 0); GD.Vertex2ii(200, 100, 0, 1); GD.swap(); }
You can do it like this. The call to BitmapLayout tells the GPU to "split" the bitmap into cells of 64x64 pixels.
|
|
|
Post by lightcalamar on Feb 23, 2017 14:23:25 GMT -8
Thanks you James, Works fine. One question. I want to now put two images this for example; and ; My code asset-converter this; gd2asset -o logos.h logo.jpg,format=ARGB4 logo2.jpg,format=ARGB4
My Code Arduino MEGA is; #include <EEPROM.h> #include <SPI.h> #include <GD2.h>
#include "logos.h"
#define PDNPin 8 // Señal P.O.R. TFT FT800
void setup() { pinMode(PDNPin, OUTPUT); // CONTROL P.O.R. Power On Reset digitalWrite(PDNPin, HIGH); // Pantalla FT800 comparada delay(20); // en http://HotMCU.com digitalWrite(PDNPin, LOW); // | delay(20); // | digitalWrite(PDNPin, HIGH); // | delay(20); // | GD.begin(); LOAD_ASSETS(); GD.BitmapLayout(ARGB4, 2 * 64, 64); // override the bitmap layout }
void loop() { GD.Clear(); GD.cmd_gradient(0, 0, 0x103010, 480, 480, 0x101030); GD.Begin(BITMAPS); GD.Vertex2ii(100, 100, 0, 0); GD.Vertex2ii(300, 100, 0, 1); GD.End();
GD.Begin(BITMAPS); GD.Vertex2ii(200, 200, 1, 0); GD.Vertex2ii(300, 200, 1, 1); GD.End(); GD.swap(); } This obtained ; You can help me? Thanks ! Attachments:
logos.h (36.99 KB)
|
|
|
Post by jamesbowman on Feb 23, 2017 14:26:54 GMT -8
Sure, in this example you now have two handles (LOGO_HANDLE and LOGO2_HANDLE). You need to change the layout for each handle, like this:
GD.BitmapHandle(LOGO_HANDLE); GD.BitmapLayout(ARGB4, 2 * 64, 64); GD.BitmapHandle(LOGO2_HANDLE); GD.BitmapLayout(ARGB4, 2 * 64, 64);
|
|
|
Post by lightcalamar on Feb 23, 2017 14:51:11 GMT -8
Infinite thanks James, this be a result; #include <EEPROM.h> #include <SPI.h> #include <GD2.h>
#include "logos.h"
#define PDNPin 8 // Señal P.O.R. TFT FT800
void setup() { pinMode(PDNPin, OUTPUT); // CONTROL P.O.R. Power On Reset digitalWrite(PDNPin, HIGH); // Pantalla FT800 comparada delay(20); // en http://HotMCU.com digitalWrite(PDNPin, LOW); // | delay(20); // | digitalWrite(PDNPin, HIGH); // | delay(20); // |
GD.begin(); LOAD_ASSETS();
GD.BitmapHandle(LOGO_HANDLE); GD.BitmapLayout(ARGB4, 2 * 64, 64); GD.BitmapHandle(LOGO2_HANDLE); GD.BitmapLayout(ARGB4, 2 * 64, 64); }
void loop() { GD.ClearColorRGB(0, 0, 0); // GD.Clear(1, 1, 1); GD.Clear(); /* GD.cmd_button(0, 0, 479, 45, 30, 0, "Estacion Meteo");
GD.Begin(LINES); GD.Vertex2ii(0, 50, 20, 0); GD.Vertex2ii(480, 50, 20, 0); GD.Vertex2ii(0, 54, 20, 0); GD.Vertex2ii(480, 54, 20, 0); GD.End(); // GD.End(); */
// GD.cmd_gradient(0, 0, 0x103010, 480, 480, 0x101030); GD.Begin(BITMAPS); GD.Vertex2ii(100, 100, 0, 0); GD.Vertex2ii(300, 100, 0, 1); GD.End();
GD.Begin(BITMAPS); GD.Vertex2ii(200, 200, 1, 0); GD.Vertex2ii(300, 200, 1, 1); GD.End(); GD.swap(); }
This I seek. Take more than 10 days to find a solution ... You give. To give you infinite thanks again. Thomas.
|
|