Single pass text and background

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

 



On Wed, 2003-07-16 at 02:04, Matthew Allen wrote:
> Hi,
> 
> I'm wondering whether there is a single pass method to draw text with a background using Xft? Just flat color, nothing special.
> 
> Something like XftDrawStringUtf8 with an extra couple of parameters for a rectangle and color.
> 
> This would make it much easier to write flicker free code. Currently I have to fill the area behind the text using a 
> rectangle primitive and then overlay the text, and of course this doesn't happen instantly so between the 2 operations you
> get background color only on the screen... and thus flicker. Yes I know double buffering fixes this, but the speed + memory 
> hit is a bit much for simple things like standard GUI widgets (tree/list/button etc).
> 
> This is one reason windows _looks_ a lot smoother than most X applications, because they can do this. I don't see why it can't be done 
> (maybe I'm missing something in the API?) because it's fairly simple at a technical level.

I think you'll find that in any more than simplistic situation, you
can't reliably a "DrawImageString" type primitive to prevent flicker -
e.g., modern toolkits allow buttons to have themed buttons with a
gradient or pixmap.

Double buffer. It's not the speed hit you think it is; blits
are *fast* these days. And there is no reason to keep double buffers
around permanently.

Regards,
						Owen

(Note that there are *performance* reasons to special case drawing
on a solid background, but it's possible to optimize that without
complicating the API with just a bit of cleverness.)




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux