diff options
Diffstat (limited to 'src/FbTk/Image.cc')
-rw-r--r-- | src/FbTk/Image.cc | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/src/FbTk/Image.cc b/src/FbTk/Image.cc index 1026a92..a7ff7e5 100644 --- a/src/FbTk/Image.cc +++ b/src/FbTk/Image.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // Image.cc for FbTk - Fluxbox ToolKit | 1 | // Image.cc for FbTk - Fluxbox ToolKit |
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | 2 | // Copyright (c) 2003-2004 Henrik Kinnunen (fluxgen at users.sourceforge.net) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
@@ -30,10 +30,15 @@ | |||
30 | 30 | ||
31 | #ifdef HAVE_XPM | 31 | #ifdef HAVE_XPM |
32 | #include "ImageXPM.hh" | 32 | #include "ImageXPM.hh" |
33 | #endif /// HAVE_XPM | 33 | #endif // HAVE_XPM |
34 | |||
35 | #ifdef HAVE_IMLIB2 | ||
36 | #include "ImageImlib2.hh" | ||
37 | #endif // HAVE_IMLIB2 | ||
34 | 38 | ||
35 | #include <list> | 39 | #include <list> |
36 | #include <iostream> | 40 | #include <iostream> |
41 | #include <set> | ||
37 | using namespace std; | 42 | using namespace std; |
38 | 43 | ||
39 | namespace FbTk { | 44 | namespace FbTk { |
@@ -41,13 +46,41 @@ namespace FbTk { | |||
41 | Image::ImageMap Image::s_image_map; | 46 | Image::ImageMap Image::s_image_map; |
42 | Image::StringList Image::s_search_paths; | 47 | Image::StringList Image::s_search_paths; |
43 | 48 | ||
44 | PixmapWithMask *Image::load(const std::string &filename, int screen_num) { | ||
45 | 49 | ||
50 | void Image::init() { | ||
51 | |||
52 | // create imagehandlers for their extensions | ||
46 | #ifdef HAVE_XPM | 53 | #ifdef HAVE_XPM |
47 | // we must do this because static linkage with libFbTk will not init | 54 | new ImageXPM(); |
48 | // a static autoreg variable for it | ||
49 | static ImageXPM xpm; | ||
50 | #endif // HAVE_XPM | 55 | #endif // HAVE_XPM |
56 | #ifdef HAVE_IMLIB2 | ||
57 | new ImageImlib2(); | ||
58 | #endif // HAVE_IMLIB2 | ||
59 | } | ||
60 | |||
61 | void Image::shutdown() { | ||
62 | |||
63 | std::set<ImageBase*> handlers; | ||
64 | |||
65 | // one imagehandler could be registered | ||
66 | // for more than one type | ||
67 | ImageMap::iterator it = s_image_map.begin(); | ||
68 | ImageMap::iterator it_end = s_image_map.end(); | ||
69 | for (; it != it_end; it++) | ||
70 | handlers.insert(it->second); | ||
71 | |||
72 | // free the unique handlers | ||
73 | std::set<ImageBase*>::iterator handler_it = handlers.begin(); | ||
74 | std::set<ImageBase*>::iterator handler_it_end = handlers.end(); | ||
75 | for(; handler_it != handler_it_end; handler_it++) { | ||
76 | delete (*handler_it); | ||
77 | } | ||
78 | |||
79 | s_image_map.clear(); | ||
80 | } | ||
81 | |||
82 | PixmapWithMask *Image::load(const std::string &filename, int screen_num) { | ||
83 | |||
51 | 84 | ||
52 | if (filename == "") | 85 | if (filename == "") |
53 | return false; | 86 | return false; |