T.R | Title | User | Personal Name | Date | Lines |
---|
944.1 | XFillStippled | HANNAH::MESSENGER | Bob Messenger | Wed Jun 14 1989 12:08 | 11 |
| Re: .0
Are you trying to change another application's GC behind its back?
You can write your pattern to a 1-plane-deep pixmap and use this pixmap
as a stipple pattern. You need to set your fill_style to FillStippled. Look
up FillStippled in whatever Xlib documentation you're using. This should
work with lines, filled areas and text.
-- Bob
|
944.2 | a little more... | RABBET::FARRELL | Money, there is no substitute! | Fri Jun 16 1989 10:41 | 16 |
| > Are you trying to change another application's GC behind its back?
This is a legitimate program (graphic editor) which has nothing to do with
other's applications.
> You can write your pattern to a 1-plane-deep pixmap ..
Can you explain how you do this. I can set the GC's stipple pattern and
fill_style, but I used XCreateBitmapFromData and assigned a pixmap to it
(as I did for the icon picture), but I didn't get my pixel when I did
a FillRectangle, I just got black.
thanks,
$$$$ ted $$$$
|
944.3 | XCreateBitmapFromData should work | HANNAH::MESSENGER | Bob Messenger | Fri Jun 16 1989 14:10 | 8 |
| Re: .2
It's hard to say what you're doing wrong. Does your picture get drawn
correctly when you *don't* specify a stipple pattern? It would help if
you posted the relevant parts of your code.
-- Bob
|
944.4 | ... | RABBET::FARRELL | Money, there is no substitute! | Fri Jun 16 1989 16:06 | 17 |
|
I am simply trying to have some objects (i.e. lines, filled circles, filled
rectangles, you know, shapes).
I want certain shapes to have this pattern instead of a color. This would
allow you to see through, let's say, a rectangle, and see a line under it.
The bitmap pattern I created (using decw$examples:bitmap.exe), was just a
default size pattern with every fourth bit filled black.
If this doesn't help, I will post some code, but does this give you any ideas?
thanks for your responses,
$$$$ ted $$$
|
944.5 | Need more info... | HANNAH::MESSENGER | Bob Messenger | Fri Jun 16 1989 16:44 | 7 |
| Re: .4
Well, you didn't answer my question about whether your code works with
fill_style == FillSolid.
-- Bob
|
944.6 | ok, here's more...
| RABBET::FARRELL | Money, there is no substitute! | Sat Jun 17 1989 14:45 | 35 |
|
RE: .5 - Sorry Bob, I didn't see that part of your reply.
This is what the code looks like:
XGCValues gc_stuff;
Pixmap greyPixel;
GC context;
context->values.foreground=248; /* let's make it red for now */
XCreateGC(...,&context); /* Create the GC */
/* Use XGetAllocateNamedColor to get the LightGrey pixmap and load it into
greyPixel, this works fine. */
gc_stuff.fill_style = FillStipple;
gc_stuff.stipple = greyPixel;
gc_stuff.foreground = greyPixel;
XChangeGC(top_display,context,GCForeground | GCLineStyle | GCStipple,&gc_stuff);
/* Then draw something with the GC (fill rectangle) */
Well, the color changes to grey ok, but I definatly cannot see through it
like I wanted to. (I can change to any color, no problem).
I also tried assigning foreground and stipple to a pixmap I created using
XCreateBitmapFromData, but that just came out black.
Is this enough info? I am really stuck.
thanks (again),
$$$$ ted $$$$
|
944.7 | Pixel != Pixmap | HANNAH::MESSENGER | Bob Messenger | Sat Jun 17 1989 18:11 | 57 |
| Re: .6
Ted,
You seem to have the mistaken impression that pixels and pixmaps are
interchangeable.
>XGCValues gc_stuff;
>Pixmap greyPixel;
>GC context;
>
>context->values.foreground=248; /* let's make it red for now */
First, where did 248 come from, and second, why are you setting something in
the GC instead of the XGCValues? Does this even work?
>XCreateGC(...,&context); /* Create the GC */
Here "context" seems to be of type XGCValues. If it's really a GC you should
have said context = XCreateGC(...,&gc_stuff).
>/* Use XGetAllocateNamedColor to get the LightGrey pixmap and load it into
> greyPixel, this works fine. */
Eh? What's XGetAllocateNamedColor? If you mean XAllocNamedColor, it returns
a Pixel, not a Pixmap.
>gc_stuff.fill_style = FillStipple;
>gc_stuff.stipple = greyPixel;
>gc_stuff.foreground = greyPixel;
If greyPixel is a Pixmap you can't set it in gc_stuff.foreground. If it's a
Pixel you can't set it in gc_stuff.stipple.
>XChangeGC(top_display,context,GCForeground | GCLineStyle | GCStipple,&gc_stuff);
You wanted GCFillStyle, not GCLineStyle.
>/* Then draw something with the GC (fill rectangle) */
>
>Well, the color changes to grey ok, but I definatly cannot see through it
>like I wanted to. (I can change to any color, no problem).
Probably because greyPixel is a Pixel, and can't be used as a stipple pattern.
>I also tried assigning foreground and stipple to a pixmap I created using
>XCreateBitmapFromData, but that just came out black.
You should set foreground to the *color* (Pixel) you want. You should
set stipple to the *pattern* (Pixmap) you want. You get pixels by calling
something like XAllocNamedColor and you get pixmaps by calling XCreatePixmap
and then writing to them as if they were a window.
Does this clear things up?
-- Bob
|
944.8 | thanks... | RABBET::FARRELL | Money, there is no substitute! | Tue Jun 20 1989 11:23 | 15 |
|
Thanks Bob.
That will be the last time I put in a code example from memory. All the things
(but one) you mentioned, I did correctly in my real code. I just messed them
up on my restoration to that reply.
The one that you did notice, was the GCLineStyle, instead of the GCFillStyle.
This *was* my problem.
Thank you very much for all your help,
$$$$ ted $$$$
|