summaryrefslogtreecommitdiff
path: root/otk
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-18 01:52:02 +0000
committerDana Jansens <danakj@orodu.net>2003-01-18 01:52:02 +0000
commitd264dbca0c51ff3dfacb66eb66543a0088447aa3 (patch)
tree76850ca3b7d6f2403b0ee16e353d40c48907d8f3 /otk
parent24b33ef877808f0af5b967f21c011ab8b314e780 (diff)
compiles
Diffstat (limited to 'otk')
-rw-r--r--otk/rendercontrol.hh3
-rw-r--r--otk/truerendercontrol.cc38
-rw-r--r--otk/truerendercontrol.hh2
3 files changed, 38 insertions, 5 deletions
diff --git a/otk/rendercontrol.hh b/otk/rendercontrol.hh
index 123fd1bf..d3926745 100644
--- a/otk/rendercontrol.hh
+++ b/otk/rendercontrol.hh
@@ -4,6 +4,7 @@
extern "C" {
#include <X11/Xlib.h>
+#include <X11/Xutil.h>
}
namespace otk {
@@ -66,7 +67,7 @@ public:
static RenderControl *getRenderControl(int screen);
- virtual void render(::Drawable d);
+ virtual void render(::Drawable d) = 0;
};
}
diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc
index 1eec1e45..26fa06a7 100644
--- a/otk/truerendercontrol.cc
+++ b/otk/truerendercontrol.cc
@@ -59,9 +59,41 @@ TrueRenderControl::~TrueRenderControl()
void TrueRenderControl::render(::Drawable d)
{
- Pixmap p = XCreatePixmap(**display, d, 255, 30, _screen->depth());
-
-
+ XGCValues gcv;
+ gcv.cap_style = CapProjecting;
+
+ int w = 255, h = 32;
+ Pixmap p = XCreatePixmap(**display, d, w, h, _screen->depth());
+ XImage *im = XCreateImage(**display, _screen->visual(), _screen->depth(),
+ ZPixmap, 0, NULL, w, h, 32, 0);
+ //GC gc = XCreateGC(**display, _screen->rootWindow(), GCCapStyle, &gcv);
+
+ im->data = new char[im->bytes_per_line * (h + 1)]; // XXX + 1?
+ char *dp = im->data;
+
+ for (int x = 0; x < w; ++x, ++dp)
+ *dp = 0;
+ for (int y = 0; y < 10; ++h)
+ for (int x = 0; x < w; ++x, ++dp)
+ *dp = _red_color_table[x] << _red_offset;
+ for (int y = 0; y < 10; ++h)
+ for (int x = 0; x < w; ++x, ++dp)
+ *dp = _green_color_table[x] << _green_offset;
+ for (int y = 0; y < 10; ++h)
+ for (int x = 0; x < w; ++x, ++dp)
+ *dp = _blue_color_table[x] << _blue_offset;
+ for (int x = 0; x < w; ++x, ++dp)
+ *dp = 0;
+
+ XPutImage(**display, p, DefaultGC(**display, _screen->screen()),
+ im, 0, 0, 0, 0, w, h);
+
+ //delete [] image->data;
+ //image->data = NULL;
+ XDestroyImage(im);
+
+ XCopyArea(**display, p, d, DefaultGC(**display, _screen->screen()),
+ 0, 0, w, h, 0, 0);
XFreePixmap(**display, p);
}
diff --git a/otk/truerendercontrol.hh b/otk/truerendercontrol.hh
index a62715f5..9647a2a3 100644
--- a/otk/truerendercontrol.hh
+++ b/otk/truerendercontrol.hh
@@ -17,7 +17,7 @@ public:
TrueRenderControl(const ScreenInfo *screen);
virtual ~TrueRenderControl();
- virtual void render(::Drawable d) = 0;
+ virtual void render(::Drawable d);
};
}