VU bitmap is 8bits grayscale, not RGB332 - release

This commit is contained in:
philippe44
2020-03-24 15:31:13 -07:00
parent 6ad532a276
commit cd5693a81c
4 changed files with 21 additions and 27 deletions

View File

@@ -215,13 +215,21 @@ void GDS_DrawRGB16( struct GDS_Device* Device, uint16_t *Image, int x, int y, in
}
/****************************************************************************************
* Simply draw a RGB 8 bits image (R:3,G:3,B:2)
* Simply draw a RGB 8 bits image (R:3,G:3,B:2) or plain grayscale
* monochrome (0.2125 * color.r) + (0.7154 * color.g) + (0.0721 * color.b)
* grayscale (0.3 * R) + (0.59 * G) + (0.11 * B) )
*/
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height ) {
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode ) {
if (Device->DrawRGB8) {
Device->DrawRGB8( Device, Image, x, y, Width, Height );
Device->DrawRGB8( Device, Image, x, y, Width, Height, RGB_Mode );
} else if (RGB_Mode == GDS_GRAYSCALE) {
// 8 bits pixels
int Scale = 8 - Device->Depth;
for (int r = 0; r < Height; r++) {
for (int c = 0; c < Width; c++) {
GDS_DrawPixel( Device, c + x, r + y, *Image++ >> Scale);
}
}
} else if (Device->Depth < 3) {
// 3 bits pixels to be placed
int Scale = 3 - Device->Depth;

View File

@@ -7,7 +7,7 @@
struct GDS_Device;
enum { GDS_RGB565, GDS_RGB555, GDS_RGB444 };
enum { GDS_RGB565, GDS_RGB555, GDS_RGB444, GDS_RGB332, GDS_GRAYSCALE };
// Fit options for GDS_DrawJPEG
#define GDS_IMAGE_LEFT 0x00
@@ -24,4 +24,4 @@ uint16_t* GDS_DecodeJPEG(uint8_t *Source, int *Width, int *Height, float Scale)
void GDS_GetJPEGSize(uint8_t *Source, int *Width, int *Height);
bool GDS_DrawJPEG( struct GDS_Device* Device, uint8_t *Source, int x, int y, int Fit);
void GDS_DrawRGB16( struct GDS_Device* Device, uint16_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height );
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode );

View File

@@ -112,7 +112,7 @@ struct GDS_Device {
void (*DrawBitmapCBR)(struct GDS_Device* Device, uint8_t *Data, int Width, int Height, int Color );
// may provide for optimization
void (*DrawRGB16)( struct GDS_Device* Device, uint16_t *Image,int x, int y, int Width, int Height, int RGB_Mode );
void (*DrawRGB8)( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height );
void (*DrawRGB8)( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
void (*ClearWindow)( struct GDS_Device* Device, int x1, int y1, int x2, int y2, int Color );
// interface-specific methods