summaryrefslogtreecommitdiff
path: root/atari/plot/plotter.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2011-12-31 15:21:49 +0000
committerOle Loots <ole@monochrom.net>2011-12-31 15:21:49 +0000
commita195728c51a34e68b4361cb685d3e20acbbecbe0 (patch)
treeff7e5408d90eee8d525a1bcb6961f0c604f05a20 /atari/plot/plotter.c
parent7124d96b1f974799e5b0ea140a7ebf67208a119f (diff)
downloadnetsurf-a195728c51a34e68b4361cb685d3e20acbbecbe0.tar.gz
netsurf-a195728c51a34e68b4361cb685d3e20acbbecbe0.tar.bz2
Added support for 8bit displays, having big problems with transparent plots ( snapshot of background isn't always taken from correct position, maybe a bug in fvdi)
svn path=/trunk/netsurf/; revision=13359
Diffstat (limited to 'atari/plot/plotter.c')
-rwxr-xr-xatari/plot/plotter.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/atari/plot/plotter.c b/atari/plot/plotter.c
index 44183d938..8359215c1 100755
--- a/atari/plot/plotter.c
+++ b/atari/plot/plotter.c
@@ -627,10 +627,20 @@ void rgb_to_vdi1000( unsigned char * in, unsigned short * out )
out[2] = 1000 * b + 0.5;
return;
}
+
+void vdi1000_to_rgb( unsigned short * in, unsigned char * out )
+{
+ double r = ((double)in[0]/1000); /* prozentsatz red */
+ double g = ((double)in[1]/1000); /* prozentsatz green */
+ double b = ((double)in[2]/1000); /* prozentsatz blue */
+ out[2] = 255 * r + 0.5;
+ out[1] = 255 * g + 0.5;
+ out[0] = 255 * b + 0.5;
+ return;
+}
-
-static short web_std_colors[6] = {0, 51, 102, 153, 204, 255};
+static short web_std_colors[6] = {0, 51, 102, 153, 204, 255};
/*
Convert an RGB color into an index into the 216 colors web pallette
@@ -640,7 +650,20 @@ short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b)
short ret = 0;
short i;
unsigned char rgb[3] = {r,g,b};
- unsigned char tval[3];
+ unsigned char tval[3];
+
+ int diff_a, diff_b, diff_c;
+ diff_a = abs(r-g);
+ diff_b = abs(r-b);
+ diff_c = abs(r-b);
+ if( diff_a < 2 && diff_b < 2 && diff_c < 2 ){
+ if( (r!=0XFF) && (g!=0XFF) && (g!=0XFF) ){
+ if( ((r&0xF0)>>4) != 0 )
+ //printf("conv gray: %x -> %d\n", ((r&0xF0)>>4) , (OFFSET_CUST_PAL) + ((r&0xF0)>>4) );
+ return( (OFFSET_CUST_PAL - OFFSET_WEB_PAL) + ((r&0xF0)>>4) );
+ }
+ }
+
/* convert each 8bit color to 6bit web color: */
for( i=0; i<3; i++) {
if(0 == rgb[i] % web_std_colors[1] ) {