comparison tools/lib64gfx.c @ 1732:07111a60cd4e

Add dmSetMixedColorC64Palette() for setting a 256 entry "mixed color" palette, which consists of averaged 16 x 16 matrix of C64 palette. This can be used for rendering images that use color interlace.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 08 Jun 2018 22:09:00 +0300
parents 474055f25ab0
children eeb6a82b4654
comparison
equal deleted inserted replaced
1731:474055f25ab0 1732:07111a60cd4e
110 { 110 {
111 img->constpal = TRUE; 111 img->constpal = TRUE;
112 img->pal = dmDefaultC64Palette; 112 img->pal = dmDefaultC64Palette;
113 img->ncolors = C64_NCOLORS; 113 img->ncolors = C64_NCOLORS;
114 img->ctransp = 255; 114 img->ctransp = 255;
115 }
116
117
118 BOOL dmSetMixedColorC64Palette(DMImage *img)
119 {
120 if (!dmImagePaletteAlloc(dst, C64_NCOLORS * C64_NCOLORS, -1))
121 return FALSE;
122
123 int n = 0;
124 for (int n1 = 0; n1 < C64_NCOLORS; n1++)
125 {
126 const DMColor *col1 = &dmDefaultC64Palette[n1];
127 for (int n2 = 0; n2 < C64_NCOLORS; n2++)
128 {
129 const DMColor *col2 = &dmDefaultC64Palette[n2];
130 dst->pal[n].r = (col1->r + col2->r) / 2;
131 dst->pal[n].g = (col1->g + col2->g) / 2;
132 dst->pal[n].b = (col1->b + col2->b) / 2;
133 n++;
134 }
135 }
136
137 return TRUE;
115 } 138 }
116 139
117 140
118 BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr) 141 BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr)
119 { 142 {