Professional Documents
Culture Documents
Overview
With a user program, the 920i can display graphics. The entire screen is writeable, and graphics can be any size up to the full 920i screen. Up to 100 graphic images can be displayed. The actual number of graphics that can be loaded depends on the size of the graphics and the user program, which both reside in user program space.
File Conversion
To create a user graphic, the desired graphic is created and sa ed as a monochrome bitmap !.bmp" file. The source of the graphic does not matter, as long as it is sa ed in monochrome bitmap format in a file that is not read#only. The bitmap graphic file is con erted to a user program #include !.iri" file using the bmp2iri.exe program as shown in $igure 1.
The e%ample command in $igure 1 shows the con ersion of a bitmap graphic file called Prompt.bmp. The con ersion program is run in a &'( command window as shown in the bo% in $igure 1. The bmp2iri program assumes the .bmp e%tension. $or a small graphic, the e%ample of $igure 1 would produce a user program #include file bitmap.iri similar to that shown in $igure 2. )ote that program names are ta*en from the file name of the original graphic.
+f additional graphic files are con erted by bmp2iri.exe, the output data is appended to the bitmap.iri file. The only limit on the number of graphics that are included in the bitmap.iri file is the size of user program space, remembering of course that the entire user program including graphics must fit in this space. Up to 100 graphics can be passed to the 920i for display at any one time.
g_Prompt : DisplayImage; Procedure initPrompt; begin g_Prompt !" :# !$; g_Prompt %" :# !$; g_Prompt &" :# !&%!'&&(%; g_Prompt (" :# %!()&$*+'$; g_Prompt '" :# '&$&',),(; g_Prompt $" :# %!()&*'&(%; g_Prompt )" :# !,)&(*&)$,; g_Prompt *" :# %!%%%!*''*; g_Prompt +" :# !,!,')%+%,; g_Prompt !," :# !&%!%!'&$; g_Prompt !!" :# ,; end; Figure 2 - bitmap.iri
+n the startup handler, call the array initialization routine for each graphic. To display or erase a graphic, or to clear all graphics, call DrawGraphic() with the appropriate parameters. &eclarations pertinent to the DrawGraphic() routine are,
type DisplayImage is array[2 #unction DrawGraphic(gr%num y%start color & !2" o# integer$ & integer$ x%start & integer$ & integer$ bitmap & DisplayImage$ 'olor%type) & (ys'ode$
+t is possible to create a graphic by defining a DisplayImage within a user program, howe er a description of that process is beyond the scope of this document.
/ user assigned number for the graphic. gr%num can be any number from 0 to 100. / call to DrawGraphic() with gr%num&)! will cause all user graphics to be remo ed from the display. )umbers from 1 to 100 will draw a graphic as long as both the width and height of the graphic are non#zero !see *+idth and ,eight* below".
x%start & integer
The 920i screen is 020 pi%els wide. The leftmost edge is the starting point, or pi%el 0. $rom there, pi%els are counted to the right by their offset from the first position, so the
rightmost pi%el is numbered 019. (pecify x%start to be the pi%el offset for the left side of the graphic.
y%start & integer
The 920i screen is 210 pi%els high. The top edge is the starting point, or pi%el 0. $rom there, pi%els are counted down by their offset from the first position, so the bottom of the screen is pi%el 209. (pecify y%start to be the pi%el offset for the top of the graphic.
bitmap & DisplayImage
The name of the graphic. $or the e%ample of $igure 2, the name is g23rompt.
color & 'olor%type
/t present, 4lac* and White are supported by the 920i. Use 4lac* to display a graphic. To clear a graphic, set the width or height to zero !see *+idth and ,eight* below".
(ys'ode
The return alue from a DrawGraphic() call will be one of the following, -ysDe.ice/rror if gr%num is larger than 100. -ys01 on success
+idth and ,eight
The width of the graphic is automatically set by bmp2iri.exe and are stored in the first two elements of the DisplayImage array. When either the width or height of a graphic are set to zero, a call to DrawGraphic() will delete the graphic from the screen. To remo e a graphic without changing the original graphic array, a procedure li*e that in Figure 3 could be used. The graphic number to be remo ed is passed to the DeleteGraphic() routine.
Procedure DeleteGraphic(gr_num : integer) nullGraphic : DisplayImage; begin nullGraphic !" :# ,; 22 -et width to 3ero DrawGraphic(gr_num4 ,4 ,4 nullGraphic4 5hite); end; Figure 3 - Deleting a Graphic
Limitations
&ue to the internal bit patterns of .bmp files, it is possible for a graphic that is the ma%imum size of 020%210 pi%els to produce an array that is larger than the ma%imum of 2102 elements. $or this reason, if a full screen graphic is necessary, -5W( recommends that the graphic be set to 019%209 to be sure size constraints are met. /ny message displayed using Display(tatus() will display o er user graphics, as will the horizontal and ertical lines that ma*e up the status bo%. User graphics will o erwrite soft*ey arches and te%t.
Shortcuts
+f the bitmap.iri file has a large number of graphics, you could edit the bitmap.iri file to add a procedure that calls all the initGraphic() routines. Then the startup handler would only need to call the new routine to initialize all the graphics arrays.