home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dlib06.zip / DLIB / DLIB.H < prev    next >
Text File  |  1994-07-09  |  6KB  |  127 lines

  1. /************************************************************************
  2. dLib v0.5b
  3. Graeme Blackley
  4. g_blackl@kai.ee.cit.ac.nz
  5. *************************************************************************/
  6.  
  7. #define IMAGE_NOTCOMPILED   0
  8. #define IMAGE_COMPILED      1
  9.  
  10. struct _image {
  11.     unsigned short xs,ys;
  12.     unsigned char type;
  13.     unsigned char *image;
  14.     unsigned char *code;
  15. };
  16.  
  17. typedef struct _image IMAGE;
  18. typedef IMAGE *PIMAGE;
  19.  
  20. #if defined(__IBMC__)
  21.  #define __syscall _System
  22. #endif
  23.  
  24.  
  25. PCHAR __syscall dCreateVirtualScreen(ULONG xsize, ULONG ysize);
  26.     /* Creates the virtual screen. This must be called before any other 
  27.        dLib functions. It is a good idea to make the virtual screen a bit
  28.        larger than the view window. This allows scrolling, or an area 
  29.        allowing images to be drawn partially/totally out of view.
  30.        This function returns a pointer to the virtual screen, for use
  31.        by the application. */
  32.  
  33. void __syscall dSetOrigin(ULONG x, ULONG y);
  34.     /* This allows you look at different part of the virtual screen. 
  35.        (x,y) specifies what location in the virtual screen, will appear
  36.        at the top left of the screen. This is used for scrolling. It does 
  37.        not take effect until the next dShowView() */
  38.  
  39. void __syscall dSetViewArea(ULONG atx, ULONG aty, ULONG xsize, ULONG ysize);
  40.     /* Set where on the screen (monitor), in screen coordinates, the view
  41.        is to be display. This can be a bit difficult to work out. 
  42.        (0,0) is the top left. Affects next dShowView() */
  43.  
  44. ULONG __syscall dShowView(void);
  45.     /* Displays the current view, and any changes made. */
  46.  
  47. void __syscall dDistroyVirtualScreen(void);
  48.     /* Distroys Virtual screen, and free extra memory */
  49.  
  50. void __syscall dEnableDoubleBuf(void);
  51.     /* Makes a backup copy of the virtual screen. This backup can be used
  52.        to replace backgrounds during animation. It alot more effective
  53.        than copying the background before each draw of an image. */
  54.  
  55. void __syscall dReplaceFromDoubleBuf(int x1, int y1, int x2, int y2);
  56.     /* This function copies image data from the backup copy of the virtual 
  57.        screen. It is used to replace background images during animation.
  58.        dEnableDoubleBuf() must be called before this function. */
  59.  
  60. void __syscall dDisableDoubleBuf(void);
  61.     /* This disables double buffering, and frees the memory used be the
  62.        backup copy of the screen. */
  63.  
  64. void __syscall dSetVirtualPalette(PCHAR *rgb);
  65.     /* This function initializes a virtual palette. rgb is a pointer to 
  66.        768 bytes of data. This being 3 bytes (1 red, 1 green, 1 blue) for
  67.        each of the 256 colors */
  68.  
  69. unsigned char __syscall dNearestColor(unsigned char index);
  70.     /* This function returns the index of the physical color, most closely
  71.        matching the virtual color. */
  72.  
  73. void __syscall dRealizeImages(void);
  74.     /* Not supported yet. Its going to be for calling when another 
  75.        application changes the palette. */
  76.  
  77. void __syscall dWaitRetrace(void);
  78.     /* Can be used in animations to get super-smooth frames. This call is 
  79.        very dependant on the machine speed, so use it with caution. */
  80.  
  81. PIMAGE __syscall dLoadImage(char *filename);
  82.     /* Loads an image file from disk. This file has two 16bit words at the 
  83.        beginning. These are the horizontal size(xs) and vertical size(ys).
  84.        These words are followed by (xs*ys) bytes of image data. It would be
  85.        simple to write a routine to convert .bmp files into this format.
  86.        Theres also a couple of shareware paint programs (dos) that write
  87.        in this format, 256paint.zip? I personally use autodesk animator
  88.        and have writen a program that convert .cel's to this format.
  89.        If anyone writes any OS/2 based conversion (ie gif,bmp) tools, send
  90.        me a copy and I'll include it in a posible future release. */
  91.  
  92. void __syscall dCompileSprite(PIMAGE image);
  93.     /* This compiles an image, loaded with dLoadImage, in to a sprite. I
  94.        call images with transparent parts 'sprites'(not quite true). This
  95.        could also come from any other source aslong as it correctly fills
  96.        a IMAGE structure. */
  97.  
  98. void __syscall dBltSprite(unsigned int x, unsigned int y, PIMAGE image);
  99.     /* Draws a 'sprite' at (x,y). All parts of the image using color zero
  100.        will be transparent. This function may be a porters nightmare.
  101.        Debugging inside this call may also cause nightmares. It is a very
  102.        fast method */
  103.  
  104. void __syscall dBltImage(unsigned int x, unsigned int y, PIMAGE image);
  105.     /* Draw and image at (x,y). No transparent parts */
  106.  
  107. void __syscall dBltStretchImage(PIMAGE src, ULONG xd1, ULONG yd1, ULONG xd2, ULONG yd2);
  108.     /* This stretches an image to fill the rectangle specified on the
  109.        virtual screen. (xd1,yd) being the top left, (xd2,yd2) being bottom
  110.        right. Even though this is a well optomised stretch, its not the sort
  111.        of call you want to make often. In my tests is much faster than
  112.        similar OS/2 Gpi calls. Useful for stretching a picture over the 
  113.        entire background. */
  114.  
  115. void __syscall dCircle(int x1, int y1, int radius, unsigned char color);
  116.     /* Draws a Bresnham circle at (x,y) */
  117.  
  118. void __syscall dLine(int x1, int y1, int x2, int y2, unsigned char color);
  119.     /* draws a line from (x1,y1) to (x2,y2) */
  120.  
  121. void __syscall dBox(int x1, int y1, int x2, int y2, unsigned char color);
  122.     /* draws a solid box from (x1,y1) to (x2,y2) */
  123.  
  124. void __syscall dPixel(ULONG x, ULONG y, unsigned char color);
  125.     /* draws a dot at (x,y) */
  126.  
  127.