Re: How Do I Draw A Bitmap?
- From: Havoc Pennington <hp redhat com>
- To: Eric Mader <mader jtcsv com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How Do I Draw A Bitmap?
- Date: 11 Jul 2001 22:43:05 -0400
Eric Mader <mader jtcsv com> writes:
I'm trying to write a little GNOME application to test a 3rd party
font scaler; I've got as far as getting the bitmaps for the
characters from the scaler, but I can't find a way to draw them.
Somehow I doubt the bitmaps are GdkBitmaps. What is the exact type and
format of these bitmaps?
The first thing I tried was gdk_draw_bitmap(). When I link my
application, that symbol doesn't get resolved.
That's because it doesn't exist. ;-)
(On a whim I tried to use gdk_draw_pixmap() instead; that prints out
some strange messages about incompatible parameters and exits - I
assume because the bitmap is the wrong depth?)
Bitmaps are simply 1-bit pixmaps. Most drawables will be 8-bit or
24-bit.
The depth refers to the size of a pixel. So in bitmaps, each pixel is
on or off, one bit. Color displays use a lot more bits per pixel.
gdk_draw_pixmap() simply copies blocks of memory around; if you don't
have matching depths then nothing logical happens. Each 8 or 24 pixels
in the bitmap would make up one color pixel with a random ugly color.
So this is not allowed.
Assuming you actually had a GdkBitmap, which seems unlikely from a 3rd
party font scaler, the way you would typically draw it would be to set
it as a clip mask (gdk_gc_set_clip_mask()), then draw a rectangle.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]