📄 geos-3.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD> <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20"> <TITLE>GEOSLib docs: Library Functions</TITLE> <LINK HREF="geos-4.html" REL=next> <LINK HREF="geos-2.html" REL=previous> <LINK HREF="geos.html#toc3" REL=contents></HEAD><BODY><A HREF="geos-4.html">Next</A><A HREF="geos-2.html">Previous</A><A HREF="geos.html#toc3">Contents</A><HR><H2><A NAME="s3">3.</A> <A HREF="geos.html#toc3">Library Functions</A></H2><P>Functions here are sorted more or less in the way they appear in header files. This way I am ableto keep functions covering similar task near each other. All function names are identical to thosefrom <CODE>geosSym</CODE> file provided with GeoProgrammer package. Only my extensions to <CODE>geosSym</CODE>are covered by new names, but I tried to keep them in the naming convention.</P><H2><A NAME="ss3.1">3.1</A> <A HREF="geos.html#toc3.1">Graphics</A></H2><P>This section covers drawing package of GEOS along with text output routines.</P><H3>SetPattern</H3><P><CODE>void SetPattern (char pattern)</CODE></P><P>This function sets current pattern to given. There are 32 different patterns in GEOS. You cansee them together in the filling box in GeoPaint.</P><H3>GraphicsString</H3><P><CODE>void GraphicsString (char *myGString)</CODE></P><P>One of the more powerfull routines of GEOS. This function calls other graphic functions dependingon given command string. See structures chapter for more detailed description of the structure of it.</P><H3>Rectangle functions</H3><P>Parameters to those functions are grouped in <CODE>struct window drawWindow</CODE>. To speed up things andreduce overhead this structure is glued to zero page locations, where all rectangle functionsexpect their parameters. You can modify data directly (e.g. <CODE>drawWindow.top=10</CODE>) or via<CODE>InitDrawWindow</CODE> function. Contents of <CODE>drawWindow</CODE> are guaranteed not to change only whenusing graphics functions. In other case you should keep your data in separate <CODE>struct window</CODE>and use <CODE>InitDrawWindow</CODE> before first call to rectangle functions.</P><H3>InitDrawWindow</H3><P><CODE>void InitDrawWindow (struct window *myWindow)</CODE></P><P>This function only copies contents of <CODE>myWindow</CODE> into system area of <CODE>drawWindow</CODE>. Use itif for some reason you have to keep window data out of zero page space.</P><H3>Rectangle</H3><P><CODE>void Rectangle (void)</CODE></P><P>This draws on screen rectangle filled with current pattern.</P><H3>FrameRectangle</H3><P><CODE>void FrameRectangle (char pattern)</CODE></P><P>This one draws frame with given bit pattern (not a pattern from GEOS palette).</P><H3>InvertRectangle</H3><P><CODE>void InvertRectangle (void)</CODE></P><P>Just as the name says...</P><H3>ImprintRectangle and RecoverRectangle</H3><P><CODE>void ImprintRectangle (void)</CODE></P><P><CODE>void RecoverRectangle (void)</CODE></P><P>These two functions are for copying parts of the screen to (<CODE>Imprint</CODE>) and from (<CODE>Recover</CODE>)backbuffer of the screen. For example when drawing new menu box GEOS first uses<CODE>ImprintRectangle</CODE> to save the area under the box, and restores it by <CODE>RecoverRectangle</CODE> upondestroying the menu.</P><H3>Line Functions</H3><P>GEOS drawing package is optimized so there are different functions for drawing vertical andhorizontal lines.</P><H3>HorizontalLine</H3><P><CODE>void HorizontalLine (char pattern, char y, unsigned xStart, unsigned xEnd)</CODE></P><P>This function draws horizontal line using given pattern - here it is a true bit pattern, notpattern set by <CODE>SetPattern</CODE>.</P><H3>InvertLine</H3><P><CODE>void InvertLine (char y, unsigned xStart, unsigned xEnd)</CODE></P><P>There is only horizontal version.</P><H3>RecoverLine</H3><P><CODE>void RecoverLine (char y, unsigned xStart, unsigned xEnd)</CODE></P><P>This function recovers only one line. It is utilized by <CODE>RecoverRectangle</CODE>. See its descriptionfor more details.</P><H3>VerticalLine</H3><P><CODE>void VerticalLine (char pattern, char yStart, char yEnd, unsigned x)</CODE></P><P>This function draws vertical line using given pattern. Note that <CODE>pattern</CODE> is not a patternnumber as set in <CODE>SetPattern</CODE> but a true bit pattern.</P><H3>DrawLine</H3><P><CODE>void DrawLine (char mode, struct window *myWindow)</CODE></P><P><CODE>top</CODE> parameters of <CODE>struct window</CODE> describe the starting point of the line, while<CODE>bottom</CODE> are for the ending point. If <CODE>mode</CODE> is <CODE>DRAW_DRAW</CODE> then current pattern from<CODE>SetPattern</CODE> is used for drawing. If <CODE>mode</CODE> is <CODE>DRAW_ERASE</CODE> then line is erased from thescreen. If <CODE>mode</CODE> is <CODE>DRAW_COPY</CODE> then line is copied from/to back/frontbuffer, according to<CODE>dispBufferOn</CODE> setting.</P><H3>Point Functions</H3><P>Parameters to these two functions are passed by a pointer to own <CODE>struct pixel</CODE> filled withproper values.</P><H3>DrawPoint</H3><P><CODE>void DrawPoint (char mode, struct pixel *myPixel)</CODE></P><P>Depending on <CODE>mode</CODE> (see <CODE>DrawLine</CODE>) draws/erases/copies a single pointon the screen.</P><H3>TestPoint</H3><P><CODE>char TestPoint (struct pixel *myPixel)</CODE></P><P>This function tests if given pixel is set and returns <CODE>true</CODE> (non-zero) or <CODE>false</CODE> (zero).</P><H3>Character and string output</H3><H3>cpputs</H3><P><CODE>cpputsxy (char x, char y, char *myString)</CODE></P><P><CODE>cpputs (char *myString)</CODE></P><P>Actually this is a part of <CODE>conio</CODE>, but this function is non-standard. It isa variety of <CODE>cputs</CODE> that will output string with proportional spacing, notfixed like <CODE>cputs</CODE>.</P><H3>PutChar</H3><P><CODE>void PutChar (char character, char y, unsigned x)</CODE></P><P>This function outputs single character using current style and font to screen.</P><H3>PutString</H3><P><CODE>void PutString (char *myString, char y, unsigned x)</CODE></P><P>Same as <CODE>PutChar</CODE> except the fact that you can output whole <CODE>NULL</CODE>-terminated string.See <CODE>ggraph.h</CODE> for list of tokens that you can also place in the string - like <CODE>CBOLDON</CODE> or<CODE>COUTLINEON</CODE>.</P><H3>PutDecimal</H3><P><CODE>void PutDecimal (char parameter, unsigned value, char y, unsigned x)</CODE></P><P>This function converts <CODE>value</CODE> to its decimal representation and outputs it to the screen.The <CODE>parameter</CODE> is the field width in pixels (range 1-31) and mode bits. Depending on themthe string can be filled with zeroes (string always 5 characters long) or not and left or rightjustified to given pixel. See <CODE>ggraph.h</CODE> for predefined values for <CODE>parameter</CODE>.</P><H3>Font Handling</H3><H3>GetCharWidth</H3><P><CODE>char GetCharWidth (char character)</CODE></P><P>This function returns real width (in pixels) of given character with current font. It can be usedfor counting the length of string on screen, allowing for indentation or justification.</P><H3>LoadCharSet</H3><P><CODE>void LoadCharSet (struct fontdesc *myFont)</CODE></P><P>This function forces GEOS to use given font instead of own. <CODE>myFont</CODE> should be casted frompointer to the start of area where was loaded record from font file (VLIR structure).</P><H3>UseSystemFont</H3><P><CODE>void UseSystemFont (void)</CODE></P><P>This function forces GEOS to use built-in BSW font.</P><H3>Bitmap handling</H3><P>I'm not quite sure how are these functions working (except <CODE>BitmapUp</CODE>) so you shouldprobably look into library sources and compare it with your knowledge. Please let me knowif something is wrong or broken.</P><H3>BitmapUp</H3><P><CODE>void BitmapUp (struct iconpic *myPic)</CODE></P><P>This function unpacks the bitmap and places it on the screen - just as you set it in the<CODE>struct iconpic</CODE> pointer to which you pass. See <CODE>gstruct.h</CODE> for description of thisstructure. Note that you can only use packed GEOS bitmaps - simple Photo Scrap is in this format.</P><H3>BitmapClip</H3><P><CODE>void BitmapClip (char skipLeft, char skipRight, unsigned skipTop, struct iconpic *myPic)</CODE></P><P>This function acts similar to <CODE>BitmapUp</CODE> but you can also define which parts of the bitmap areto be drawn - you give the number of columns (8-pixel) to skip on the right and left of the bitmap,and the number of rows to skip from the top if it.</P><H3>BitOtherClip</H3><P><CODE>void BitOtherClip (void *proc1, void *proc2, char skipLeft, char skip Right, unsigned skipTop,struct iconpic *myPic)</CODE></P><P>Similar to the previous one with some extension. <CODE>proc1</CODE> is called before reading a byte (itreturns in .A next value), and <CODE>proc2</CODE> is called every time the parser reads a byte which isnot a piece of pattern (byte of code greater than 219). Both procedures should be writtenseparately in assembler and declared as <CODE>__fastcall__</CODE> returning char.</P><H2><A NAME="ss3.2">3.2</A> <A HREF="geos.html#toc3.2">Menus and Icons</A></H2><P>Here you will find information about functions related with menus and icons.</P><H3>Menus</H3><P>Menus are essencial for GUI. GEOS can handle only one menu at a time, but each menu can callanother one, which results in submenu tree. There can be up to 8 menu levels, each one with upto 32 items.</P><P>Menus are initialized with <CODE>DoMenu</CODE> and then Kernal takes care for everything. Your code(called from event handler) should be a function without parameters, returning void. You shoulduse <CODE>DoPreviousMenu</CODE> or <CODE>GotoFirstMenu</CODE> at least once in its code to have the screen clean.</P><H3>DoMenu</H3><P><CODE>void DoMenu (struct menu *myMenu)</CODE></P><P>This function initializes GEOS menu processor and exits. See <CODE>DoMenu structure</CODE> for moreinformation about it. Know that many GEOS application just initializes the screen, menu andexits to main Kernal loop, this proves the power of <CODE>DoMenu</CODE>.</P><H3>ReDoMenu</H3><P><CODE>void ReDoMenu (void)</CODE></P><P>This simply redraws the menu at lowest level. It works like calling <CODE>DoMenu</CODE> again withthe same parameters.</P><H3>RecoverMenu</H3><P><CODE>void RecoverMenu (void)</CODE></P><P>This function erases current menu from the screen. It doesn't change the menu level.</P><H3>RecoverAllMenus</H3><P><CODE>void RecoverAllMenus (void)</CODE></P><P>This calls <CODE>RecoverMenu</CODE> and erases all menus from the screen. Then the menu level isset to 0 (topmost).</P><H3>DoPreviousMenu</H3><P><CODE>void DoPreviousMenu (void)</CODE></P><P>This functions causes menu processor to go back one menu level. You should use it in menuhandler code to have the screen clean.</P><H3>GotoFirstMenu</H3><P><CODE>void GotoFirstMenu (void)</CODE></P><P>This one jumps back to the topmost menu. If there is only menu and submenu it works thesame as <CODE>DoPreviousMenu</CODE>.</P><H3>Icon Functions</H3><P>Icons are working similar to menus except the fact that there is only one level. Icons are
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -