This is an automatic mail response.

Please note that "fltk.bugs" is for the automated bug-tracking
system and not for direct posting as such. If you want to report this
as a bug, open a Software Trouble Report (STR) by using the Submit Bug
link at http://www.fltk.org/str.php

Few real people watch fltk.bugs, and even fewer will reply, so you
might get a better response if you post somewhere more accessible:

- if you want to discuss how to do things in FLTK in your own projects,
please post to fltk.general

- if you want to discuss issues around FLTK's own code and development
please post to fltk.development


On 13.03.2010, at 19:44, w. szukalski wrote:

> Attached is a simple image viewer for SharedImage.
> The test files are the files in test/images:
>  coucou.gif  coucou.png  coucou.xpm  testimg.jpg  ulon.bmp
> 
> JPG image: normal draw().
> XPM image: excessive draw().
> PNG image: excessive draw().
> BMP image: normal draw().
> GIF image: excessive draw().
> 
> Some other PNG images (mostly without transparency) behave normal.
> But when I move the mouse within the window or within the file_chooser, the 
> image is redrawn.
> 
> The same happens with ulon.bmp : moving the mouse within the file_chooser 
> triggers a draw().
> 
> Current version:fltk-2.0.x-r6970
> 
> Re-Installing fltk-2.0.x-r6671: same behaviour.
> 
> I have converted the viewer to fltk-1.3. No excessive draw(). No draw()
> during mouse move.
> 
> 
> winfried
> =================== FLTK 20 ===================
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> 
> #include <fltk/run.h>
> #include <fltk/draw.h>
> #include <fltk/filename.h>
> #include <fltk/Widget.h>
> #include <fltk/Window.h>
> #include <fltk/Button.h>
> #include <fltk/SharedImage.h>
> #include <fltk/file_chooser.h>
> #include <fltk/ask.h>
> 
> #define HEADER_H 45
> #define WINMIN_W 210
> 
> using namespace fltk;
> 
> static Window *main_win;
> static SharedImage *sim;
> 
> class Canvas: public Widget
> {
>    void draw();
> public:
>    Canvas(int x,int y,int w,int h)
>    : Widget(x,y,w,h)
>   {
>   }
> };
> 
> static Canvas *canvas;
> static int draw_count;
> 
> void Canvas::draw()
> {
> printf("DRAW %d\n",++draw_count);
> 
>    if(sim)
>   {
>       int ww, iw, ih;
> 
>       sim->measure(iw, ih);
>       if((ww = iw) < WINMIN_W) ww = WINMIN_W;
> 
>    main_win->resize(ww, HEADER_H + ih);
>    resize(iw, ih);
> 
>       sim->draw(0, 0);
>       return;
>   }
> }
> 
> void get_image(const char *name)
> {
>       sim = SharedImage::get(name);
> 
>  if(sim == NULL)
>  {
>       alert("No SharedImage possible for\n%s",name);
>       return;
>  }
>  canvas->redraw();
> }
> 
> static char name[1024];
> 
> static void file_cb(const char *n)
> {
>  if( !filename_exist(n)) return;
> 
>  if(filename_isdir(n)) return;
> 
>  strcpy(name, n);
> 
>  main_win->label(filename_name(name));
> 
>  get_image(name);
> }
> 
> static void cancel_cb(Widget *, void *)
> {
>       exit(0);
> }
> 
> static void load_cb(Widget *,void *)
> {
>       file_chooser_callback(file_cb);
>       file_chooser("Image File","*.{xpm,png,jpg,gif,bmp}", ".");
>       file_chooser_callback(NULL);
> }
> 
> int main(int argc, char **argv)
> {
>    register_images();
> 
>       main_win = new Window(400,HEADER_H+400);
>       main_win->label("Pixmap Browser");
>       main_win->begin();
> 
>   {
>       Button *b = new Button(5,5,100,35,"Load");
>       b->callback(load_cb);
>   }
>   {
>       Button *b = new Button(105,5,100,35,"Cancel");
>       b->callback(cancel_cb);
>   }
>       canvas = new Canvas(0,HEADER_H,400,400);
> 
>       main_win->end();
>       main_win->resizable(canvas);
>       main_win->show();
> 
>       if (argv[1]) file_cb(argv[1]);
> 
>       return run();
> }
> =================== FLTK 13 ===================
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> 
> #include <FL/Fl.H>
> #include <FL/fl_draw.H>
> #include <FL/filename.H>
> #include <FL/Fl_Widget.H>
> #include <FL/Fl_Window.H>
> #include <FL/Fl_Button.H>
> #include <FL/Fl_Shared_Image.H>
> #include <FL/Fl_File_Chooser.H>
> #include <FL/fl_ask.H>
> 
> #define HEADER_H 45
> #define WINMIN_W 210
> 
> static Fl_Window *main_win;
> static Fl_Shared_Image *sim;
> 
> class Canvas: public Fl_Widget
> {
>    void draw();
> public:
>    Canvas(int x,int y,int w,int h)
>    : Fl_Widget(x,y,w,h)
>   {
>   }
> };
> 
> static Canvas *canvas;
> static int draw_count;
> 
> void Canvas::draw()
> {
> printf("DRAW(%p) %d\n",(void*)sim,++draw_count);
> 
>    if(sim)
>   {
>       int ww, iw, ih;
> 
>       iw = sim->w(); ih = sim->h();
> 
>       if((ww = iw) < WINMIN_W) ww = WINMIN_W;
> 
>    main_win->resize(main_win->x(), main_win->y(), ww, HEADER_H + ih);
>    resize(x(), y(),iw, ih);
> 
>       sim->draw(x(), y());
> 
>       return;
>   }
> }
> 
> void get_image(const char *name)
> {
>       sim = Fl_Shared_Image::get(name);
> 
>       if(sim == NULL)
>   {
>       fl_alert("No SharedImage possible for\n%s",name);
>       return;
>   }
>       canvas->redraw();
> }
> 
> static char name[1024];
> 
> static void file_cb(const char *n)
> {
>  if(fl_filename_isdir(n)) return;
> 
>  strcpy(name, n);
> 
>  main_win->label(fl_filename_name(name));
> 
>  get_image(name);
> }
> 
> static void cancel_cb(Fl_Widget *, void *)
> {
>       exit(0);
> }
> 
> static void load_cb(Fl_Widget *,void *)
> {
>       fl_file_chooser_callback(file_cb);
>       fl_file_chooser("Image File","*.{xpm,png,jpg,gif,bmp}", ".");
>       fl_file_chooser_callback(NULL);
> }
> 
> int main(int argc, char **argv)
> {
>    fl_register_images();
> 
>       main_win = new Fl_Window(200,200,400,HEADER_H+400);
>       main_win->label("Pixmap Browser");
>       main_win->begin();
> 
>   {
>       Fl_Button *b = new Fl_Button(5,5,100,35,"Load");
>       b->callback(load_cb);
>   }
>   {
>       Fl_Button *b = new Fl_Button(105,5,100,35,"Cancel");
>       b->callback(cancel_cb);
>   }
>       canvas = new Canvas(0,HEADER_H,400,400);
> 
>       main_win->end();
>       main_win->resizable(canvas);
>       main_win->show();
> 
>       if (argv[1]) file_cb(argv[1]);
> 
>       return Fl::run();
> }
> 
> _______________________________________________
> fltk-bugs mailing list
> [email protected]
> http://lists.easysw.com/mailman/listinfo/fltk-bugs

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to