From 183b7518100ee21b709bb1cb4450161b2d0944af Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Wed, 25 Jul 2007 06:11:46 +0000 Subject: [PATCH] Added a 'color picker' entry to the color palette; allows choosing from over 50,000 colors. Used by drawing and Magic tools, as well as the new 'New' dialog. Documented Martin's Mac OS X printing update. Improved colors in Starter browser buttons. --- data/images/ui/cursor_starter_down.png | Bin 3044 -> 5509 bytes data/images/ui/cursor_starter_up.png | Bin 2433 -> 3425 bytes docs/CHANGES.txt | 7 + src/tuxpaint.c | 639 +++++++++++++++++++++++-- 4 files changed, 601 insertions(+), 45 deletions(-) diff --git a/data/images/ui/cursor_starter_down.png b/data/images/ui/cursor_starter_down.png index a23f9eeb74a99edf6e636a1fa1c8bd6af07a6890..1077fab6be9e549b0b03e636c23708145b485c15 100644 GIT binary patch delta 5507 zcmV-}6@2RC7lkX385#xv000!j5c>cC00v@9M??U*0Nnt~ZF6ivks%&`*9RE`6A&W6 zt(^b>6%t8AK~#9!?VZ_k9M^Tme|PJi1%n*~cR`dWN~R=Ba=gWHWqC=ZDlhq8Q|0oD zQ}GfxvPGJdEfz^pBt=prh@At>(tVda+@7AE1t8@-nZT`@5&!{U&-wcM&Uel|w;@6Z zfhnu{#nmQb@)lD8%Sj^mhTTYx{Jv zKAUcz4Y$Qcx6MY@ChK&`yd^k~_x=Q|BbN7`;5?bPWCtBKvo`C0-8NnbR@5>}ArJ`E zbb^t30>lu)2#8{wfz!aty``6D?B`uJ>^=|nzu`B}ZgTtjm)w2+fUUh9I$4)~zYqHs zG7DCopf$dSL8gIHyv{x0A> z&NjHS_mEGYeaT;cKEJ_@2e;UNv_Y5vOAcj22B@Ww09s6yf!Ar3F|+|Pz*@+BOea=? z_0Y-alhLQmu71Y)g-zQ11G+!R`045a@64}po|X7}3`a6?x`bA9UIE^7yU(572mI%! zzv7Q~Z}4R68FsfzI4aM{0E;yiTJy{_n$%4VW6}b|_(rvVRDbiJS?`LV##rQepT5gD z=yup?@8WiP&VHv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`LKSBQoj+8VN69Z%EyyY`Mj20qE- zu(IbiF_7XJI?F_x7qz9SfoW?b(6miX+KdMi$iU|~&TW!#%p-T#c4_TuvPf#17j0i) zJ2?71jsmLasU1#2!Ih9Xk+bhK9%WcY7wNbdzl*WlJ)!;Y6}5ehQlGz}(R@T}@6#Ds zbYd)_IAZ(0{eESSwRAC*-q|Jm7Y@)k@zWX2PPxmD?>=TYVOV)m3$}qbZx1(`{1@FJ z0EeE(2lsozEpLKziWUa1b!y*}Z54SQ`l2$E@s diff --git a/data/images/ui/cursor_starter_up.png b/data/images/ui/cursor_starter_up.png index d19d665f557efcaf6b9c270b0166dfe78bea37c7..69b9d8094a2a44094905c8697056bb3c7697fbaf 100644 GIT binary patch delta 3396 zcmV-K4ZHGz6X6<=Bo78+OGiWixd7b&%WZRPL6IRIf7b^Y0}~Nd$DIoR01WO)L_t(| z+U1;CcjCwu$E)tWr450=;AK2X<}LaDA1BE<>FMcqw-*-EfVNtchZ1EW0rt#GBBmaE z+HPB@e*EuRS8ypM`|wg)Zqx14@^QIdEneqop5}ROjL}-Ni&%&V06`E$K{OrDu9C^^ z)m5M?bTi21@AI_U!jF8 zvOHb>SUx;|eOf&2(ruR@B647yfi)S%*hk*XfB*S1#@Me~>x!AmFs-%SosubIjBObS zTyNt-7FAVUjjqBV@`eA$ff{47JpI?_e?BjtciAp4vdSFOIWSN7gK*$`fgln@ebJ*- zN*hy@d77tLp0bXyRfg@-?KiF0oAu4r&EJ3d$9dbQ^V(c*U%x$ndtN>-Uzc6yfQUi} ze~-K{41F&MeBT$oC;VQ>(<#POx+u#iPt!cj%UnuX%EDQp)|zRymD{2ytSh*`xliKp zDV@@JZT|Z3>C?lfGr}B1@idtv!$}lGJ>qzDziFQCvfbi!zTTLwTQkNiUgx`PSIXjy zPU+OuSDV$B$KM|3k9m|cE*raLNOb4x0 zbCx~MA3fp!_3m$z;iSv-IM7m+^VjE3U;ndwU7iYsgK#h%&j#VZ(v%mGNco-zF!qJd z0kS+r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>M8cdOP)wAB;43{VIm~-IBHD zi3^3_=4$$xsLRmYc++L$zW z{c0SlnNro?mE5y=TIigBW{ar>(`=+l_f@Z7&6MB`)12Ss?;3mh;&~rBJy7c$CFo;` z$LfKaA%M30-J7TU-QwmnK*iJ|sg;Va^?DetR-5!Lmw(ZS zikm*HioQDynZ~q$m=%6c1{gtPMKs8^oG6>b&Zq$b|9OG;4Agu*jWjZ?6pi5pP z?EuwluQ1%G4}Vn!vtFnPK&uO&c@1=Qrd66Ppn4bF1J%nl_bZs?_55BF{ti%$LtBgU zp<81~XBl6Lw}6Tm7e7#Auj6jWQ>vG&0`(gnPY%$qDUyLAaI?d69(YfQ-zalcV`$hx z8hsOK$re);Xo#T@pW1uP~Y0!oPP;o-VL>ZeHb>uiofAjd6P~| zc?jAz$xBTZMyF)j-&>aYdBF)*5UaoIDFL=l4GUAx$#&r%d8gh_J$3pR#MZnoPZN3q ztr+3N$-X~=qYLIqhUA>j}BRFA`Ip4-Gk zihC%jF70~{aVprp0X!s^p9vQ3r`MJns2kx?@*~cB}$_y;lE2x5iLuO38ocJ zd@`&mN*}QR{Gp1(t@d6hApnQ9#|JMx;g&bSX_3@s+p4)heI_x_LtnH;cL+S56K;*E oKZaRkXJv|B;^+@xUU&xcf9=(T???hVl>h($07*qoM6N<$f`W>}^8f$< diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 6733fd739..dae3df754 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -19,6 +19,10 @@ $Id$ + New images can be given solid background colors (which the 'Eraser' tool erases to) + * Added a 'color picker' entry to the color palette; allows choosing + from over 50,000 colors. Used by drawing and Magic tools, as well + as the new 'New' dialog. + * Documentation Imrpovements: --------------------------- * Improved --usage output. @@ -66,6 +70,9 @@ $Id$ "make nopango". Note: A modified SDL_Pango.h header file is included with Tux Paint, to work around a compile issue with SDL_Pango 0.1.2's. + * Print configuration is now saved between Tux Paint sessions on Mac OS X. + Martin Fuhrer + * New Brushes ----------- * Sparkles (based on old Magic Tool) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 5c48e0d06..062556125 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -91,6 +91,7 @@ #define COLORSEL_CLOBBER 2 // colors get scribbled over #define COLORSEL_REFRESH 4 // redraw the colors, either on or off #define COLORSEL_CLOBBER_WIPE 8 // draw the (greyed out) colors, but don't disable +#define COLORSEL_FORCE_REDRAW 16 // enable, and force redraw (to make color picker work) static unsigned draw_colors(unsigned action); @@ -940,6 +941,8 @@ static SDL_Surface *img_scroll_up, *img_scroll_down; static SDL_Surface *img_scroll_up_off, *img_scroll_down_off; static SDL_Surface *img_grow, *img_shrink; static SDL_Surface *img_bold, *img_italic; +static SDL_Surface *img_color_picker, *img_color_picker_thumb, *img_paintwell; +int color_picker_x, color_picker_y; static SDL_Surface *img_title_on, *img_title_off, *img_title_large_on, *img_title_large_off; @@ -1431,6 +1434,7 @@ static void get_new_file_id(void); static int do_quit(int tool); int do_open(void); int do_new_dialog(void); +int do_color_picker(void); int do_slideshow(void); void play_slideshow(int * selected, int num_selected, char * dirname, char **d_names, char **d_exts, int speed); @@ -2023,6 +2027,11 @@ static void mainloop(void) hide_blinking_cursor(); shape_tool_mode = SHAPE_TOOL_MODE_DONE; + disable_avail_tools(); + draw_toolbar(); + draw_colors(COLORSEL_CLOBBER_WIPE); + draw_none(); + if (do_new_dialog() == 0) { draw_tux_text(tool_tux[TUX_DEFAULT], TIP_NEW_ABORT, 1); @@ -2031,8 +2040,24 @@ static void mainloop(void) do_render_cur_text(0); } + enable_avail_tools(); + draw_toolbar(); update_screen_rect(&r_tools); + draw_colors(COLORSEL_REFRESH); + + if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES) + draw_brushes(); + else if (cur_tool == TOOL_MAGIC) + draw_magic(); + else if (cur_tool == TOOL_STAMP) + draw_stamps(); + else if (cur_tool == TOOL_TEXT) + draw_fonts(); + else if (cur_tool == TOOL_SHAPES) + draw_shapes(); + else if (cur_tool == TOOL_ERASER) + draw_erasers(); } else if (key == SDLK_s && (mod & KMOD_CTRL) && !noshortcuts) { @@ -2052,11 +2077,12 @@ static void mainloop(void) update_screen_rect(&r_tools); } #ifdef __APPLE__ - else if (key == SDLK_p && (mod & KMOD_CTRL) && (mod & KMOD_SHIFT) && !noshortcuts) { + else if (key == SDLK_p && (mod & KMOD_CTRL) && (mod & KMOD_SHIFT) && +!noshortcuts) { /* Ctrl-Shft-P - Page Setup */ DisplayPageSetup(canvas); } -#endif +#endif else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts) { /* Ctrl-P - Print */ @@ -2468,6 +2494,11 @@ static void mainloop(void) { shape_tool_mode = SHAPE_TOOL_MODE_DONE; + disable_avail_tools(); + draw_toolbar(); + draw_colors(COLORSEL_CLOBBER_WIPE); + draw_none(); + if (do_new_dialog() == 0) { cur_tool = old_tool; @@ -2479,8 +2510,25 @@ static void mainloop(void) } cur_tool = old_tool; - draw_toolbar(); - update_screen_rect(&r_tools); + + enable_avail_tools(); + + draw_toolbar(); + update_screen_rect(&r_tools); + draw_colors(COLORSEL_REFRESH); + + if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES) + draw_brushes(); + else if (cur_tool == TOOL_MAGIC) + draw_magic(); + else if (cur_tool == TOOL_STAMP) + draw_stamps(); + else if (cur_tool == TOOL_TEXT) + draw_fonts(); + else if (cur_tool == TOOL_SHAPES) + draw_shapes(); + else if (cur_tool == TOOL_ERASER) + draw_erasers(); } else if (cur_tool == TOOL_PRINT) { @@ -3000,11 +3048,49 @@ static void mainloop(void) if (which >= 0 && which < NUM_COLORS) { cur_color = which; - playsound(screen, 1, SND_BUBBLE, 1, event.button.x, SNDDIST_NEAR); - draw_colors(COLORSEL_REFRESH); - render_brush(); draw_tux_text(TUX_KISS, color_names[cur_color], 1); + if (cur_color == (unsigned) (NUM_COLORS - 1)) + { + disable_avail_tools(); + draw_toolbar(); + draw_colors(COLORSEL_CLOBBER_WIPE); + draw_none(); + + + do_color_picker(); + + + enable_avail_tools(); + draw_toolbar(); + update_screen_rect(&r_tools); + + draw_tux_text(TUX_GREAT, tool_tips[cur_tool], 1); + + draw_colors(COLORSEL_FORCE_REDRAW); + + if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES) + draw_brushes(); + else if (cur_tool == TOOL_MAGIC) + draw_magic(); + else if (cur_tool == TOOL_STAMP) + draw_stamps(); + else if (cur_tool == TOOL_TEXT) + draw_fonts(); + else if (cur_tool == TOOL_SHAPES) + draw_shapes(); + else if (cur_tool == TOOL_ERASER) + draw_erasers(); + + SDL_Flip(screen); + } + else + draw_colors(COLORSEL_REFRESH); + + playsound(screen, 1, SND_BUBBLE, 1, event.button.x, SNDDIST_NEAR); + render_brush(); + + if (cur_tool == TOOL_TEXT) do_render_cur_text(0); else if (cur_tool == TOOL_MAGIC) @@ -5475,7 +5561,6 @@ static int load_user_fonts_stub(void *vp) static void setup(int argc, char *argv[]) { - int i, j, ok_to_use_sysconfig; char str[128]; char *upstr; @@ -5495,10 +5580,9 @@ static void setup(int argc, char *argv[]) Uint32 init_flags; char tmp_str[128]; SDL_Surface *img1; - SDL_Surface *img2; Uint32(*getpixel_tmp_btn_up) (SDL_Surface *, int, int); Uint32(*getpixel_tmp_btn_down) (SDL_Surface *, int, int); - Uint32(*getpixel_img2) (SDL_Surface *, int, int); + Uint32(*getpixel_img_paintwell) (SDL_Surface *, int, int); @@ -6444,6 +6528,21 @@ static void setup(int argc, char *argv[]) } + /* Add "Color Picker" color: */ + + color_hexes = (Uint8 **) realloc(color_hexes, sizeof(Uint8 *) * (NUM_COLORS + 1)); + + color_names = (char **) realloc(color_names, sizeof(char *) * (NUM_COLORS + 1)); + color_names[NUM_COLORS] = strdup(gettext("Pick a color.")); + color_hexes[NUM_COLORS] = (Uint8 *) malloc(sizeof(Uint8) * 3); + color_hexes[NUM_COLORS][0] = 0; + color_hexes[NUM_COLORS][1] = 0; + color_hexes[NUM_COLORS][2] = 0; + color_picker_x = 0; + color_picker_y = 0; + NUM_COLORS++; + + /* Set window icon and caption: */ #ifndef __APPLE__ @@ -6972,6 +7071,8 @@ static void setup(int argc, char *argv[]) show_progress_bar(screen); + img_color_picker = loadimage(DATA_PREFIX "images/ui/color_picker.png"); + /* Create toolbox and selector labels: */ for (i = 0; i < NUM_TITLES; i++) @@ -7005,13 +7106,16 @@ static void setup(int argc, char *argv[]) /* Create appropriately-shaped buttons: */ img1 = loadimage(DATA_PREFIX "images/ui/paintwell.png"); - img2 = thumbnail(img1, color_button_w, color_button_h, 0); + img_paintwell = thumbnail(img1, color_button_w, color_button_h, 0); tmp_btn_up = thumbnail(img_btn_up, color_button_w, color_button_h, 0); tmp_btn_down = thumbnail(img_btn_down, color_button_w, color_button_h, 0); img_color_btn_off = thumbnail(img_btn_off, color_button_w, color_button_h, 0); SDL_FreeSurface(img1); + img_color_picker_thumb = thumbnail(img_color_picker, + color_button_w, color_button_h, 0); + /* Create surfaces to draw them into: */ img_color_btns = malloc(sizeof(SDL_Surface *) * NUM_COLORS * 2); @@ -7047,7 +7151,7 @@ static void setup(int argc, char *argv[]) getpixel_tmp_btn_up = getpixels[tmp_btn_up->format->BytesPerPixel]; getpixel_tmp_btn_down = getpixels[tmp_btn_down->format->BytesPerPixel]; - getpixel_img2 = getpixels[img2->format->BytesPerPixel]; + getpixel_img_paintwell = getpixels[img_paintwell->format->BytesPerPixel]; for (y = 0; y < tmp_btn_up->h /* 48 */ ; y++) @@ -7069,7 +7173,7 @@ static void setup(int argc, char *argv[]) rd = sRGB_to_linear_table[r]; gd = sRGB_to_linear_table[g]; bd = sRGB_to_linear_table[b]; - SDL_GetRGBA(getpixel_img2(img2, x, y), img2->format, &r, &g, &b, &a); + SDL_GetRGBA(getpixel_img_paintwell(img_paintwell, x, y), img_paintwell->format, &r, &g, &b, &a); aa = a / 255.0; for (i = 0; i < NUM_COLORS; i++) @@ -7077,18 +7181,34 @@ static void setup(int argc, char *argv[]) double rh = sRGB_to_linear_table[color_hexes[i][0]]; double gh = sRGB_to_linear_table[color_hexes[i][1]]; double bh = sRGB_to_linear_table[color_hexes[i][2]]; - putpixels[img_color_btns[i]->format->BytesPerPixel] - (img_color_btns[i], x, y, - SDL_MapRGB(img_color_btns[i]->format, - linear_to_sRGB(rh * aa + ru * (1.0 - aa)), - linear_to_sRGB(gh * aa + gu * (1.0 - aa)), - linear_to_sRGB(bh * aa + bu * (1.0 - aa)))); - putpixels[img_color_btns[i]->format->BytesPerPixel] - (img_color_btns[i + NUM_COLORS], x, y, - SDL_MapRGB(img_color_btns[i + NUM_COLORS]->format, - linear_to_sRGB(rh * aa + rd * (1.0 - aa)), - linear_to_sRGB(gh * aa + gd * (1.0 - aa)), - linear_to_sRGB(bh * aa + bd * (1.0 - aa)))); + + if (i == NUM_COLORS - 1) + { + putpixels[img_color_btns[i]->format->BytesPerPixel] + (img_color_btns[i], x, y, + getpixels[img_color_picker_thumb->format->BytesPerPixel] + (img_color_picker_thumb, x, y)); + putpixels[img_color_btns[i + NUM_COLORS]->format->BytesPerPixel] + (img_color_btns[i + NUM_COLORS], x, y, + getpixels[img_color_picker_thumb->format->BytesPerPixel] + (img_color_picker_thumb, x, y)); + } + + if (i < NUM_COLORS - 1 || a == 255) + { + putpixels[img_color_btns[i]->format->BytesPerPixel] + (img_color_btns[i], x, y, + SDL_MapRGB(img_color_btns[i]->format, + linear_to_sRGB(rh * aa + ru * (1.0 - aa)), + linear_to_sRGB(gh * aa + gu * (1.0 - aa)), + linear_to_sRGB(bh * aa + bu * (1.0 - aa)))); + putpixels[img_color_btns[i + NUM_COLORS]->format->BytesPerPixel] + (img_color_btns[i + NUM_COLORS], x, y, + SDL_MapRGB(img_color_btns[i + NUM_COLORS]->format, + linear_to_sRGB(rh * aa + rd * (1.0 - aa)), + linear_to_sRGB(gh * aa + gd * (1.0 - aa)), + linear_to_sRGB(bh * aa + bd * (1.0 - aa)))); + } } } } @@ -7100,7 +7220,6 @@ static void setup(int argc, char *argv[]) SDL_UnlockSurface(tmp_btn_down); SDL_FreeSurface(tmp_btn_up); SDL_FreeSurface(tmp_btn_down); - SDL_FreeSurface(img2); #endif @@ -7555,15 +7674,16 @@ static unsigned draw_colors(unsigned action) colors_state &= ~COLORSEL_CLOBBER; else if (action == COLORSEL_DISABLE) colors_state = COLORSEL_DISABLE; - else if (action == COLORSEL_ENABLE) + else if (action == COLORSEL_ENABLE || action == COLORSEL_FORCE_REDRAW) colors_state = COLORSEL_ENABLE; colors_are_selectable = (colors_state == COLORSEL_ENABLE); if (colors_state & COLORSEL_CLOBBER && action != COLORSEL_CLOBBER_WIPE) return old_colors_state; + if (cur_color == old_color && colors_state == old_colors_state && - action != COLORSEL_CLOBBER_WIPE) + action != COLORSEL_CLOBBER_WIPE && action != COLORSEL_FORCE_REDRAW) return old_colors_state; old_color = cur_color; @@ -16481,8 +16601,6 @@ int do_new_dialog(void) num_files_in_dirs = 0; - /* FIXME: Propagate first entries with colors from palette */ - first_starter = 0; @@ -16568,27 +16686,38 @@ int do_new_dialog(void) for (j = 0; j < NUM_COLORS; j++) { - thumbs[num_files] = SDL_CreateRGBSurface(screen->flags, + if (j < NUM_COLORS - 1) + { + /* Palette colors: */ + + thumbs[num_files] = SDL_CreateRGBSurface(screen->flags, THUMB_W - 20, THUMB_H - 20, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, 0); - if (thumbs[num_files] != NULL) - { - SDL_FillRect(thumbs[num_files], NULL, - SDL_MapRGB(thumbs[num_files]->format, - color_hexes[j][0], - color_hexes[j][1], - color_hexes[j][2])); - - d_places[num_files] = PLACE_COLOR_PALETTE; - d_names[num_files] = NULL; - d_exts[num_files] = NULL; - - num_files++; + if (thumbs[num_files] != NULL) + { + SDL_FillRect(thumbs[num_files], NULL, + SDL_MapRGB(thumbs[num_files]->format, + color_hexes[j][0], + color_hexes[j][1], + color_hexes[j][2])); + } } + else + { + /* Color picker: */ + + thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0); + } + + d_places[num_files] = PLACE_COLOR_PALETTE; + d_names[num_files] = NULL; + d_exts[num_files] = NULL; + + num_files++; } first_starter = num_files; @@ -17316,13 +17445,27 @@ int do_new_dialog(void) } } else - { + { + /* A color! */ + free_surface(&img_starter); free_surface(&img_starter_bkgd); starter_mirrored = 0; starter_flipped = 0; starter_personal = 0; + + /* Launch color picker if they chose that: */ + + if (which == NUM_COLORS - 1) + { + if (do_color_picker() == 0) + return(0); + } + + /* FIXME: Don't do anything and go back to Open dialog if they + hit BACK in color picker! */ + canvas_color_r = color_hexes[which][0]; canvas_color_g = color_hexes[which][1]; canvas_color_b = color_hexes[which][2]; @@ -17437,3 +17580,409 @@ Uint8 magic_touched(int x, int y) return(res); } +int do_color_picker(void) +{ +#ifndef NO_PROMPT_SHADOWS + int i; + SDL_Surface *alpha_surf; +#endif + SDL_Rect dest; + int x, y, w; + SDL_Surface * tmp_btn_up, * tmp_btn_down; + Uint32(*getpixel_tmp_btn_up) (SDL_Surface *, int, int); + Uint32(*getpixel_tmp_btn_down) (SDL_Surface *, int, int); + Uint32(*getpixel_img_paintwell) (SDL_Surface *, int, int); + Uint32(*getpixel_img_color_picker) (SDL_Surface *, int, int); + Uint8 r, g, b; + double rh, gh, bh; + int done, chose; + SDL_Event event; + SDLKey key; + int color_picker_left, color_picker_top; + int back_left, back_top; + SDL_Rect color_example_dest; + + + hide_blinking_cursor(); + + do_setcursor(cursor_hand); + + /* Draw button box: */ + + playsound(screen, 0, SND_PROMPT, 1, SNDPOS_CENTER, SNDDIST_NEAR); + + for (w = 0; w <= 128 + 6 + 4; w = w + 4) + { + dest.x = 160 + 96 - w + PROMPTOFFSETX; + dest.y = 94 + 96 - w + PROMPTOFFSETY; + dest.w = (320 - 96 * 2) + w * 2; + dest.h = w * 2; + SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 0, 0)); + + SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h); + SDL_Delay(10); + } + +#ifndef NO_PROMPT_SHADOWS + alpha_surf = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, + (320 - 96 * 2) + (w - 4) * 2, + (w - 4) * 2, + screen->format->BitsPerPixel, + screen->format->Rmask, + screen->format->Gmask, + screen->format->Bmask, + screen->format->Amask); + + if (alpha_surf != NULL) + { + SDL_FillRect(alpha_surf, NULL, SDL_MapRGB(alpha_surf->format, 0, 0, 0)); + SDL_SetAlpha(alpha_surf, SDL_SRCALPHA, 64); + + for (i = 8; i > 0; i = i - 2) + { + dest.x = 160 + 96 - (w - 4) + i + PROMPTOFFSETX; + dest.y = 94 + 96 - (w - 4) + i + PROMPTOFFSETY; + dest.w = (320 - 96 * 2) + (w - 4) * 2; + dest.h = (w - 4) * 2; + + SDL_BlitSurface(alpha_surf, NULL, screen, &dest); + } + + SDL_FreeSurface(alpha_surf); + } +#endif + + + /* Draw prompt box: */ + + w = w - 6; + + dest.x = 160 + 96 - w + PROMPTOFFSETX; + dest.y = 94 + 96 - w + PROMPTOFFSETY; + dest.w = (320 - 96 * 2) + w * 2; + dest.h = w * 2; + SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 255, 255, 255)); + + + /* Draw color palette: */ + + color_picker_left = 160 + 96 - w + PROMPTOFFSETX + 2; + color_picker_top = 94 + 96 - w + PROMPTOFFSETY + 2; + + dest.x = color_picker_left; + dest.y = color_picker_top; + + SDL_BlitSurface(img_color_picker, NULL, screen, &dest); + + + /* Draw last color position: */ + + dest.x = color_picker_x + color_picker_left - 3; + dest.y = color_picker_y + color_picker_top - 1; + dest.w = 7; + dest.h = 3; + + SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 0, 0)); + + dest.x = color_picker_x + color_picker_left - 1; + dest.y = color_picker_y + color_picker_top - 3; + dest.w = 3; + dest.h = 7; + + SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 0, 0, 0)); + + dest.x = color_picker_x + color_picker_left - 2; + dest.y = color_picker_y + color_picker_top; + dest.w = 5; + dest.h = 1; + + SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 255, 255, 255)); + + dest.x = color_picker_x + color_picker_left; + dest.y = color_picker_y + color_picker_top - 2; + dest.w = 1; + dest.h = 5; + + SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 255, 255, 255)); + + + /* Determine spot for example color: */ + + color_example_dest.x = color_picker_left + img_color_picker->w + 2; + color_example_dest.y = color_picker_top + 2; + color_example_dest.w = (320 - 96 * 2) + w * 2 - img_color_picker->w - 6; + color_example_dest.h = 124; + + + SDL_FillRect(screen, &color_example_dest, + SDL_MapRGB(screen->format, 0, 0, 0)); + + color_example_dest.x += 2; + color_example_dest.y += 2; + color_example_dest.w -= 4; + color_example_dest.h -= 4; + + SDL_FillRect(screen, &color_example_dest, + SDL_MapRGB(screen->format, 255, 255, 255)); + + color_example_dest.x += 2; + color_example_dest.y += 2; + color_example_dest.w -= 4; + color_example_dest.h -= 4; + + + /* Draw current color picker color: */ + + SDL_FillRect(screen, &color_example_dest, + SDL_MapRGB(screen->format, + color_hexes[NUM_COLORS - 1][0], + color_hexes[NUM_COLORS - 1][1], + color_hexes[NUM_COLORS - 1][2])); + + + + /* Show "Back" button */ + + back_left = (((320 - 96 * 2) + w * 2 - img_color_picker->w) - img_back->w) / 2 + color_picker_left + img_color_picker->w; + back_top = color_picker_top + img_color_picker->h - img_back->h - 2; + + dest.x = back_left; + dest.y = back_top; + + SDL_BlitSurface(img_back, NULL, screen, &dest); + + dest.x = back_left + (img_back->w - img_openlabels_back->w) / 2; + dest.y = back_top + img_back->h - img_openlabels_back->h; + SDL_BlitSurface(img_openlabels_back, NULL, screen, &dest); + + + SDL_Flip(screen); + + + /* Let the user pick a color, or go back: */ + + done = 0; + chose = 0; + x = y = 0; + + do + { + while (mySDL_PollEvent(&event)) + { + if (event.type == SDL_QUIT) + { + chose = 0; + done = 1; + } + else if (event.type == SDL_ACTIVEEVENT) + { + handle_active(&event); + } + else if (event.type == SDL_KEYUP) + { + key = event.key.keysym.sym; + + handle_keymouse(key, SDL_KEYUP); + } + else if (event.type == SDL_KEYDOWN) + { + key = event.key.keysym.sym; + + handle_keymouse(key, SDL_KEYDOWN); + + if (key == SDLK_ESCAPE) + { + chose = 0; + done = 1; + } + } + else if (event.type == SDL_MOUSEBUTTONDOWN && + valid_click(event.button.button)) + { + if (event.button.x >= color_picker_left && + event.button.x < color_picker_left + img_color_picker->w && + event.button.y >= color_picker_top && + event.button.y < color_picker_top + img_color_picker->h) + { + /* Picked a color! */ + + chose = 1; + done = 1; + + x = event.button.x - color_picker_left; + y = event.button.y - color_picker_top; + + color_picker_x = x; + color_picker_y = y; + } + else if (event.button.x >= back_left && + event.button.x < back_left + img_back->w && + event.button.y >= back_top && + event.button.y < back_top + img_back->h) + { + /* Decided to go Back */ + + chose = 0; + done = 1; + } + } + else if (event.type == SDL_MOUSEMOTION) + { + if (event.button.x >= color_picker_left && + event.button.x < color_picker_left + img_color_picker->w && + event.button.y >= color_picker_top && + event.button.y < color_picker_top + img_color_picker->h) + { + /* Hovering over the colors! */ + + do_setcursor(cursor_hand); + + + /* Show a big solid example of the color: */ + + x = event.button.x - color_picker_left; + y = event.button.y - color_picker_top; + + getpixel_img_color_picker = getpixels[img_color_picker->format->BytesPerPixel]; + SDL_GetRGB(getpixel_img_color_picker(img_color_picker, x, y), img_color_picker->format, &r, &g, &b); + + SDL_FillRect(screen, &color_example_dest, + SDL_MapRGB(screen->format, r, g, b)); + + SDL_UpdateRect(screen, + color_example_dest.x, + color_example_dest.y, + color_example_dest.w, + color_example_dest.h); + } + else + { + /* Revert to current color picker color, so we know what it was, + and what we'll get if we go Back: */ + + SDL_FillRect(screen, &color_example_dest, + SDL_MapRGB(screen->format, + color_hexes[NUM_COLORS - 1][0], + color_hexes[NUM_COLORS - 1][1], + color_hexes[NUM_COLORS - 1][2])); + + SDL_UpdateRect(screen, + color_example_dest.x, + color_example_dest.y, + color_example_dest.w, + color_example_dest.h); + + + /* Change cursor to arrow (or hand, if over Back): */ + + if (event.button.x >= back_left && + event.button.x < back_left + img_back->w && + event.button.y >= back_top && + event.button.y < back_top + img_back->h) + do_setcursor(cursor_hand); + else + do_setcursor(cursor_arrow); + } + } + } + + SDL_Delay(10); + } + while (!done); + + + /* Set the new color: */ + + if (chose) + { + getpixel_img_color_picker = getpixels[img_color_picker->format->BytesPerPixel]; + SDL_GetRGB(getpixel_img_color_picker(img_color_picker, x, y), img_color_picker->format, &r, &g, &b); + + color_hexes[NUM_COLORS - 1][0] = r; + color_hexes[NUM_COLORS - 1][1] = g; + color_hexes[NUM_COLORS - 1][2] = b; + + + /* Re-render color picker to show the current color it contains: */ + + tmp_btn_up = thumbnail(img_btn_up, color_button_w, color_button_h, 0); + tmp_btn_down = thumbnail(img_btn_down, color_button_w, color_button_h, 0); + img_color_btn_off = + thumbnail(img_btn_off, color_button_w, color_button_h, 0); + + getpixel_tmp_btn_up = getpixels[tmp_btn_up->format->BytesPerPixel]; + getpixel_tmp_btn_down = getpixels[tmp_btn_down->format->BytesPerPixel]; + getpixel_img_paintwell = getpixels[img_paintwell->format->BytesPerPixel]; + + rh = sRGB_to_linear_table[color_hexes[NUM_COLORS - 1][0]]; + gh = sRGB_to_linear_table[color_hexes[NUM_COLORS - 1][1]]; + bh = sRGB_to_linear_table[color_hexes[NUM_COLORS - 1][2]]; + + SDL_LockSurface(img_color_btns[NUM_COLORS - 1]); + SDL_LockSurface(img_color_btns[NUM_COLORS - 1 + NUM_COLORS]); + + for (y = 0; y < tmp_btn_up->h /* 48 */ ; y++) + { + for (x = 0; x < tmp_btn_up->w; x++) + { + double ru, gu, bu, rd, gd, bd, aa; + Uint8 a; + + SDL_GetRGB(getpixel_tmp_btn_up(tmp_btn_up, x, y), tmp_btn_up->format, + &r, &g, &b); + + ru = sRGB_to_linear_table[r]; + gu = sRGB_to_linear_table[g]; + bu = sRGB_to_linear_table[b]; + SDL_GetRGB(getpixel_tmp_btn_down(tmp_btn_down, x, y), + tmp_btn_down->format, &r, &g, &b); + + rd = sRGB_to_linear_table[r]; + gd = sRGB_to_linear_table[g]; + bd = sRGB_to_linear_table[b]; + SDL_GetRGBA(getpixel_img_paintwell(img_paintwell, x, y), + img_paintwell->format, &r, &g, &b, &a); + + aa = a / 255.0; + + putpixels[img_color_btns[NUM_COLORS - 1]->format->BytesPerPixel] + (img_color_btns[NUM_COLORS - 1], x, y, + getpixels[img_color_picker_thumb->format->BytesPerPixel] + (img_color_picker_thumb, x, y)); + putpixels[img_color_btns[NUM_COLORS - 1 + NUM_COLORS]->format->BytesPerPixel] + (img_color_btns[NUM_COLORS - 1 + NUM_COLORS], x, y, + getpixels[img_color_picker_thumb->format->BytesPerPixel] + (img_color_picker_thumb, x, y)); + + if (a == 255) + { + putpixels[img_color_btns[NUM_COLORS - 1]->format->BytesPerPixel] + (img_color_btns[NUM_COLORS - 1], x, y, + SDL_MapRGB(img_color_btns[i]->format, + linear_to_sRGB(rh * aa + ru * (1.0 - aa)), + linear_to_sRGB(gh * aa + gu * (1.0 - aa)), + linear_to_sRGB(bh * aa + bu * (1.0 - aa)))); + + putpixels[img_color_btns[NUM_COLORS - 1 + NUM_COLORS]->format->BytesPerPixel] + (img_color_btns[NUM_COLORS - 1 + NUM_COLORS], x, y, + SDL_MapRGB(img_color_btns[i + NUM_COLORS]->format, + linear_to_sRGB(rh * aa + rd * (1.0 - aa)), + linear_to_sRGB(gh * aa + gd * (1.0 - aa)), + linear_to_sRGB(bh * aa + bd * (1.0 - aa)))); + } + } + } + + SDL_UnlockSurface(img_color_btns[NUM_COLORS - 1]); + SDL_UnlockSurface(img_color_btns[NUM_COLORS - 1 + NUM_COLORS]); + } + + + /* Remove the prompt: */ + + update_canvas(0, 0, canvas->w, canvas->h); + + + return(chose); +} +