What is the command i need to change the button image?
Can you tell me what to send to the screen? I have all the assets in the auto generated directory, so how do i point to one to load as the background?
Change Button Image
Moderator: Mods
-
- Matrix Orbital
- Posts: 247
- Joined: Thu Sep 24, 2015 9:38 am
Re: Change Button Image
Hi Haz,
Each button has at least 3 bitmaps assigned to it corresponding with the three available states: The Up Bitmap, Down Bitmap, and Disabled Bitmap. You can upload different images to the GTT's RAM, and actively change each of these bitmaps individually using their set_bitmap commands.
The Set_Bitmap command byte strings are as follows:
Set_Up_Bitmap: 254 250 1 6 0 <Object_ID> 21 9 0 <Bitmap_ID>
Set_Down_Bitmap: 254 250 1 6 0 <Object_ID> 21 10 0 <Bitmap_ID>
Set_Disabled_Bitmap: 254 250 1 <Object_ID> 0 4 21 14 0 <Bitmap_ID>
If you are using a custom image, you may have to load the image into the GTT's display ram first.You can do this using the Bitmap Load command:
Bitmap_Load: 254 250 13 0 0 <Bitmap_ID> 0 <etext_encoding> <String_Length> <String>
etext_encoding: Unicode = 0, ASCII = 1, UTF-8 = 2
As an example, if I had 3 images and that I wanted to use for the Up, Down, and Disabled bitmaps on a button (Object_ID 14), I would have to send the following:
Bitmap_Load(15, Unicode, 24, UpBitmap.bmp);
//data stream: 254 250 13 0 0 15 0 0 24 85 0 112 0 66 0 105 0 116 0 109 0 97 0 112 0 46 0 98 0 109 0 112 0
Bitmap_Load(16, Unicode, 28, DownBitmap.bmp);
//data stream: 254 250 13 0 0 16 0 0 28 68 0 111 0 119 0 110 0 66 0 105 0 116 0 109 0 97 0 112 0 46 0 98 0 109 0 112 0
Bitmap_Load(17, Unicode, 36, DisabledBitmap.bmp);
//data stream: 254 250 13 0 0 17 0 0 36 68 0 105 0 115 0 97 0 98 0 108 0 101 0 100 0 66 0 105 0 116 0 109 0 97 0 112 0 46 0 98 0 109 0 112 0
Set_Up_Bitmap(14, 15);
//data stream: 254 250 1 6 0 14 21 9 0 15
Set_Down_Bitmap(14, 16);
//data stream: 254 250 1 6 0 14 21 10 0 16
Set_Disabled_Bitmap(14, 17);
//data stream: 254 250 1 6 0 14 21 14 0 17
It is important to note that Object_ID values and Bitmap_ID values cannot be shared.
Cheers,
Daniel
Each button has at least 3 bitmaps assigned to it corresponding with the three available states: The Up Bitmap, Down Bitmap, and Disabled Bitmap. You can upload different images to the GTT's RAM, and actively change each of these bitmaps individually using their set_bitmap commands.
The Set_Bitmap command byte strings are as follows:
Set_Up_Bitmap: 254 250 1 6 0 <Object_ID> 21 9 0 <Bitmap_ID>
Set_Down_Bitmap: 254 250 1 6 0 <Object_ID> 21 10 0 <Bitmap_ID>
Set_Disabled_Bitmap: 254 250 1 <Object_ID> 0 4 21 14 0 <Bitmap_ID>
If you are using a custom image, you may have to load the image into the GTT's display ram first.You can do this using the Bitmap Load command:
Bitmap_Load: 254 250 13 0 0 <Bitmap_ID> 0 <etext_encoding> <String_Length> <String>
etext_encoding: Unicode = 0, ASCII = 1, UTF-8 = 2
As an example, if I had 3 images and that I wanted to use for the Up, Down, and Disabled bitmaps on a button (Object_ID 14), I would have to send the following:
Bitmap_Load(15, Unicode, 24, UpBitmap.bmp);
//data stream: 254 250 13 0 0 15 0 0 24 85 0 112 0 66 0 105 0 116 0 109 0 97 0 112 0 46 0 98 0 109 0 112 0
Bitmap_Load(16, Unicode, 28, DownBitmap.bmp);
//data stream: 254 250 13 0 0 16 0 0 28 68 0 111 0 119 0 110 0 66 0 105 0 116 0 109 0 97 0 112 0 46 0 98 0 109 0 112 0
Bitmap_Load(17, Unicode, 36, DisabledBitmap.bmp);
//data stream: 254 250 13 0 0 17 0 0 36 68 0 105 0 115 0 97 0 98 0 108 0 101 0 100 0 66 0 105 0 116 0 109 0 97 0 112 0 46 0 98 0 109 0 112 0
Set_Up_Bitmap(14, 15);
//data stream: 254 250 1 6 0 14 21 9 0 15
Set_Down_Bitmap(14, 16);
//data stream: 254 250 1 6 0 14 21 10 0 16
Set_Disabled_Bitmap(14, 17);
//data stream: 254 250 1 6 0 14 21 14 0 17
It is important to note that Object_ID values and Bitmap_ID values cannot be shared.
Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital
Technical Support
Matrix Orbital
Re: Change Button Image
Thank you Daniel,
For the bitmap ID, I have some bitmaps which are loaded as they are all part of objects already, so i am assuming they get loaded when the screen script runs.
How can i get the bitmap ID? I am able to get all the object IDs, so i know there is no overlap. Those are generated in the project .h file in the output directory.
But I see no reference to the bitmap IDs for images already loaded so i know what is loaded, and what i need to load and which ID is available for me to use with images i will load in my program vs. startup.
Thanks,
H-
For the bitmap ID, I have some bitmaps which are loaded as they are all part of objects already, so i am assuming they get loaded when the screen script runs.
How can i get the bitmap ID? I am able to get all the object IDs, so i know there is no overlap. Those are generated in the project .h file in the output directory.
But I see no reference to the bitmap IDs for images already loaded so i know what is loaded, and what i need to load and which ID is available for me to use with images i will load in my program vs. startup.
Thanks,
H-
Re: Change Button Image
Also, one more clarification. Do i only need the name of the bitmap? Or do i need a path?
If I need a path, what is it relative to?
Thank you,
H-
If I need a path, what is it relative to?
Thank you,
H-
-
- Matrix Orbital
- Posts: 247
- Joined: Thu Sep 24, 2015 9:38 am
Re: Change Button Image
Hi Haz,
The best place to find your project Bitmap_IDs is the autoexec.txt file in your GTT project output folder. Near the top of the script, you will find a list of Bitmap_Load() commands, each specifying their own Bitmap_IDs. By referencing both the autoexec.txt file and the project.h file, you'll be able to determine what IDs are available.
You will need the path name, relative to the root of the SD card. In my previous example, the images would have been stored directly on the SD card, and not hidden in folders.
Cheers,
Daniel
The best place to find your project Bitmap_IDs is the autoexec.txt file in your GTT project output folder. Near the top of the script, you will find a list of Bitmap_Load() commands, each specifying their own Bitmap_IDs. By referencing both the autoexec.txt file and the project.h file, you'll be able to determine what IDs are available.
You will need the path name, relative to the root of the SD card. In my previous example, the images would have been stored directly on the SD card, and not hidden in folders.
Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital
Technical Support
Matrix Orbital
Re: Change Button Image
Perfect. Found them. That's exactly what i was looking for.