- int r = (color>>16) & 0xff;
- int g = (color>>8) & 0xff;
- int b = (color>>0) & 0xff;
- for( int i=0; i<3; ++i ) {
- VFrame *vframe = vframes[i];
- int ww = vframe->get_w(), hh = vframe->get_h();
- int cx = (ww+1)/2, cy = hh/2;
- double cc = (cx*cx + cy*cy) / 4.;
- uint8_t *bp = vframe->get_data(), *dp = bp;
- uint8_t *ep = dp + vframe->get_data_size();
- int rr = r, gg = g, bb = b;
- int bpl = vframe->get_bytes_per_line();
- switch( i ) {
- case BUTTON_UP:
- break;
- case BUTTON_UPHI:
- if( (rr+=48) > 0xff ) rr = 0xff;
- if( (gg+=48) > 0xff ) gg = 0xff;
- if( (bb+=48) > 0xff ) bb = 0xff;
- break;
- case BUTTON_DOWNHI:
- if( (rr-=48) < 0x00 ) rr = 0x00;
- if( (gg-=48) < 0x00 ) gg = 0x00;
- if( (bb-=48) < 0x00 ) bb = 0x00;
- break;
- }
- while( dp < ep ) {
- int yy = (dp-bp) / bpl, xx = ((dp-bp) % bpl) >> 2;
- int dy = cy - yy, dx = cx - xx;
- double s = dx*dx + dy*dy - cc;
- double ss = s < 0 ? 1 : s >= cc ? 0 : 1 - s/cc;
- int aa = ss * 0xff;
- *dp++ = rr; *dp++ = gg; *dp++ = bb; *dp++ = aa;
- }
- }
- set_images(vframes);
-}
-
-void GWindowColorButton::update_gui(int color)
-{
- set_color(color);
- draw_face();
-}
-
-GWindowColorThread::GWindowColorThread(GWindowGUI *gui, GWindowColorButton *color_button)
- : ColorPicker(0, color_button->auto_toggle->caption)
-{
- this->gui = gui;
- this->color_button = color_button;
- this->color = 0;
- color_update = new GWindowColorUpdate(this);
-}
-
-GWindowColorThread::~GWindowColorThread()
-{
- delete color_update;
-}
-
-void GWindowColorThread::start(int color)
-{
- start_window(color, 0, 1);
- color_update->start();