1. xpm file
------=_NextPart_000_0005_01BF95FF.82249D60
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This might seem a stupid question but as a newcomer to Euphoria I am =
writing my first full program and have come to a problem that has got me =
stuck. I have converted a bmp picture to a xpm.e file. The trouble is =
that I do not know how to display the xpm picture in a window using =
Win32Lib.
Thanks
Brian Grace
------=_NextPart_000_0005_01BF95FF.82249D60
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>This might seem a stupid question but as a newcomer to Euphoria I =
am=20
writing my first full program and have come to a problem that has got me =
stuck.=20
I have converted a bmp picture to a xpm.e file. The trouble is that I do =
not=20
know how to display the xpm picture in a window using Win32Lib.</DIV>
<DIV>Thanks</DIV>
------=_NextPart_000_0005_01BF95FF.82249D60--
2. Re: xpm file
David Grace wrote:
> The trouble is that I do not know how to display the xpm
> picture in a window using Win32Lib.
An XMP is just a file format, and a fairly crude one at that. I use it
because it makes it easy to bind bitmaps into source code. The pixmap is
really just a plain old DIB (device independant bitmap).
Anyway, you first need to convert the XPM data into a Pixmap, typically with
xpmToPixmap:
constant MyPixmap = xpmToPixmap( myXpmData )
Probably the easiest way to display the pixmap is with copyBlt. Stick it
into the onPaint routine of the window, so when the window redraws itself,
the pixmap will be drawn:
onPaint_TheWindow( integer x1, integer y1, integer x2, integer y2 )
copyBlt( TheWindow, 10, 10, MyPixmap )
end procedure
onPaint[TheWindow] = routine_id("onPaint_TheWindow")
If you want to force the window to update after you've loaded the XPM, call
repaintWindow, which forces the window to be repainted immediately. Here's
the code all together (exit_xpm comes from TBAR_XPM.E):
-- START OF CODE
include win32lib.ew
constant
MyWindow = create( Window, "Demo", 0, Default, Default, 40, 80, 0 ),
MyPixmap = xpmToPixmap( exit_xpm )
procedure onPaint_MyWindow( integer x1, integer y1, integer x2, integer
y2 )
copyBlt( MyWindow, 1, 1, MyPixmap )
end procedure
onPaint[MyWindow] = routine_id("onPaint_MyWindow")
WinMain( MyWindow, Normal )
-- END OF CODE
Hope this clears things up.
-- David Cuny