aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbPixmap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/FbPixmap.cc')
-rw-r--r--src/FbTk/FbPixmap.cc37
1 files changed, 36 insertions, 1 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()))