home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / sas / examples / xstyle / alpha.c next >
Encoding:
C/C++ Source or Header  |  1995-02-15  |  4.0 KB  |  199 lines

  1. /*
  2.  * A Skeleton Enhanced Drawing Mode for ImageFX 2.0
  3.  *
  4.  */
  5.  
  6. #include <exec/types.h>
  7. #include <scan/modall.h>
  8. #include <scan/drawinfo.h>
  9. #include <string.h>
  10. #include "common.h"
  11.  
  12. /**********************************************************************\
  13.  
  14.                                 Library Vectors
  15.  
  16. \**********************************************************************/
  17.  
  18. /*
  19.  * XDM_Attr:
  20.  *
  21.  * Return to ImageFX some information about the Drawing Style (eg.
  22.  * whether Options are needed, whether we work on greyscale or
  23.  * color, etc.).  Called when ImageFX first scans the drawing
  24.  * style directory.
  25.  *
  26.  */
  27. ULONG __saveds __asm XDS_Attr (register __a0 struct XDrawAttr *attr)
  28. {
  29.    attr->Flags = XDMF_UndoAlpha;
  30.    attr->Priority = 123;
  31.    return(0);
  32. }
  33.  
  34. /*
  35.  * XDS_Begin:
  36.  *
  37.  * Prepare before a pixel affecting operation.
  38.  *
  39.  */
  40. int __saveds __asm XDS_Begin (register __a0 struct IDrawInfo *di)
  41. {
  42.    di->SPrivate = (APTR)ScanBase->Alpha;
  43.    return(1);
  44. }
  45.  
  46. /*
  47.  * XDS_End:
  48.  *
  49.  * Cleanup after a pixel affecting operation.
  50.  *
  51.  */
  52. void __saveds __asm XDS_End (register __a0 struct IDrawInfo *di)
  53. {
  54. }
  55.  
  56. /*
  57.  * XDS_Get:
  58.  *
  59.  *
  60.  */
  61. int __saveds __asm XDS_Get (register __a0 struct IDrawInfo *di)
  62. {
  63.    struct Buffer *buf = (struct Buffer *)di->SPrivate;
  64.  
  65.    if (!buf) return(0);
  66.  
  67.    GetFromBuf(buf, di);
  68.  
  69.    return(1);
  70. }
  71.  
  72. /*
  73.  * XDS_Put:
  74.  *
  75.  *
  76.  */
  77. int __saveds __asm XDS_Put (register __a0 struct IDrawInfo *di)
  78. {
  79.    struct Buffer *buf = (struct Buffer *)di->SPrivate;
  80.  
  81.    if (!buf) return(0);
  82.  
  83.    PutToBuf(buf, di);
  84.  
  85.    return(1);
  86. }
  87.  
  88. /*
  89.  * XDS_Options:
  90.  *
  91.  * Present a window to the user allowing him to adjust drawing style
  92.  * options.  Arguments may optionally be passed from an Arexx command.
  93.  *
  94.  */
  95. int __saveds __asm XDS_Options (register __a0 LONG *args)
  96. {
  97.    return(0);
  98. }
  99.  
  100. /*
  101.  * XDS_LoadPrefs:
  102.  *
  103.  * Set preferences according to information loaded from disk.
  104.  *
  105.  */
  106. int __saveds __asm XDS_LoadPrefs (register __a0 void *prefs)
  107. {
  108.    return(1);
  109. }
  110.  
  111. /*
  112.  * XDS_SavePrefs:
  113.  *
  114.  * Request preferences settings that are about to be saved to disk.
  115.  *
  116.  */
  117. int __saveds __asm XDS_SavePrefs (register __a0 void *prefs)
  118. {
  119.    return(1);
  120. }
  121.  
  122. int __saveds __asm XDS_Init (void)
  123. {
  124.    return(1);
  125. }
  126.  
  127. void __saveds __asm XDS_Cleanup (void)
  128. {
  129. }
  130.  
  131.  
  132. /**********************************************************************\
  133.  
  134.                          Library Initialization Stuff
  135.  
  136. \**********************************************************************/
  137.  
  138. /*
  139.  * This is the table of all the functions that can be called in this
  140.  * module.  The first four (Open, Close, Expunge, and Null) are reserved
  141.  * for system use and MUST be specified in the order shown.  The actual
  142.  * functions are in the standard module startup code.
  143.  */
  144. ULONG FuncTable[] = {
  145.    /* These four MUST be present in this order */
  146.    (ULONG) LibOpen,
  147.    (ULONG) LibClose,
  148.    (ULONG) LibExpunge,
  149.    (ULONG) LibNull,
  150.  
  151.    /* Specific to the module */
  152.    (ULONG) XDS_Attr,
  153.    (ULONG) XDS_Begin,
  154.    (ULONG) XDS_End,
  155.    (ULONG) XDS_Get,
  156.    (ULONG) XDS_Put,
  157.    (ULONG) XDS_Options,
  158.    (ULONG) XDS_LoadPrefs,
  159.    (ULONG) XDS_SavePrefs,
  160.    (ULONG) 0,
  161.    (ULONG) 0,
  162.    (ULONG) XDS_Init,
  163.    (ULONG) XDS_Cleanup,
  164.  
  165.    /* End with -1L */
  166.    (ULONG) -1L
  167. };
  168.  
  169. /*
  170.  * These are used by the standard module startup code.
  171.  * LibraryName is the name of the library, and LibraryID is a short
  172.  * description of the library.  Both of these are largely irrelavent,
  173.  * but they are included just for completeness.
  174.  */
  175. UBYTE LibraryID[]    = "$VER: TraceAlpha Drawing Style 2.0.10 (15.2.95)";
  176. UBYTE LibraryType    = NT_XDRAWSTYLE;
  177.  
  178. /*
  179.  * This is called by the standard module startup code when Image Scan
  180.  * first opens the module.  Here we should fill in the NumGads,
  181.  * NewGad, Language, and LangCount fields of the provided ModuleBase
  182.  * structure if necessary.
  183.  */
  184. long  __asm UserOpen (register __a6 struct ModuleBase *modbase)
  185. {
  186.    return(TRUE);
  187. }
  188.  
  189. /*
  190.  * This is called by the standard module startup code when Image Scan
  191.  * closes the module.  It should cleanup anything allocated or obtained
  192.  * in the UserOpen() function.
  193.  */
  194. long  __asm UserClose (register __a6 struct ModuleBase *modbase)
  195. {
  196.    return(TRUE);
  197. }
  198.  
  199.