From 9bcb3dc17e38fac3ee02ed07a1b896d550285afb Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 17 Apr 2023 23:29:20 -0400 Subject: [PATCH] hgr: mess around with gimp palettes --- graphics/hgr_viewer/palette/make_pal.c | 53 +++++++++++++++++++ graphics/hgr_viewer/palette/orange_blue.gpl | 21 ++++++++ .../hgr_viewer/palette/orange_blue_half.gpl | 20 +++++++ 3 files changed, 94 insertions(+) create mode 100644 graphics/hgr_viewer/palette/make_pal.c create mode 100644 graphics/hgr_viewer/palette/orange_blue.gpl create mode 100644 graphics/hgr_viewer/palette/orange_blue_half.gpl diff --git a/graphics/hgr_viewer/palette/make_pal.c b/graphics/hgr_viewer/palette/make_pal.c new file mode 100644 index 00000000..5fc15b3f --- /dev/null +++ b/graphics/hgr_viewer/palette/make_pal.c @@ -0,0 +1,53 @@ +#include +#include + +static int gradient[9][16]={ + {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}, + {1,0,1,0, 0,0,0,0, 0,1,0,1, 0,0,0,0}, + {1,0,1,0, 0,1,0,1, 1,0,1,0, 0,1,0,1}, + {0,1,0,1, 1,1,1,1, 1,0,1,0, 1,1,1,1}, + {1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1}, + {2,1,2,1, 1,1,1,1, 1,2,1,2, 1,1,1,1}, + {2,1,2,1, 2,1,2,1, 2,1,2,1, 2,1,2,1}, + {1,2,1,2, 2,2,2,2, 2,1,2,1, 2,2,2,2}, + {2,2,2,2, 2,2,2,2, 2,2,2,2, 2,2,2,2}, +}; + +static int pal_rgb[6][3]={ + {0x00,0x00,0x00}, // black + {0x1b,0xcb,0x01}, // green + {0xe4,0x34,0xfe}, // purple + {0xcd,0x5b,0x01}, // orange + {0x1b,0x9a,0xfe}, // blue + {0x00,0x00,0x00}, // white +}; + +int main(int argc, char **argv) { + + int which=4; + int c,x; + + int r,g,b; + + for(x=0;x<9;x++) { + r=0; + g=0; + b=0; + for(c=0;c<16;c++) { + if (gradient[x][c]==0) { + } + if (gradient[x][c]==1) { + r=r+(pal_rgb[which][0]*pal_rgb[which][0]); + g=g+(pal_rgb[which][1]*pal_rgb[which][1]); + b=b+(pal_rgb[which][2]*pal_rgb[which][2]); + } + if (gradient[x][c]==2) { + r=r+(0xff*0xff); + g=g+(0xff*0xff); + b=b+(0xff*0xff); + } + } + printf("%d %d %d\n",(int)sqrt(r/16.0),(int)sqrt(g/16.0),(int)sqrt(b/16.0)); + } + return 0; +} diff --git a/graphics/hgr_viewer/palette/orange_blue.gpl b/graphics/hgr_viewer/palette/orange_blue.gpl new file mode 100644 index 00000000..cce0c390 --- /dev/null +++ b/graphics/hgr_viewer/palette/orange_blue.gpl @@ -0,0 +1,21 @@ +GIMP Palette +Name: Hires Gradient +Columns: 0 +# + 0 0 0 Black +102 45 0 Darkest Orange +144 64 0 Dark Orange +177 78 0 LightDark Orange +205 91 1 Orange +218 149 127 Darklight Orange +231 191 180 Light Orange +243 225 220 Lightest Orange +255 255 255 White + 13 77 127 Darkest Blue + 19 108 179 Dark Blue + 23 133 219 Lightdark Blue + 27 154 254 Blue +181 210 254 Darlight Blue +221 233 254 Light Blue +221 233 254 Lightest Blue + diff --git a/graphics/hgr_viewer/palette/orange_blue_half.gpl b/graphics/hgr_viewer/palette/orange_blue_half.gpl new file mode 100644 index 00000000..f6fcd33f --- /dev/null +++ b/graphics/hgr_viewer/palette/orange_blue_half.gpl @@ -0,0 +1,20 @@ +GIMP Palette +Name: Hires Gradient +Columns: 0 +# + 0 0 0 Black +102 45 0 Darkest Orange +144 64 0 Dark Orange +177 78 0 LightDark Orange +205 91 1 Orange +218 149 127 Darklight Orange +231 191 180 Light Orange +243 225 220 Lightest Orange +255 255 255 White + 13 77 127 Darkest Blue + 19 108 179 Dark Blue + 23 133 219 Lightdark Blue + 27 154 254 Blue +129 184 254 Darlight Blue +181 210 254 Light Blue +221 233 254 Lightest Blue