home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gfx / imagefx_sdk-2.0.lha / ImageFX_SDK / sas / examples / xdraw / normal.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-15  |  4.4 KB  |  196 lines

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