ICONS ------------------------------------------------------------------- Icons are a special kind of image that are drawn as they are used, they are not stored as bit images. Icons are created with the ICON Editor. The ICON editor is included with the TEGL Windows Toolkit but is not included with the Intro Paks. PutPict(x,y: Word; Icon: Pointer; Color: Word); PutPict is the routine that draws an icon. The x,y parameters are the screen location to draw at. Icon points to a valid icon image, there is no checking done to see if the icon is a correct image. Color is the color that BLACK in the icon will be replaced with. PutPict is NOT viewport relative and is never clipped. These are all the icons in teglicon.tpu and moreicon.tpu. Note that the actual name to refer to an icon is image. ARROWDN ARROWLF ARROWRT ARROWUP BAR BELL BELL2 BLANKBUT BULB C CANCEL CHK7X6 CHK8X10 CHK8X12 CHK8X8 CLOCK COMPUTER CORNER CORNER2 CORNER3 CREDITS DISK DISK35 DISKDRV DOCUMENT DOWN DRAWER FILE FIND KEYBOARD KEYBRD2 LAST LBUT LEFT MBUT MC MONITOR MOUSE MOUSE2 MUSIC MUSIC2 NEXT NOTE NOTE2 OK PREV PRINTER QUESTN2 R RBUT READ RESIZE RIGHT SLIDER SLIDER2 STOPSIGN SUBMENU SYSTEM TIGER TINYTEGL TRASH UP VS WFDN WFUP WFICON WFLF WFRT WFUD WFBAR WRITE WFMDN This example simply create a frame a sticks an icon on it. Note that we use the x and y coordiates from the ImageStkPtr to place the iconimage. BEGINFILE> icon1.pas {-- icon1.pas} USES teglicon, moreicon, tgraph, fastgrph, teglunit, teglmain; VAR ifs: ImageStkPtr; BEGIN easytegl; easyout; quickframe(ifs,100,100,110,100); {-- use the frames x and y fields to draw the icon } {-- in a relative position } putpict(ifs^.x+10,ifs^.y+10,@imageSystem,BLACK); teglsupervisor; END. ENDFILE> PictSize(VAR width,height: Word; Icon: Pointer); This function returns the size of an icon in pixels. Icon is the icon that we are interrogating. Width and Height return the respective x and y dimentions of the icon. This next example shows a routine that draws an icon relative to a frame and won't write outside the frame boundaries. BEGINFILE> icon2.pas {-- icon2.pas} USES teglicon, moreicon, tgraph, fastgrph, teglunit, teglmain; {-- draw an icon image relative to a frame, do not draw it if } {-- it writes outside the frame } Procedure PutPictRel(ifs: ImageStkPtr; x,y: Word; Icon: Pointer; Color: Word); VAR dx,dy : Word; fmaxx,fmaxy : Word; BEGIN PictSize(dx,dy,icon); fmaxx := ifs^.x1 - ifs^.x + 1; fmaxy := ifs^.y1 - ifs^.y + 1; {-- check to see the icon will fit } if ((x + dx) > fmaxx) OR ((y + dy) > fmaxy) THEN exit; putpict(ifs^.x+x,ifs^.y+y,icon,color); END; VAR ifs: ImageStkPtr; BEGIN easytegl; easyout; quickframe(ifs,100,100,110,100); {-- use the frames x and y fields to draw the icon } {-- in a relative position } putpictRel(ifs,10,10,@imageSystem,BLACK); teglsupervisor; END. ENDFILE> ---------------------------------------------------------------------- END ICONS