aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-07-10 11:55:01 (GMT)
committerfluxgen <fluxgen>2003-07-10 11:55:01 (GMT)
commit2ed0befbad3370727a1ea2c122ed1da42e69af32 (patch)
tree5e152441bef0a3007cd40b7f8d75f909f97402ae
parentffead0ce00201c0ad82b3ccb6a2343f1c82750a7 (diff)
downloadfluxbox_paul-2ed0befbad3370727a1ea2c122ed1da42e69af32.zip
fluxbox_paul-2ed0befbad3370727a1ea2c122ed1da42e69af32.tar.bz2
added rotate
-rw-r--r--src/FbTk/FbPixmap.cc37
-rw-r--r--src/FbTk/FbPixmap.hh4
2 files changed, 39 insertions, 2 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index a05e287..75ab8d7 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.cc,v 1.4 2003/04/29 08:53:24 fluxgen Exp $ 22// $Id: FbPixmap.cc,v 1.5 2003/07/10 11:55:01 fluxgen Exp $
23 23
24#include "FbPixmap.hh" 24#include "FbPixmap.hh"
25#include "App.hh" 25#include "App.hh"
@@ -132,6 +132,41 @@ void FbPixmap::copy(const FbPixmap &the_copy) {
132 } 132 }
133} 133}
134 134
135void FbPixmap::rotate() {
136
137 Display *dpy = FbTk::App::instance()->display();
138
139 // make an image copy
140 XImage *src_image = XGetImage(dpy, drawable(),
141 0, 0, // pos
142 width(), height(), // size
143 ~0, // plane mask
144 ZPixmap); // format
145 // reverse height/width for new pixmap
146 FbPixmap new_pm(drawable(), height(), width(), depth());
147
148 GC gc = XCreateGC(dpy, drawable(), 0, 0);
149
150 // copy new area
151 for (int y = 0; y < height(); ++y) {
152 for (int x = 0; x < width(); ++x) {
153 XSetForeground(dpy, gc, XGetPixel(src_image, x, y));
154 // revers coordinates
155 XDrawPoint(dpy, new_pm.drawable(), gc, y, x);
156 }
157 }
158 XFreeGC(dpy, gc);
159
160 XDestroyImage(src_image);
161 // free old pixmap and set new from new_pm
162 free();
163
164 m_width = new_pm.width();
165 m_height = new_pm.height();
166 m_depth = new_pm.depth();
167 m_pm = new_pm.release();
168}
169
135void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) { 170void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) {
136 if (drawable() == 0 || 171 if (drawable() == 0 ||
137 (dest_width == width() && dest_height == height())) 172 (dest_width == width() && dest_height == height()))
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
index 94d37de..787c06f 100644
--- a/src/FbTk/FbPixmap.hh
+++ b/src/FbTk/FbPixmap.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.hh,v 1.4 2003/04/29 08:52:51 fluxgen Exp $ 22// $Id: FbPixmap.hh,v 1.5 2003/07/10 11:55:01 fluxgen Exp $
23 23
24#ifndef FBTK_FBPIXMAP_HH 24#ifndef FBTK_FBPIXMAP_HH
25#define FBTK_FBPIXMAP_HH 25#define FBTK_FBPIXMAP_HH
@@ -45,6 +45,8 @@ public:
45 ~FbPixmap(); 45 ~FbPixmap();
46 46
47 void copy(const FbPixmap &the_copy); 47 void copy(const FbPixmap &the_copy);
48 /// rotates the pixmap 90 deg, not implemented!
49 void rotate();
48 /// scales the pixmap to specified size 50 /// scales the pixmap to specified size
49 void scale(unsigned int width, unsigned int height); 51 void scale(unsigned int width, unsigned int height);
50 /// drops pixmap and returns it 52 /// drops pixmap and returns it