-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathalpha_blend.cpp
More file actions
44 lines (39 loc) · 1.45 KB
/
alpha_blend.cpp
File metadata and controls
44 lines (39 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>
#include <string.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Box.H>
//
// Demonstrate overlapping alpha blended images -- erco 06/09/09
//
class MyWindow : public Fl_Window {
Fl_PNG_Image *left;
Fl_PNG_Image *right;
void GetFLTKVersion(char *s) { // get fltk version info for demo -- optional
sprintf(s, "FLTK %d.%d.%d", FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION);
}
public:
void draw() {
Fl_Window::draw(); // Draw window widget first
fl_font(FL_HELVETICA, 25); // set font
fl_color(FL_BLACK+FL_BOLD+FL_ITALIC); // set color
fl_draw("Hello YouTube, Alpha Blend", 0, 40); // draw a text string
left->draw(75,100); // draw left alpha image over the above
right->draw(75,100); // draw right alpha image over the above
}
MyWindow(int W, int H) : Fl_Window(W,H) {
char s[80]; GetFLTKVersion(s); copy_label(s); // (show fltk version -- optional)
left = new Fl_PNG_Image("./black.png"); // assumes images in cwd
right = new Fl_PNG_Image("./ubuntu.png"); // assumes images in cwd
show();
}
};
int main() {
fl_register_images();
MyWindow win(400,400);
win.show();
return(Fl::run());
}