add rgb to draw_pixel (missed that one), bclistbox btn1 select tweak, set_pixel_color...
authorGood Guy <good1.2guy@gmail.com>
Tue, 20 Nov 2018 02:51:09 +0000 (19:51 -0700)
committerGood Guy <good1.2guy@gmail.com>
Tue, 20 Nov 2018 02:51:09 +0000 (19:51 -0700)
cinelerra-5.1/guicast/bclistbox.C
cinelerra-5.1/guicast/vframe.C
cinelerra-5.1/guicast/vframe.h
cinelerra-5.1/plugins/sketcher/sketcher.C

index 4a55593fae1e2d23479905b3c8c3dd3c6e620919..e99d7316f3d0a126e1f817c58976e00ee7cf8016 100644 (file)
@@ -2646,7 +2646,7 @@ int BC_ListBox::button_press_event()
                        }
 // Select single item
                        else {
                        }
 // Select single item
                        else {
-                               if( !current_item->selected || !new_value ) {
+                               if( !current_item->selected || (get_buttonpress() == 1 && !new_value) ) {
                                        set_all_selected(data, 0);
                                        set_selected(data, selection_number, 1);
                                }
                                        set_all_selected(data, 0);
                                        set_selected(data, selection_number, 1);
                                }
index 6f0dfbb18e754e8afeed54fb846628a4df0e14e6..82d0830c92d1effd7ebf9693d48830048c8e6dc3 100644 (file)
@@ -44,7 +44,7 @@ class PngReadFunction
 {
 public:
        static void png_read_function(png_structp png_ptr,
 {
 public:
        static void png_read_function(png_structp png_ptr,
-                  png_bytep data, png_size_t length)
+                       png_bytep data, png_size_t length)
        {
                VFrame *frame = (VFrame*)png_get_io_ptr(png_ptr);
                if(frame->image_size - frame->image_offset < (long)length)
        {
                VFrame *frame = (VFrame*)png_get_io_ptr(png_ptr);
                if(frame->image_size - frame->image_offset < (long)length)
@@ -390,10 +390,10 @@ int VFrame::get_keyframe()
 
 void VFrame::get_temp(VFrame *&vfrm, int w, int h, int color_model)
 {
 
 void VFrame::get_temp(VFrame *&vfrm, int w, int h, int color_model)
 {
-        if( vfrm && ( vfrm->get_w() != w || vfrm->get_h() != h ) ) {
-                delete vfrm;  vfrm = 0;
-        }
-        if( !vfrm ) vfrm = new VFrame(w, h, color_model, 0);
+       if( vfrm && ( vfrm->get_w() != w || vfrm->get_h() != h ) ) {
+               delete vfrm;  vfrm = 0;
+       }
+       if( !vfrm ) vfrm = new VFrame(w, h, color_model, 0);
 }
 
 
 }
 
 
@@ -828,7 +828,7 @@ int VFramePng::read_png(const unsigned char *data, long sz, double xscale, doubl
        int ww = w * xscale, hh = h * yscale;
        if( ww != w || hh != h ) {
                VFrame vframe(*this);
        int ww = w * xscale, hh = h * yscale;
        if( ww != w || hh != h ) {
                VFrame vframe(*this);
-                reallocate(NULL, -1, 0, 0, 0, ww, hh, color_model, -1);
+               reallocate(NULL, -1, 0, 0, 0, ww, hh, color_model, -1);
                transfer_from(&vframe);
        }
        return 0;
                transfer_from(&vframe);
        }
        return 0;
@@ -1352,15 +1352,14 @@ int VFrame::get_memory_usage()
 
 // rgb component colors (eg. from colors.h)
 // a (~alpha) transparency, 0x00==solid .. 0xff==transparent
 
 // rgb component colors (eg. from colors.h)
 // a (~alpha) transparency, 0x00==solid .. 0xff==transparent
-void VFrame::set_pixel_color(int argb)
+void VFrame::set_pixel_color(int rgb, int a)
 {
 {
-       pixel_rgb = argb;
-       int ia = 0xff & (pixel_rgb >> 24);
+       pixel_rgb = (rgb&0xffffff) | ~a<<24;
        int ir = 0xff & (pixel_rgb >> 16);
        int ig = 0xff & (pixel_rgb >> 8);
        int ib = 0xff & (pixel_rgb >> 0);
        YUV::yuv.rgb_to_yuv_8(ir, ig, ib);
        int ir = 0xff & (pixel_rgb >> 16);
        int ig = 0xff & (pixel_rgb >> 8);
        int ib = 0xff & (pixel_rgb >> 0);
        YUV::yuv.rgb_to_yuv_8(ir, ig, ib);
-       pixel_yuv =  (ia<<24) | (ir<<16) | (ig<<8) | (ib<<0);
+       pixel_yuv =  (a<<24) | (ir<<16) | (ig<<8) | (ib<<0);
 }
 
 void VFrame::set_stiple(int mask)
 }
 
 void VFrame::set_stiple(int mask)
@@ -1397,6 +1396,7 @@ int VFrame::draw_pixel(int x, int y)
        case BC_A8:
                DRAW_PIXEL(uint8_t, ib, 0, 0, 1, 0);
                break;
        case BC_A8:
                DRAW_PIXEL(uint8_t, ib, 0, 0, 1, 0);
                break;
+       case BC_RGB888:
        case BC_YUV888:
                DRAW_PIXEL(uint8_t, ir, ig, ib, 3, 0);
                break;
        case BC_YUV888:
                DRAW_PIXEL(uint8_t, ir, ig, ib, 3, 0);
                break;
index e6bbc23652ac8a8d1ca082a7a85af386ca52e289..dbf4dab0a30d0c2f1e1860cbf41223ecee071394 100644 (file)
@@ -346,8 +346,7 @@ public:
        virtual int draw_pixel(int x, int y);
        int pixel_rgb, pixel_yuv, stipple;
 
        virtual int draw_pixel(int x, int y);
        int pixel_rgb, pixel_yuv, stipple;
 
-       void set_pixel_color(int rgb);
-       void set_pixel_color(int rgb, int a) { set_pixel_color((rgb&0xffffff)|((~a&0xff)<<24)); }
+       void set_pixel_color(int rgb, int a=0xff);
        void set_stiple(int mask);
        void draw_line(int x1, int y1, int x2, int y2);
        void draw_smooth(int x1, int y1, int x2, int y2, int x3, int y3);
        void set_stiple(int mask);
        void draw_line(int x1, int y1, int x2, int y2);
        void draw_smooth(int x1, int y1, int x2, int y2, int x3, int y3);
index 954f7a2c64515679b1d80080e36840fe215344a7..a954c7ca0c21d084668e48bd46267bccbd13835b 100644 (file)
@@ -412,7 +412,7 @@ void Sketcher::update_gui()
 void Sketcher::draw_point(VFrame *vfrm, SketcherPoint *pt, int color, int d)
 {
        int r = d/2+1, x = pt->x, y = pt->y;
 void Sketcher::draw_point(VFrame *vfrm, SketcherPoint *pt, int color, int d)
 {
        int r = d/2+1, x = pt->x, y = pt->y;
-       vfrm->set_pixel_color(color, 0xff);
+       vfrm->set_pixel_color(color);
        vfrm->draw_smooth(x-r,y+0, x-r, y-r, x+0,y-r);
        vfrm->draw_smooth(x+0,y-r, x+r, y-r, x+r,y+0);
        vfrm->draw_smooth(x+r,y+0, x+r, y+r, x+0,y+r);
        vfrm->draw_smooth(x-r,y+0, x-r, y-r, x+0,y-r);
        vfrm->draw_smooth(x+0,y-r, x+r, y-r, x+r,y+0);
        vfrm->draw_smooth(x+r,y+0, x+r, y+r, x+0,y+r);
@@ -727,7 +727,7 @@ int Sketcher::process_realtime(VFrame *input, VFrame *output)
                int m = cv->points.size();
                if( !m || cv->pen == PTY_OFF ) continue;
                img->clear_frame();
                int m = cv->points.size();
                if( !m || cv->pen == PTY_OFF ) continue;
                img->clear_frame();
-               img->set_pixel_color(cv->color);
+               img->set_pixel_color(cv->color, (~cv->color>>24)&0xff);
                cv->draw(img);
                overlay_frame->overlay(out, img, 0,0,w,h, 0,0,w,h,
                                1.f, TRANSFER_NORMAL, NEAREST_NEIGHBOR);
                cv->draw(img);
                overlay_frame->overlay(out, img, 0,0,w,h, 0,0,w,h,
                                1.f, TRANSFER_NORMAL, NEAREST_NEIGHBOR);