home *** CD-ROM | disk | FTP | other *** search
- /*
- * A Blur Enhanced Drawing Mode for ImageFX 2.0
- *
- */
-
- #include <exec/types.h>
- #include <scan/modall.h>
- #include <scan/drawinfo.h>
-
- /**********************************************************************\
-
- Library Vectors
-
- \**********************************************************************/
-
- /*
- * XDM_Attr:
- *
- * Return to ImageFX some information about the Drawing Mode (eg.
- * whether Options are needed, whether we work on greyscale or
- * color, etc.). Called when ImageFX first scans the drawing
- * mode directory.
- *
- */
- ULONG __saveds __asm XDM_Attr (register __a0 struct XDrawAttr *da)
- {
- da->Flags = XDMF_NoPen;
- da->Priority = 118;
- da->HorizOffs = 1;
- da->VertOffs = 1;
- return(0);
- }
-
- /*
- * XDM_Init:
- *
- * Initialize the drawing mode.
- *
- */
- int __saveds __asm XDM_Init (void)
- {
- return(1);
- }
-
- /*
- * XDM_Cleanup:
- *
- * Cleanup the drawing mode.
- *
- */
- void __saveds __asm XDM_Cleanup (void)
- {
- }
-
- /*
- * XDM_Begin:
- *
- * Prepare before a pixel affecting operation.
- *
- */
- int __saveds __asm XDM_Begin (register __a0 struct IDrawInfo *di)
- {
- return(1);
- }
-
- /*
- * XDM_End:
- *
- * Cleanup after a pixel affecting operation.
- *
- */
- void __saveds __asm XDM_End (register __a0 struct IDrawInfo *di)
- {
- }
-
- /*
- * XDM_Affect:
- *
- * Affect a block of pixels. We may also affect some of the
- * parameters of the IDrawInfo structure, such as the X & Y
- * location of the block of pixels.
- *
- */
- void __saveds __asm XDM_Affect (register __a0 struct IDrawInfo *di)
- {
- #ifdef USE_BUFFERS
-
- int i, j, y;
- UBYTE *ored, *ogrn, *oblu;
- UBYTE *ired, *igrn, *iblu;
-
- ored = di->OutR;
- ogrn = di->OutG;
- oblu = di->OutB;
-
- for (y = 1, j = 0; j < di->Height; y++, j++)
- {
- GetBufLines(di->BBuf, &ired, &igrn, &iblu, y-1, 3);
- GetBufLine(di->BOut, &ored, &ogrn, &oblu, j);
- ired += di->BufW + 1;
- igrn += di->BufW + 1;
- iblu += di->BufW + 1;
-
- for (i = 0; i < di->Width; i++) {
-
- *ored = ( *(ired - di->BufW) +
- *(ired - 1) +
- *(ired + 1) +
- *(ired + di->BufW) +
- *(ired) * 4 ) / 8;
- *ogrn = ( *(igrn - di->BufW) +
- *(igrn - 1) +
- *(igrn + 1) +
- *(igrn + di->BufW) +
- *(igrn) * 4 ) / 8;
- *oblu = ( *(iblu - di->BufW) +
- *(iblu - 1) +
- *(iblu + 1) +
- *(iblu + di->BufW) +
- *(iblu) * 4 ) / 8;
-
- ored++; ogrn++; oblu++;
- ired++; igrn++; iblu++;
- }
-
- PutBufLine(di->BOut);
- }
-
- #else
-
- int i, j;
- UBYTE *ored, *ogrn, *oblu;
- UBYTE *ired, *igrn, *iblu;
-
- ored = di->OutR;
- ogrn = di->OutG;
- oblu = di->OutB;
-
- for (j = 0; j < di->Height; j++) {
- ired = di->BufR + (j * di->BufW);
- igrn = di->BufG + (j * di->BufW);
- iblu = di->BufB + (j * di->BufW);
- for (i = 0; i < di->Width; i++) {
-
- *ored = ( *(ired - di->BufW) +
- *(ired - 1) +
- *(ired + 1) +
- *(ired + di->BufW) +
- *(ired) * 4 ) / 8;
- *ogrn = ( *(igrn - di->BufW) +
- *(igrn - 1) +
- *(igrn + 1) +
- *(igrn + di->BufW) +
- *(igrn) * 4 ) / 8;
- *oblu = ( *(iblu - di->BufW) +
- *(iblu - 1) +
- *(iblu + 1) +
- *(iblu + di->BufW) +
- *(iblu) * 4 ) / 8;
-
- ored++; ogrn++; oblu++;
- ired++; igrn++; iblu++;
- }
- }
-
- #endif
- }
-
- /*
- * XDM_Options:
- *
- * Present a window to the user allowing him to adjust drawing mode
- * options. Arguments may optionally be passed from an Arexx command.
- * This function will only be called if the flag XDMF_AreOptions is
- * returned from XDM_Attr().
- *
- */
- int __saveds __asm XDM_Options (register __a0 LONG *args)
- {
- return(0);
- }
-
- /*
- * XDM_LoadPrefs:
- *
- * Set preferences according to information loaded from disk.
- *
- */
- int __saveds __asm XDM_LoadPrefs (register __a0 void *prefs)
- {
- return(1);
- }
-
- /*
- * XDM_SavePrefs:
- *
- * Request preferences settings that are about to be saved to disk.
- *
- */
- int __saveds __asm XDM_SavePrefs (register __a0 void *prefs)
- {
- return(1);
- }
-
-
- /**********************************************************************\
-
- Library Initialization Stuff
-
- \**********************************************************************/
-
- /*
- * This is the table of all the functions that can be called in this
- * module. The first four (Open, Close, Expunge, and Null) are reserved
- * for system use and MUST be specified in the order shown. The actual
- * functions are in the standard module startup code.
- */
- ULONG FuncTable[] = {
- /* These four MUST be present in this order */
- (ULONG) LibOpen,
- (ULONG) LibClose,
- (ULONG) LibExpunge,
- (ULONG) LibNull,
-
- /* Specific to the module */
- (ULONG) XDM_Attr,
- (ULONG) XDM_Begin,
- (ULONG) XDM_End,
- (ULONG) XDM_Affect,
- (ULONG) XDM_Options,
- (ULONG) XDM_LoadPrefs,
- (ULONG) XDM_SavePrefs,
- (ULONG) 0,
- (ULONG) 0,
- (ULONG) XDM_Init,
- (ULONG) XDM_Cleanup,
-
- /* End with -1L */
- (ULONG) -1L
- };
-
- /*
- * These are used by the standard module startup code.
- * LibraryName is the name of the library, and LibraryID is a short
- * description of the library. Both of these are largely irrelavent,
- * but they are included just for completeness.
- */
- UBYTE LibraryID[] = "$VER: Blur Extended Drawing Mode 2.0.6 (15.2.95)";
- UBYTE LibraryType = NT_XDRAWMODE;
-
- /*
- * This is called by the standard module startup code when Image Scan
- * first opens the module. Here we should fill in the NumGads,
- * NewGad, Language, and LangCount fields of the provided ModuleBase
- * structure if necessary.
- */
- long __asm UserOpen (register __a6 struct ModuleBase *modbase)
- {
- return(TRUE);
- }
-
- /*
- * This is called by the standard module startup code when Image Scan
- * closes the module. It should cleanup anything allocated or obtained
- * in the UserOpen() function.
- */
- long __asm UserClose (register __a6 struct ModuleBase *modbase)
- {
- return(TRUE);
- }
-
-