T.R | Title | User | Personal Name | Date | Lines |
---|
2045.1 | easy | FEGPX::SWEENEY | Patrick Sweeney in Hong Kong | Tue Jan 16 1990 10:14 | 5 |
| As you have phrased the question, the answer is "there is no function".
The superficial answer is "use XGetPixel", but the deeper answer is that
for windows, the pixel value can only be obtained when is the pixel is
viewable. For pixmaps, the pixel value is returned.
|
2045.2 | But not that easy! | EXLIB::DLUGOSZ | Open foot, Insert Mouth | Tue Jan 16 1990 10:46 | 19 |
| XGetPixel can't be used to directly access a window or pixmap. It's
definition is:
unsigned long XGetPixel(ximage, x, y)
XImage *ximage;
int x, y;
Know way to pas the pointer to the display or a resource id for
the drawable in question.
This routine is used with images (which are client side and explains
the lack of the above mentioned parameters). So before you use it
you must capture an image of the drawable (or part of it) using
XGetImage().
I don't know of any way to directly access a pixel in a drawable,
but sure wish that there was one!
Ron
|
2045.3 | From the depressed individual sitting on the window sill !!! | WPOMM2::ZAMBOTTI | | Tue Jan 16 1990 20:24 | 13 |
| Sound great so far guys...
What an oversight.
I'm trying to implement a flood routine and require to know the value of each
pixel as the flood area is been traversed. Creating an image of each pixel
sounds awful slow to me guys. Looks like I'll have to make an image of the
entire window and manipulate the image then put it back when the flood is
finished.
Buy buy cruel world...
Walter.
|
2045.4 | Yeah, I have to do the same thing. | EXLIB::DLUGOSZ | Open foot, Insert Mouth | Wed Jan 17 1990 09:38 | 8 |
| I need to implement the same type of feature for my program. That's
the only way I've figured out for doing it. Just haven't gotten
around to implementing it yet.
If you find some better way let me know!
Ron
|
2045.5 | works for me | FEGPX::SWEENEY | Patrick Sweeney in Hong Kong | Wed Jan 17 1990 09:51 | 7 |
| You XGetImage an rectangle (from the server), this puts into an XImage
structure (in the client) the actual pixel values that were on the
server. XGetImage generates a protocol request to the server and
expects some response back to the client.
XGetPixel is a client-side routine that extracts the pixel value from
the XImage structure resident in the client.
|
2045.6 | Server extension? | HANNAH::MESSENGER | Bob Messenger | Wed Jan 17 1990 10:30 | 26 |
| Re: .5
If you XGetImage from a window, what happens if the window is partially
obscured? It seems like you wouldn't be able to read any pixels that weren't
visible. To be safe, maybe you need to force the window to the top of the
stacking order before trying to read from it.
XGetImage from a pixmap, on the other hand, would always work (barring some
other problem).
Re: .3, .4
I think if you really want to implement flood properly you should write a
server extension. This would probably be hard to do but it should give you
the best possible performance. You might be able to take advantage of whatever
hardware assist was available on each server, although in that case you'd need
a different implementation of the extension on each server.
On the other hand, you'd still have to implement this in your application on
the client side, because you couldn't be sure that the extension would exist
in every server.
Of course writing a server extension might be out of the question if you're
under time constraints.
-- Bob
|
2045.7 | | PSW::WINALSKI | Careful with that VAX, Eugene | Wed Jan 17 1990 15:03 | 5 |
| The way my applications handle this is they remember what they wrote to the
screen (they have to, anyway, to handle expose events). Thus, I don't have to
ask the window what's where. I already know.
--PSW
|
2045.8 | On the way... | WPOMM2::ZAMBOTTI | | Wed Jan 17 1990 20:16 | 21 |
| Hi Ron,
Re .4 : Well I've written the routines and know I have to debug them. Let
you know when they are ready.
These fill and flood routines emulate the routines from a graphics package
called halo. You see thats my current project ; write a halo GKS emulator
for X windows.
Actually it will only be a subset of halo. Unless I do some 3am stuff and
complete it anyway!
One of the features that is required though is stroke/vector text. Let you
know when I have this going as well.
Re. 6 : Yeah great if you want to make it propriety again but one of the
conditions of the port is that it is platform transportable. Shucks!
Regards,
Walter.
|
2045.9 | Done already in DECpaint | DAVIS::peter | | Mon Jan 22 1990 16:00 | 4 |
| DECpaint (dxpaint) already does flood fill in this way. Contact
Johathan Joseph (SARAH::J_JOSEPH) or John Hainsworth
(SARAH::HAINSWORTH) for more information. I think John found some ways
to get reasonable performance out of it.
|