I am trying to display an array of 16-bit numbers, of datatype color_t. I have an image dimensions 59x82 and I have uploaded the image to SourceCoder3 and I have retrieved an array of color_t under the section

Code:
Prizm/Nspire C (16-Bit Color)


However when I add the array to the code and display it using CopySprite it shows up as a black box with width 59 and height of 82

Code:

color_t sprite[9676] = {...};
CopySprite(sprite, 30, 30, 59, 82);


Here is the implementation for CopySprite

Code:

void CopySprite(color_t* sprite, int x, int y, int width, int height) {
   color_t* VRAM = (color_t*)GetVRAMAddress();
   VRAM += LCD_WIDTH_PX*y + x;
   
   for(int j=y; j<y+height; j++) {
      for(int i=x; i<x+width; i++) {
         *(VRAM++) = *(sprite++);
      }
      VRAM += LCD_WIDTH_PX-width;
   }
}


Here is the image I am trying to show


I am sorry if I am not being clear enough and if you need anymore information just ask Smile
Are you calling Bdisp_EnableColor before attempting to display the image? I suspect that might lead to incorrect display similar to what you're reporting.
Oooooohhhhhh, yeah thats why. I guess that the image is so dark that it all gets converted to black, thank you so much.
Using Prizm/Nspire C (1/2/4/8-Bit Palettized Color) would reduce the overall size of your add-in depending on what you're trying to accomplish.
https://prizm.cemetech.net/Useful_Routines/CopySpriteNBit/
https://prizm.cemetech.net/Useful_Routines/CopySpriteNbitMasked/
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement