draw in image
rehi all member
i use dev cpp 4.9.9.2 and fltk 1.7
i create with your help this program ho can open an image in a box :
Test.cpp
// generated by Fast Light User Interface Designer (fluid) version 1.0106
#include "Test.h"
static unsigned char idata_ouvrir[] =
"\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\0\0\204\0\0\204\0\0\204\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\0\0\204\354\351\330\354\351\330\354\
\351\330\0\0\204\354\351\330\0\0\204\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\0\0\204\0\0\204\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\0\0\0\0\0\
\0\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\0\0\204\0\0\204\0\0\204\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\0\0\0\377\377\0\377\377\377\377\
\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\0\0\0\377\377\377\377\377\0\377\377\377\377\377\0\377\377\
\377\377\377\0\377\377\377\377\377\0\377\377\377\0\0\0\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\0\0\0\377\377\0\377\377\377\377\377\0\377\377\377\
\377\377\0\377\377\377\377\377\0\377\377\377\377\377\0\0\0\0\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\0\0\0\377\377\377\377\377\0\377\377\377\377\377\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\377\377\0\377\377\
\377\377\377\0\0\0\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\
\202\0\204\202\0\204\202\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\0\0\0\377\377\377\377\377\0\0\0\0\
\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\
\202\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\0\0\0\377\377\0\0\0\0\204\202\0\204\202\0\
\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\0\0\0\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\0\0\0\0\0\0\204\202\0\204\202\0\204\202\0\204\202\0\204\
\202\0\204\202\0\204\202\0\204\202\0\204\202\0\0\0\0\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330";
static Fl_RGB_Image image_ouvrir(idata_ouvrir, 21, 19, 3, 0);
static unsigned char idata_sauv[] =
"\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\204\202\0\0\0\
\0\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\
\306\303\306\306\303\306\0\0\0\306\303\306\0\0\0\354\351\330\354\351\330\354\
\351\330\354\351\330\0\0\0\204\202\0\0\0\0\306\303\306\306\303\306\306\303\
\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\0\0\0\0\0\0\
\0\0\0\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\204\202\0\0\0\0\
\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\
\303\306\306\303\306\0\0\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\
\330\354\351\330\0\0\0\204\202\0\0\0\0\306\303\306\306\303\306\306\303\306\
\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\0\0\0\204\202\0\
\0\0\0\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\204\202\0\0\0\0\
\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\
\303\306\306\303\306\0\0\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\
\330\354\351\330\0\0\0\204\202\0\0\0\0\306\303\306\306\303\306\306\303\306\
\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\0\0\0\204\202\0\
\0\0\0\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\204\202\0\204\
\202\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\204\202\0\204\202\0\0\
\0\0\354\351\330\354\351\330\354\351\330\354\351\330\0\0\0\204\202\0\204\202\
\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\202\0\204\
\202\0\204\202\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\330\354\351\
\330\0\0\0\204\202\0\204\202\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\330\354\351\330\0\0\
\0\204\202\0\204\202\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306\303\306\306\
\303\306\0\0\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\330\354\351\
\330\0\0\0\204\202\0\204\202\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306\303\
\306\306\303\306\0\0\0\204\202\0\0\0\0\354\351\330\354\351\330\354\351\330\
\354\351\330\0\0\0\204\202\0\204\202\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\306\303\306\306\303\306\0\0\0\204\202\0\0\0\0\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330";
static Fl_RGB_Image image_sauv(idata_sauv, 18, 18, 3, 0);
static unsigned char idata_aid[] =
"\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330""ff\0""ff\0""ff\0""ff\0\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330""ff\0\377\377\0\377\377\0\377\377\0\377\377\0""ff\0\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\0\377\
\377\0\314\314\0\314\314\0\314\314\0\314\314\0\377\377\0""ff\0\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330""ff\0\377\377\0\377\377\0""ff\0""\
ff\0""ff\0""ff\0\377\377\0\377\377\0""ff\0\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330""ff\0\377\377\0\377\377\0""ff\0\0\0\204\0\0\204""ff\0\377\377\0\
\377\377\0""ff\0\0\0\204\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\0""ff\
\0\0\0\204\0\0\204\316\317\316""ff\0\377\377\0\377\377\0""ff\0\0\0\204\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\0\0\204\0\0\204\316\317\
\316""ff\0\377\377\0\377\377\0""ff\0\0\0\204\0\0\204\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\0\377\377\0\377\
\377\0""ff\0\0\0\204\0\0\204\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330""ff\0\377\377\0\377\377\0""ff\0\0\0\204\0\0\
\204\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330""ff\0\314\314\0\377\377\0""ff\0\0\0\204\0\0\204\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\
\0\314\314\0\314\314\0""ff\0\0\0\204\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330""\
ff\0""ff\0\0\0\204\0\0\204\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\0\377\377\0\377\
\377\0""ff\0\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\0\377\377\0\377\377\
\0""ff\0\0\0\204\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330""ff\0""ff\0\0\0\204\
\0\0\204\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\0\0\204\0\0\204\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330";
static Fl_RGB_Image image_aid(idata_aid, 20, 22, 3, 0);
static unsigned char idata_imp[] =
"\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\0\0\204\0\0\204\0\0\204\0\0\204\0\0\204\
\0\0\204\0\0\204\0\0\204\0\0\204\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\0\0\204\377\377\377\377\377\377\377\
\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\204\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\0\0\204\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\0\0\
\204\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\0\0\204\377\377\377\377\377\377\377\377\377\377\377\377\377\377\
\377\377\377\377\377\377\377\377\377\377\0\0\204\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\0\0\204\377\377\377\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\0\0\204\0\0\204\0\0\0\0\0\0\354\
\351\330\354\351\330\354\351\330\354\351\330\0\0\204\377\377\377\377\377\377\
\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0\0\
\204\306\303\306\0\0\0\306\303\306\0\0\0\354\351\330\354\351\330\0\0\0\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306\303\306\0\0\0\306\303\
\306\0\0\0\0\0\0\354\351\330\0\0\0\306\303\306\306\303\306\306\303\306\306\
\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\
\306\0\0\0\306\303\306\0\0\0\306\303\306\0\0\0\354\351\330\0\0\0\0\0\0\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\306\303\306\306\
\303\306\0\0\0\354\351\330\0\0\0\306\303\306\306\303\306\306\303\306\306\303\
\306\306\303\306\306\303\306\204\202\204\204\202\204\204\202\204\306\303\306\
\306\303\306\0\0\0\306\303\306\0\0\0\354\351\330\354\351\330\0\0\0\306\303\
\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\377\377\0\
\377\377\0\377\377\0\306\303\306\306\303\306\0\0\0\0\0\0\0\0\0\354\351\330\
\354\351\330\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\0\0\0\306\303\306\0\0\0\354\351\330\354\351\330\354\351\330\0\0\0\
\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\303\306\306\
\303\306\306\303\306\306\303\306\0\0\0\306\303\306\0\0\0\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\
\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\
\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\351\330\354\
\351\330\354\351\330\354\351\330";
static Fl_RGB_Image image_imp(idata_imp, 17, 17, 3, 0);
/*******************************************************************************
cb bouton open
*******************************************************************************/
inline void UserInterface::cb_m_open_i(Fl_Menu_*, void*)
{
//fl_message("jafar open....");
char* file;
file = fl_file_chooser("Open", "Resim (*.{jpg,png,gif,bmp})\t", 0);
if(file==NULL) return;
int size = strlen (file);
char ext[4];
ext[0] = file[size-3];
ext[1] = file[size-2];
ext[2] = file[size-1];
Fl_Image * image;
if (strcmp("jpg",ext) == 0)
{
image = new Fl_JPEG_Image(file);
}
if (strcmp("png",ext) == 0)
{
image = new Fl_PNG_Image(file);
}
if (strcmp("gif",ext) == 0)
{
image = new Fl_GIF_Image(file);
}
if (strcmp("bmp",ext) == 0)
{
image = new Fl_BMP_Image(file);
}
// box->resize(box->x(),box->y(),image->w(),image->h());
image=image->copy(box->w(),box->h());
box->image(image);
w1->label(file);
box->redraw();
// Scroll->redraw(); */
}
void UserInterface::cb_m_open(Fl_Menu_* o, void* v) {
((UserInterface*)(o->parent()->user_data()))->cb_m_open_i(o,v);
}
/*******************************************************************************
cb bouton save
*******************************************************************************/
inline void UserInterface::cb_m_save_i(Fl_Menu_*, void*) {
fl_message("jafar save....");}
void UserInterface::cb_m_save(Fl_Menu_* o, void* v) {
((UserInterface*)(o->parent()->user_data()))->cb_m_save_i(o,v);}
/*******************************************************************************
cb bouton imprimer
*******************************************************************************/
inline void UserInterface::cb_m_imp_i(Fl_Menu_*, void*) {
fl_message("jafar imprimer....");
/*QPrinter* print = new QPrinter;
print -> setOrientation (QPrinter::Landscape);
QPrintDialog printDialog (print);
bool ok = printDialog.exec();
if (!ok) setStatusTip ("Impression annulée!");
else {
//On crée l'image à imprimer
QPixmap pixGroupe = QPixmap :: grabWidget (i_groupe);
QPainter* paint = new QPainter (print);
paint -> drawPixmap (1, 1, 800, 300, pixGroupe);
}*/
}
void UserInterface::cb_m_imp(Fl_Menu_* o, void* v) {
((UserInterface*)(o->parent()->user_data()))->cb_m_imp_i(o,v);
}
/*******************************************************************************
cb bouton exit
*******************************************************************************/
inline void UserInterface::cb_m_exit_i(Fl_Menu_*, void*) {
exit(0);
}
void UserInterface::cb_m_exit(Fl_Menu_* o, void* v) {
((UserInterface*)(o->parent()->user_data()))->cb_m_exit_i(o,v);
}
/*******************************************************************************
cb bouton help
*******************************************************************************/
inline void UserInterface::cb_m_mhelp_i(Fl_Menu_*, void*) {
//w1->hide();
w2->show();
}
void UserInterface::cb_m_mhelp(Fl_Menu_* o, void* v) {
((UserInterface*)(o->parent()->user_data()))->cb_m_mhelp_i(o,v);
}
/*******************************************************************************
barre de manue
*******************************************************************************/
Fl_Menu_Item UserInterface::menu_mymenu[] = {
{"File", 0, 0, 0, 64, 0, 0, 14, 56},
{"Open", 0x4006f, (Fl_Callback*)UserInterface::cb_m_open, 0, 128, 0, 0, 14, 56},
{"Enregistrer Sous", 0x40073, (Fl_Callback*)UserInterface::cb_m_save, 0, 128, 0, 0, 14, 56},
{"Imprimer", 0x40070, (Fl_Callback*)UserInterface::cb_m_imp, 0, 128, 0, 0, 14, 56},
{"Exit", 0x40078, (Fl_Callback*)UserInterface::cb_m_exit, 0, 128, 0, 0, 14, 56},
{0,0,0,0,0,0,0,0,0},
{"Help", 0, 0, 0, 64, 0, 0, 14, 56},
{"Aide inpainting", 0xffbe, (Fl_Callback*)UserInterface::cb_m_mhelp, 0, 0, 0, 0, 14, 56},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0}
};
Fl_Menu_Item* UserInterface::m_file = UserInterface::menu_mymenu + 0;
Fl_Menu_Item* UserInterface::m_open = UserInterface::menu_mymenu + 1;
Fl_Menu_Item* UserInterface::m_save = UserInterface::menu_mymenu + 2;
Fl_Menu_Item* UserInterface::m_imp = UserInterface::menu_mymenu + 4;
Fl_Menu_Item* UserInterface::m_exit = UserInterface::menu_mymenu +5;
Fl_Menu_Item* UserInterface::m_help = UserInterface::menu_mymenu + 6;
Fl_Menu_Item* UserInterface::m_mhelp = UserInterface::menu_mymenu +7;
/*******************************************************************************
fonctions open
*******************************************************************************/
void Open1(Fl_Widget*, void*) {
w2->hide();
w1->show();
}
void open2(Fl_Widget*, void*) {
w1->hide();
w2->show();
}
/*******************************************************************************
declaration windows
*******************************************************************************/
Fl_Double_Window *w1=(Fl_Double_Window *)0;
//w1->resizable(w1);
Fl_Double_Window *w2=(Fl_Double_Window *)0;
/*******************************************************************************
windows 2
*******************************************************************************/
Fl_Double_Window* UserInterface::make_window() {
Fl_Double_Window* w;
{
{Fl_Double_Window* o = w2 = new Fl_Double_Window(350,10,300, 400, "help window");
w = o;
o->color((Fl_Color)53);
Fl_Output *IpOut = new Fl_Output(50, 240, 0, 0);
Fl_Box *box;
box = new Fl_Box (100, 100, 70, 70, "Hello World!");
box->box (FL_UP_BOX);
box->labelsize (16);
box->labelfont (FL_BOLD+FL_ITALIC);
box->labeltype (FL_SHADOW_LABEL);
{ Fl_Button* o = new Fl_Button(130, 370, 60, 20, "OK");
o->callback((Fl_Callback*)Open1);
o->color((Fl_Color)53);
}
o->end();}
/*******************************************************************************
windows 1
*******************************************************************************/
Fl_Double_Window* o = w1 = new Fl_Double_Window(750, 650, "Projet Fin Etude");
w1->resizable(w1);
Fl_Double_Window *w1=(Fl_Double_Window *)0;
o->color((Fl_Color)55);
w = o;
/*******************************************************************************
barre des raccourci
*******************************************************************************/
{ Fl_Menu_Bar* o = new Fl_Menu_Bar(0, 25, 750, 25, "jafar");
o->color((Fl_Color)53);
}
{ Fl_Button* o = new Fl_Button(0, 25, 30, 25);
o->image(image_ouvrir);
o->callback((Fl_Callback*)cb_m_open);
{ Fl_Button* o = new Fl_Button(30, 25, 30, 25);
o->image(image_sauv);
o->callback((Fl_Callback*)cb_m_save);
}
}
{ Fl_Button* o = new Fl_Button(60, 25, 30, 25);
o->image(image_imp);
o->callback((Fl_Callback*)cb_m_imp);
}
{ Fl_Button* o = new Fl_Button(90, 25, 30, 25);
o->image(image_aid);
o->callback((Fl_Callback*)cb_m_mhelp);
}
/************************************************************************/
//{ Fl_Group* o = new Fl_Group(100, 100, 347, 73);
//o->(FL_DOWN_BOX);
/****************************************************************/
//Fl_Box *picture=(Fl_Box *)0;
/*******************************************************************************
creation de l'horloge de marwen
*******************************************************************************/
new Fl_Clock(1, 600, 45, 50);
/*******************************************************************************
creation des tableau
*******************************************************************************/
// the tab window
{ Fl_Tabs *tabs = new Fl_Tabs(50, 90, 650, 500, "Methode d\'inpainting");
tabs -> box(FL_BORDER_BOX);
tabs->labelfont(13);
tabs->labelsize(25);
tabs->align(FL_ALIGN_BOTTOM_RIGHT);
// tab one
Fl_Group *tab1 = new Fl_Group(50,110,600,500, "Methode Manuelle");
tab1 -> selection_color(FL_BACKGROUND2_COLOR);
// box display
//Fl_Box* s = picture = new Fl_Box(25, 25, 20, 160, "image");
//Fl_Box *b = new Fl_Box(300, 200, 10, 10, "l\'image");
// the text display
/* Fl_Text_Display *display = new Fl_Text_Display(90,200,100,100);
Fl_Text_Buffer *buffer = new Fl_Text_Buffer();
display -> buffer(buffer);
buffer -> text("Hola");*/
/*********************************************************************************/
box = new Fl_Box(80, 150, 200, 250, "IMAGE");
/***********************************************************************************/
//tab1 -> resizable(display);
tab1 -> end();
Fl_Group::current() -> resizable(tab1);
// tab two
Fl_Group *tab2 = new Fl_Group(50,110,600,500, "Methode Automatique");
//Fl_Text_Display *display2 = new Fl_Text_Display(100,150,200,200);
//display2->buffer(buffer);
tab2 -> selection_color(FL_WHITE);
tab2 -> end();
Fl_Group::current() -> resizable(tab2);
// ending the tabs
tabs -> add(tab1);
tabs -> add(tab2);
tabs -> value(tab1);
tabs -> end();
tabs -> show();
}
/*{ Fl_Tabs* o = new Fl_Tabs(20, 60, 700, 515, "Methode d\'inpainting");
o->color(WHITE_BRUSH);
o->selection_color(WHITE_BRUSH);
o->labelfont(13);
o->labelsize(25);
o->align(FL_ALIGN_BOTTOM_RIGHT);
{ Fl_Tabs* o = new Fl_Tabs(700, 90, 700, 490, "Methode Manuelle");
o->color((Fl_Color)50);
//Fl_Box* s = picture = new Fl_Box(25, 25, 20, 160, "image");
//Create button("button","Enregistrer sous...",WS_CHILD | WS_VISIBLE ,200,510,140,20);
Fl_Group::current()->resizable(o);
//new Fl_Box(203, 95, 28, 25, "label");
//Fl_Group::current()->resizable(s);
//}
o->end();
}
{ Fl_Tabs* o = new Fl_Tabs(35, 90, 700, 490, "Methode Automatique");
o->color((Fl_Color)50);
o->hide();
o->end();
}
o->end();
}
//o->end();
//}*/
o->box(FL_BORDER_BOX);
o->user_data((void*)(this));
{ Fl_Menu_Bar* o = mymenu = new Fl_Menu_Bar(0, 0, 750, 25);
o->color((Fl_Color)53);
o->menu(menu_mymenu);
}
o->show();
o->end();
}
}
//wndclass.hbrBackground = (HBRUSH) GetStockObject ();
int main(int argc, char *argv[]) {
UserInterface window;
//window.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
window.make_window();
return Fl::run();
}
and Test.h :
// Dev-Cpp 4.9.9.2 with Mingw/GCC 3.4.2 + DevPak za FLTK + Fluid
// DevPak mozes skinuti sa lekinog sajta: [url]http://www.fltk.net/files/devpak/FLTK1.DevPak[/url]
// generated by Fast Light User Interface Designer (fluid) version 1.0106
#ifndef Test_h
#define Test_h
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Window.H>
#include <stdlib.h>
#include <FL/Fl_Menu_Bar.H>
#include <FL/filename.H>
#include <FL/fl_ask.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_GIF_Image.H>
#include <FL/Fl_BMP_Image.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Shared_Image.H>
#include <string.h>
#include <FL/Fl_Clock.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Image.H>
#ifndef test2_h
#define test2_h
#include <FL/Fl.H>
#include <Fl/Fl_Output.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Scroll.H>
extern Fl_Scroll *Scroll;
extern Fl_Box *picture;
Fl_Box *box;
void Open1(Fl_Widget*, void*);
void Open2(Fl_Widget*, void*);
#include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *w1;
#include <FL/Fl_Button.H>
extern void Open2(Fl_Button*, void*);
extern Fl_Double_Window *w2;
extern void Open1(Fl_Button*, void*);
#endif
extern void File_CB(Fl_Menu_*, void*);
class UserInterface {
public:
Fl_Double_Window* make_window();
Fl_Menu_Bar *mymenu;
static Fl_Menu_Item menu_mymenu[];
static Fl_Menu_Item *m_file;
static Fl_Menu_Item *m_open;
static Fl_Menu_Item *m_save;
static Fl_Menu_Item *m_imp;
private:
inline void cb_m_open_i(Fl_Menu_*, void*);
static void cb_m_open(Fl_Menu_*, void*);
private:
inline void cb_m_save_i(Fl_Menu_*, void*);
static void cb_m_save(Fl_Menu_*, void*);
private:
inline void cb_m_imp_i(Fl_Menu_*, void*);
static void cb_m_imp(Fl_Menu_*, void*);
public:
static Fl_Menu_Item *m_exit;
private:
inline void cb_m_exit_i(Fl_Menu_*, void*);
static void cb_m_exit(Fl_Menu_*, void*);
public:
static Fl_Menu_Item *m_help;
static Fl_Menu_Item *m_mhelp;
private:
inline void cb_m_mhelp_i(Fl_Menu_*, void*);
static void cb_m_mhelp(Fl_Menu_*, void*);
};
int main(int argc, char *argv[]);
#endif
i'd like to know haw can i draw on the image that i have opened in the box and haw to save it and haw to print it
thank u very much
Last edited by LuciWiz : 05-Sep-2006 at 09:46.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|