14 #include "resources/logo_128.xpm"
16 #include <FL/Fl_Pixmap.H>
17 #include <FL/Fl_RGB_Image.H>
18 #include <FL/fl_draw.H>
26 void timerCb(
void *user_data)
28 Logo *logo=
reinterpret_cast<Logo *
>(user_data);
31 Fl::repeat_timeout(0.1, timerCb, user_data);
36 Logo::Logo(
int x,
int y,
int w,
int h) : Fl_Box(x, y, w, h, 0)
38 Fl_Pixmap icon_xpm(logo_128_xpm);
40 image_orig=
new Fl_RGB_Image(&icon_xpm, FL_GRAY);
49 Fl::remove_timeout(timerCb,
this);
62 Fl::add_timeout(0.1, timerCb,
this);
70 Fl::remove_timeout(timerCb,
this);
93 fl_rectf(x(), y(), w(), h(), color());
99 int xx=x()+(w()-
image->w())/2;
100 int yy=y()+(h()-
image->h())/2;
109 inline void addPixel(
double tp[4],
const uchar *pixel,
int i,
int k,
int depth,
int ld,
double scale)
111 const uchar *p=pixel+(k*ld+i*depth);
113 for (
int d=0; d<depth; d++)
125 int depth=
image->d();
127 uchar *pixel=
new uchar [width*height*depth];
131 double sx=
static_cast<double>(
image->w())/width;
132 double sy=
static_cast<double>(
image->h())/height;
134 double xc=
image->w()/2.0;
135 double yc=
image->h()/2.0;
137 double ca=std::cos(a);
138 double sa=std::sin(a);
142 uchar bg[]={0, 0, 0, 0};
145 unsigned background=Fl::get_color(FL_BACKGROUND_COLOR);
147 bg[0]=
static_cast<uchar
>(background>>24);
148 bg[1]=
static_cast<uchar
>(background>>16);
149 bg[2]=
static_cast<uchar
>(background>>8);
150 bg[3]=
static_cast<uchar
>(background);
156 for (
int k=0; k<height; k++)
158 for (
int i=0; i<width; i++)
172 double tx = x*ca + y*sa;
173 double ty = -x*sa + y*ca;
181 if (x >= 0 && y >= 0 && x+1 <
image->w() && y+1 <
image->h())
186 x=std::max(0.0, std::min(x,
image->w()-1.001));
187 y=std::max(0.0, std::min(y,
image->h()-1.001));
189 int si=
static_cast<int>(x);
190 int sk=
static_cast<int>(y);
195 double p[4]={0, 0, 0, 0};
197 addPixel(p,
image->array, si, sk, depth, line, (4-x)*(4-y));
198 addPixel(p,
image->array, si+1, sk, depth, line, x*(4-y));
199 addPixel(p,
image->array, si, sk+1, depth, line, (4-x)*y);
200 addPixel(p,
image->array, si+1, sk+1, depth, line, x*y);
202 for (
int d=0; d<depth; d++)
204 tp[d]=
static_cast<uchar
>(0.0625*p[d]);
209 for (
int d=0; d<depth; d++)
221 Fl_RGB_Image *ret=
new Fl_RGB_Image(pixel, width, height, depth, width*depth);