]> Dogcows Code - chaz/openbox/commitdiff
compiles
authorDana Jansens <danakj@orodu.net>
Sat, 18 Jan 2003 01:52:02 +0000 (01:52 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 18 Jan 2003 01:52:02 +0000 (01:52 +0000)
otk/rendercontrol.hh
otk/truerendercontrol.cc
otk/truerendercontrol.hh

index 123fd1bfb115a42d5c6c9a26c8fbde1c6ee07bfc..d3926745317b84d302f3e6a904ef31352890fcce 100644 (file)
@@ -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;
 };
 
 }
index 1eec1e45cb0d424e8e9b901fc63ed214dd77d8a2..26fa06a73a551c7cd844667e6026a678f61b3ecb 100644 (file)
@@ -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);
 }
index a62715f58194d9e2af33bd7c8ba5723925cae4f7..9647a2a302c5414ab6773064260d8e470dd76a2e 100644 (file)
@@ -17,7 +17,7 @@ public:
   TrueRenderControl(const ScreenInfo *screen);
   virtual ~TrueRenderControl();
 
-  virtual void render(::Drawable d) = 0;
+  virtual void render(::Drawable d);
 };
 
 }
This page took 0.030689 seconds and 4 git commands to generate.