GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Sep-2006, 09:02
jafar jafar is offline
New Member
 
Join Date: Aug 2006
Posts: 20
jafar is on a distinguished road
Talking

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
CPP / C++ / C Code:
// 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 :

CPP / C++ / C Code:
// 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
  #2  
Old 16-Sep-2006, 07:22
MatthiasWM MatthiasWM is offline
VIP
 
Join Date: Nov 2004
Posts: 62
MatthiasWM will become famous soon enough

Re: draw in image


Drawing on images is actually a pretty complex task. You need to derive your own widget from fltk::Box or similar and implement darwing of the image and of whatever the user adds to it. You need to write at least a new :draw() and ::handle() function to react to mouse events and create the drawing itself.

It also depends a lot on what the user will draw. If he will merely add an arrow and a descriptive tex, then simply draw those over the existing imige (inside your new draw() method).

If you are planning a whole Gimp like drawing tool, you will be better of using offscreen buffers and blitting changes over to the screen. If you want to go faster and beyond that, OpenGL would be the way to go.

Alll in all, a pretty complex task that you have there.
  #3  
Old 19-Sep-2006, 10:51
jafar jafar is offline
New Member
 
Join Date: Aug 2006
Posts: 20
jafar is on a distinguished road

Re: draw in image


thx very much
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Threads & draw image j2me Java Forum 3 30-Aug-2006 10:55
loading image asal FLTK Forum 5 24-Feb-2006 11:43
Imagegalore -- Free image host, no registration needed! Qoozz Free Web Hosting 0 03-Jan-2006 05:47
GIM gidedit - a fltk fluid resize project cable_guy_67 FLTK Forum 2 01-Jun-2005 15:00
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 21:47

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:53.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.