[Xcb] xcb_image_text_8 Transparent Background
Cinolt
cinolt.yk at gmail.com
Sun Jan 2 01:05:45 PST 2011
After trying to use xcb_poly_text_8, I seem to be facing a similar problem
as is described here:
http://lists.freedesktop.org/archives/xcb/2007-January/002533.html
I define a structure:
struct
{
char *chars;
int nchars;
int delta;
xcb_font_t font;
} item;
item.chars = "Test";
item.nchars = 4;
item.delta = 0;
item.font = 0;
and I call xcb_poly_text_8_checked:
cookie_text = xcb_poly_text_8_checked(c, w, gc, 16, 16, 1, (const
uint8_t*)&item);
error = xcb_request_check(c, cookie_text);
printf("%d\n", (*error).error_code);
xcb_flush(c);
and get the output 16, which in X11/X.h is defined as BadLength. Are there
any examples at all of a working implementation of this function?
On Sun, Jan 2, 2011 at 3:40 AM, Aaron Plattner <aplattner at nvidia.com> wrote:
> On Sat, Jan 01, 2011 at 07:35:30PM -0800, Cinolt wrote:
> > Hello, the xcb_image_text_8 function seems to fill the area of the text
> > with the background color, and in my case it is black if not specified.
> > Is there any way to prevent it from filling in a background color, and
> > only draw the text? Here is a minimal example illustrating my problem, as
> > this only displays a black box when I want to draw black text. Setting
> > XCB_GC_FUNCTION to XCB_GX_CLEAR seems to have no effect.
>
> I don't think ImageText8 is what you want, then (emphasis mine):
>
> ImageText8
> drawable: DRAWABLE
> gc: GCONTEXT
> x, y: INT16
> string: STRING8
>
> Errors: Drawable, GContext, Match
>
> The x and y coordinates are relative to drawable's origin,
> and specify the baseline starting position (the initial
> ====> character origin). The effect is to first fill a
> ====> destination rectangle with the background pixel defined in
> ====> gc, and then paint the text with the foreground pixel.
> The upper left corner of the filled rectangle is at
> [x + overall-left, y - font-ascent]
> the width is
> overall-right - overall-left
> and the height is
> font-ascent + font-descent
> where overall-left, overall-right, font-ascent, and
> as font-descent are would be returned by a QueryTextExtents
> call using gc and string.
>
> ====> The alu-function and fill-style defined in gc are ignored for
> ====> this request; the effective alu-function is Copy and the
> ====> effective fill-style Solid.
>
> For fonts defined with two-byte matrix indexing, each STRING8
> byte is interpreted as a byte2 value of a CHAR2B with a byte1
> value of zero.
>
> GC components: plane-mask, foreground, background, font,
> subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
>
> I think what you want is PolyText8.
>
> -- Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20110102/9ff6d727/attachment.htm>
More information about the Xcb
mailing list