aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Image.cc
diff options
context:
space:
mode:
authormathias <mathias>2004-12-21 23:42:09 (GMT)
committermathias <mathias>2004-12-21 23:42:09 (GMT)
commitbc7c988561f79edb03b2ece80bb4ba0c8c73fc2e (patch)
treea48f394504f8b44cdab668ef69daf054c178500c /src/FbTk/Image.cc
parent7e41a1494a65ecdb05c7a34c274693cbd950647f (diff)
downloadfluxbox-bc7c988561f79edb03b2ece80bb4ba0c8c73fc2e.zip
fluxbox-bc7c988561f79edb03b2ece80bb4ba0c8c73fc2e.tar.bz2
adds imlib2-support to fluxbox: allows us to load several imageformats
besides xpm. to get imlib2 support in fluxbox one has to ./configure --enable-imblib2 default is disabled. a fluxbox-binary that supports imlib2 will have IMLIB2 in "fluxbox -info"-output explanation to the changed files: * xft.m4 -> acinclude.m4 + added ac_path_generic.m4 (from http://ac-archive.sourceforge.net/Miscellaneous/ac_path_generic.html) * configure.in, Makefile.am, src/FbTk/Makefile.am changed to handle imlib2-support * Font.cc/hh Image.cc/hh App.cc fluxbox.cc consistent way of init for global stuff for fonts and imagehandlers. * rest of changes just add the imlib2-code, pretty straightforward
Diffstat (limited to 'src/FbTk/Image.cc')
-rw-r--r--src/FbTk/Image.cc45
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>
37using namespace std; 42using namespace std;
38 43
39namespace FbTk { 44namespace FbTk {
@@ -41,13 +46,41 @@ namespace FbTk {
41Image::ImageMap Image::s_image_map; 46Image::ImageMap Image::s_image_map;
42Image::StringList Image::s_search_paths; 47Image::StringList Image::s_search_paths;
43 48
44PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
45 49
50void 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
61void 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
82PixmapWithMask *Image::load(const std::string &filename, int screen_num) {
83
51 84
52 if (filename == "") 85 if (filename == "")
53 return false; 86 return false;