[gtk-list] Using drawRGB with selective transparencies - correction




Naturally, the 2nd piece of code should read something like this (the
example only handles 1 line but you get the idea):

unsigned char  buf[3*width];
for (int j=0; j<height; j++)
     {
     // how do I set transparant drawing buffers??????
     for (int i=0; i<width*3; i++)
          {
          buf[i++] = <r_tansparant>;
          buf[i++] = <g_tansparant>;
          buf[i] = <b_tansparant>;
          }

     // draw line by line
     for (int i=0; i<npoints; i++)
          {
         coord2 = (COORD2*) listLine->El (i);
         int off = coord2->x;
         buf[off++] = c_r;
         buf[off++] = c_g;
         buf[off] = c_b;
          d_drawArea->drawRGB(0, offy, width, 1, buf, width*3);
          }
     }

Thanks
--> R




robert_gasch@peoplesoft.com on 07/05/99 03:55:47 PM

Please respond to gtk-list@redhat.com

To:   gtk-list@redhat.com
cc:
Subject:  [gtk-list] Using drawRGB with selective transparencies


Hi,

in my program, I first draw on a drawing area
using drawRGB. I would then like to overlay
this drawing area with some selective points,
also using drawRGB. The problem is that the
points I read are in no special order and thus
all over the place. Right now I'm doing the following
to draw the points 1 by 1:

for (int j=0; j<limLine; j++)
     {
     coord2 = (COORD2*) listLine->El (j);
     d_drawArea->drawRGB(coord2->x, coord2->y, 1, 1, buf, 3);
     }

I would like to change this so that I have a number of
buffers (1 for each line) where I can simply mark all the
points I need *before* drawing (which would mean that I
could switch to drawing line by line rather than point
by point; the first hopefully being a lot faster than the
point by point method). Unfortunateley, this means that some
of the points in the new buffer will have to be transparant.
In short, what I'm thinking off is something like this:

// quick off the top of my head (pseudo-)code
unsigned char  buf[3*width];
for (int j=0; j<height; j++)
     {
     // how do I set transparant drawing buffers??????
     for (int i=0; i<width*3; i++)
          {
          buf[i++] = <r_tansparant>;
          buf[i++] = <g_tansparant>;
          buf[i] = <b_tansparant>;
          }

     for (int i=0; i<npoints; i++)
          {
          coord2 = (COORD2*) listLine->El (i);
          d_drawArea->drawRGB(coord2->x, coord2->y, 1, 1, buf, 3);
          }
     }

So my question is: can I use transparent overlays with drawRGB?
If so how? Could anybody show me a quick example or point
me towards some sample code?

Thanks
--> R

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null










[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]