Subject:
loading bitmaps into pixmaps
From:
Robert Hartley ####@####.####
Date:
25 Jan 2001 23:37:41 -0000
Message-Id: <3A70B985.78078F7B@ics.com>
Hi,
I have an application with xbm type data compiled in as a bitmap.
I am using sections of this bitmap to represent each letter.
When I do, it comes out garbled, as though it were smudged.
Advice?
It looks like:
#define PalmFont0_width 1168
#define PalmFont0_height 11
#define PalmFont0_x_hot 0
#define PalmFont0_y_hot 0
static unsigned char PalmFont0_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,
... and so on...
In X11, the code to load it looks like:
palmFontBitmap = XCreateBitmapFromData(display, rootWindow,
(char *)PalmFont0_bits,
PalmFont0_width, PalmFont0_height);
I figured in NanoX it should look something like this:
palmFontBitmap = GrNewPixmap(PalmFont0_width, PalmFont0_height, (void
*) NULL);
GrBitmap(palmFontBitmap, gcNormal, 0,0,
PalmFont0_width, PalmFont0_height,
(GR_BITMAP *) PalmFont0_bits);
To actually make use of sections of it I do the following:
GrCopyArea(paintWindow, gc,
x, y,
end-start, PalmFont0_height,
palmFontBitmap,
start, 0,
MWROP_SRCCOPY);
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= Robert Hartley Mail: 201 Broadway =
= Central Region Systems Engineer Cambridge, MA 02139 =
= Integrated Computer Email: ####@####.#### =
= Solutions, Inc. Web Site: www.ics.com =
= Tech Support: ####@####.#### Phone: 800-800-4271 =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Visit the MotifZone (www.motifzone.org) for info on Motif!