home *** CD-ROM | disk | FTP | other *** search
- /*
- * ImageFX Development Header File
- * Copyright © 1991-1995 Nova Design, Inc.
- * Written by Thomas Krehbiel
- *
- * ScanBase and ModuleBase.
- *
- */
-
- #ifndef SCAN_MOD_H
-
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
-
- #ifndef EXEC_LIBRARIES_H
- #include <exec/libraries.h>
- #endif
-
- #ifndef EXEC_SEMAPHORES_H
- #include <exec/semaphores.h>
- #endif
-
- #ifndef LIBRARIES_DOS_H
- #include <libraries/dos.h>
- #endif
-
- #ifndef SCAN_GED_H
- #include <scan/ged.h>
- #endif
- #ifndef SCAN_PREFS_H
- #include <scan/prefs.h>
- #endif
- #ifndef SCAN_CMD_H
- #include <scan/cmd.h>
- #endif
- #ifndef SCAN_BUF_H
- #include <scan/buf.h>
- #endif
-
- /*
- * Module Types, to be found in the Node->ln_Type field. I think NT_USER
- * is defined in exec/nodes.h
- */
- #define NT_PREVIEW (NT_USER-1)
- #define NT_SCANNER (NT_USER-2)
- #define NT_RENDER (NT_USER-3)
- #define NT_PRINTER (NT_USER-4)
- #define NT_QUANTIZE (NT_USER-5)
- #define NT_DITHER (NT_USER-6)
- #define NT_LOADER (NT_USER-7)
- #define NT_SAVER (NT_USER-8)
- #define NT_HOOK (NT_USER-9)
- #define NT_DRAWMODE (NT_USER-10)
- #define NT_XDRAWMODE (NT_USER-11) /* extended drawmode (2.0) */
- #define NT_XDRAWSTYLE (NT_USER-12) /* extended drawstyle (2.0) */
- #define NT_SYSTEM (NT_USER-13)
- #define NT_FEATHER (NT_USER-14) /* feather module (2.0) */
-
- /*
- * ModuleBase:
- *
- * This is an extension of a standard Library structure created by
- * ImageFX for external modules (eg. scanners, printers, previews).
- *
- */
- struct ModuleBase
- {
- struct Library Library; /* Standard Exec library */
- UBYTE Flags; /* Generic Flags - see below */
- BYTE pad; /* was NumGads - now a pad */
- BPTR Segment; /* AmigaDos module segment */
- struct Library *SysLib; /* Exec.library pointer */
- struct ScanBase *ScanBase; /* scan.library pointer */
- struct NewGad *NewGad; /* Pointer to custom gadgets */
- struct GedContext GContext; /* Gadget context maintained by Scan */
- char *Language; /* Scan.text "tag" for finding text */
- char **Text; /* Text array loaded by Scan */
- long LangCount; /* Count of entries in text array */
- RXCMD *CmdTable; /* Table of commands recognized */
- ULONG PrefID; /* Prefs file identifier */
- ULONG PrefLen; /* Length of prefs data chunk */
- struct NewWindow *NewWin; /* NewWindow for preview options */
- ULONG ExtFlags; /* Extended flags - future expansion */
- APTR NewGC; /* private */
- ULONG Attr; /* XDrawMode/XDrawStyle attributes */
- BYTE BufXO, BufYO; /* For XDrawMode */
- BYTE Iterations; /* For XDrawMode */
- BYTE pad2;
- ULONG Reserved[9]; /* Reserved for expansion */
- /*
- * 64 bytes of space are reserved here
- * for information specific to the
- * module. Image Scan ignores this
- * data but guarantees its integrity.
- */
- };
-
- /*
- * Flag bits:
- */
- #define MF_VISIBLE (0x01) /* Scan sets this flag when your
- module is visible onscreen (ie.
- the gadgets may be updated
- without fear of crashing). */
- #define MF_TEXTLOADED (0x02) /* Text has been loaded */
- #define MF_EGS (0x80) /* Called from EGS ImageFX */
-
- /*
- * Extended flag bits:
- */
- #define XF_MOUSETRAP (0x01) /* Module should be notified of
- mouse button and movement events.
- Your module's *_HandleMMove() and
- *_HandleMButton() will be called
- upon seeing mouse button/movement
- events; you should return non-zero
- if you processed the event yourself.
- You are passed a pointer to a COPY
- of the event, do not reply to it.
- Only for Scanner, Render, Printer
- modules. */
- #define XF_24BITREND (0x02) /* Rendered images are really 24-bit */
- #define XF_MOVEMENU (0x04) /* Preview module wants to be notified
- when the menu panel moves, gets
- hidden, or whatever. */
- #define XF_EXTENDEDINIT (0x08) /* Preview module can handle extended
- initialization routine */
- #define XF_GHOST (0x10) /* Preview module can ghost unused
- areas of the screen */
- #define XF_STICKY (0x20) /* "Sticky" modules remain in memory,
- currently only used for savers
- such as ANIM and FLC */
- #define XF_IDENTIFY (0x40) /* Loader can identify headers */
- #define XF_LOADNOTIFY (0x80) /* Module can handle load notification -
- a module vector will be called when
- a new image is loaded, created,
- whatever by the user */
- #define XF_LOADMASK (0x100) /* Loader supports LM_LoadMask (2.0 only) */
- #define XF_SAVEMASK (0x200) /* Saver supports SM_SaveMask (2.0 only) */
- #define XF_NEWDMODE (0x400) /* Extended Drawing Mode (2.0 only) */
- #define XF_LOADMAPPED (0x800) /* Loader supports LM_LoadMapped (2.0 only) */
-
- #define XF_EGSCOMPAT (0x8000) /* Set this ExtFlag if your module
- is definitely EGS-ImageFX compatible.
- Otherwise, the user will be given
- a warning whenever he uses your
- module with EGS-ImageFX. (1.6 only) */
-
- #define NumGads pad /* Ancient compatibility, do not use */
-
- /*
- * ScanBase:
- *
- * Library created and maintained by ImageFX. Hook programs will open
- * this library to gain access to ImageFX, and Modules will be passed
- * a pointer to this library directly for accessing these functions.
- *
- * Most of these fields should be considered READ ONLY, except where
- * noted otherwise.
- *
- */
- struct ScanBase
- {
- struct Library Library; /* Standard Exec library */
-
- /*
- * pScreen and pWindow can be used to access the ImageFX toolbox
- * screen and window. It is generally not advised that you render
- * graphics to this screen, though.
- */
- struct Screen *pScreen; /* Pointer to menu panel screen */
- struct Window *pWindow; /* Pointer to menu panel window */
- struct RastPort *pRPort; /* Pointer to menu panel rastport
- (NOTE: It would be wiser to
- access the RastPort through
- pWindow.) */
-
- /*
- * Prefs contains information about the current user preferences
- * settings.
- */
- struct UserPrefs Prefs; /* User preferences settings
- (see scan/prefs.h) */
-
- /*
- * Amiga Library bases.
- */
- struct IntuitionBase *IntuitionBase; /* Intuition.library base */
- struct GfxBase *GfxBase; /* Graphics.library base */
-
- /*
- * Do not set LastError directly; use the functions SetError()
- * and GetError() to set and retreive the value.
- */
- unsigned long LastError; /* Global error variable */
-
- /*
- * MainBuffer is a pointer to the visible buffer. A new buffer may
- * be installed by deleting the old one (with KillBuffer()) and
- * providing a new pointer. NULL indicates no main buffer.
- */
- struct Buffer *MainBuffer; /* Main (visible) buffer */
-
- /*
- * SwapBuffer is a pointer to the hidden buffer. A new buffer may
- * be installed by deleting the old one (with KillBuffer()) and
- * providing a new pointer. NULL indicates no swap buffer.
- */
- struct Buffer *SwapBuffer; /* Swap (hidden) buffer */
-
- /*
- * Text is a pointer to the text strings used by ImageFX.
- */
- char **Text; /* Language text array */
-
- struct SignalSemaphore Lock; /* Arbitrate access to library (UNUSED) */
-
- /*
- * Alpha is a pointer to the alpha channel buffer. A new buffer may
- * be installed by deleting the old one (with KillBuffer()) and
- * providing a new pointer. NULL indicates no alpha channel.
- */
- struct Buffer *Alpha; /* Alpha channel buffer */
-
- /********************** Additions in 0.53 ************************/
-
- /*
- * These values show the current state of various tools and settings
- * within ImageFX. They should be considered READ ONLY.
- */
- signed char sb_AreaTool; /* Current region selection */
- signed char sb_DrawTool; /* Current drawing tool */
- unsigned char sb_Channel; /* Current channel mask setting */
- signed char sb_GuiLocked; /* Are graphics locked? */
-
- signed char sb_ArexxCmd; /* Currently execute Arexx cmd? */
- signed char sb_Iconified; /* Are we currently iconified? */
-
- signed char sb_FillType; /* Current fill type */
- signed char sb_FillRange1; /* Gradient fill range #1 */
- signed char sb_FillRange2; /* Gradient fill range #2 */
- signed char sb_FillSmooth; /* Gradient fills are smoothed? */
- signed char sb_FillSkew; /* Gradient fill "skew" */
- signed char sb_FillRough; /* Area fill "roughness" */
- short sb_FloodClose; /* Flood fill "closeness" */
- signed char sb_LightTab; /* LightTable on? */
- signed char sb_AlphaMask; /* Use alpha as stencil/frisket? */
-
- signed char sb_EdgeMode; /* Current edge mode */
- unsigned char sb_EdgeDir; /* Edge direction mask */
- short sb_EdgeRadius; /* Edge radius affected */
-
- signed char sb_Hidden; /* Menu panel hidden? */
- signed char sb_TranspRange;/* Transparent range (OBSOLETE) */
- short sb_TranspClose;/* Transparent "closeness" (OBSOLETE) */
-
- signed char sb_AirRadius; /* Airbrush radius */
- signed char sb_DrawMode; /* Current drawing mode */
- signed char sb_DrawBlend; /* Current blend setting */
- signed char sb_Mode; /* Which menu we're in */
-
- short sb_GridX, /* Grid Width */
- sb_GridY, /* Grid Height */
- sb_GOffsetX, /* Grid X Origin */
- sb_GOffsetY; /* Grid Y Origin */
-
- /*
- * sb_Brush contains a pointer to the current brush, or NULL if none
- * is defined. To install a new brush, you should use the scan.library
- * function NewBrush() instead of setting this field directly. NewBrush()
- * handles rendering and refreshing the brush for you.
- *
- */
- struct Buffer *sb_Brush; /* Current Brush */
-
- /*
- * Module pointers are READ ONLY!
- */
- struct ModuleBase *sb_Scanner; /* The current Scanner module */
- struct ModuleBase *sb_Render; /* The current Render module */
- struct ModuleBase *sb_Printer; /* The current Printer module */
-
- /*
- * sb_PubName is the name of the public screen which ImageFX is open
- * on. For a custom screen, this is created by ImageFX (eg. "IMAGEFX.1").
- * When using WBMode, this is the name of the screen we opened on
- * (eg. "DEFAULT"). READ ONLY!
- *
- * When opening a window on the ImageFX screen, you should open onto
- * this public screen.
- *
- */
- char *sb_PubName; /* Public screen name */
-
- /*
- * sb_ArexxName is the name of ImageFX's Arexx port (eg. "IMAGEFX.1").
- * READ ONLY!
- */
- char *sb_ArexxName; /* Arexx port name */
-
- /*
- * sb_CurrentDir is a lock on the ImageFX directory. READ ONLY!
- */
- BPTR sb_CurrentDir; /* Lock on Mirage current dir */
-
- /*
- * sb_ThisTask is a pointer to ImageFX's Task structure. READ ONLY!
- */
- struct Task *sb_ThisTask; /* Pointer to Mirage task */
-
- /*
- * More internal settings. READ ONLY!
- */
- char sb_DrawAlpha; /* Alpha channel status for drawing */
- char sb_AirDensity; /* Airbrush center density */
- char sb_AirSmear; /* Airbrush smear mode */
-
- /*
- * sb_BackPen is the pen number to use when rendering background pixels
- * on the toolbox menu. Under normal circumstances this will be pen 0,
- * but with Opaque Panel on, it could be different. Always use this
- * pen number instead of assuming 0. READ ONLY!
- *
- * EG: // erase background
- * SetAPen(ScanBase->sb_BackPen);
- * RectFill(pWindow->RPort, left, top, width, height);
- */
- char sb_BackPen; /* Menu panel background pen # */
-
- struct Screen *sb_Shanghai; /* "Shanghai" screen */
-
- /*
- * More internal settings. READ ONLY!
- */
- char sb_PenType; /* Type of default pen */
- char sb_PenSize; /* Size of default pen */
- char sb_AlphaTab; /* Light table to swap or alpha? */
- char sb_AirRough; /* Airbrush roughness */
-
- /*
- * When a Hook program is launched via. an Arexx command, sb_HookMsg
- * contains the RexxMsg that was used to do so. This can be used
- * to set the result string via. the scan.library SetResult() function.
- * READ ONLY!
- *
- */
- struct RexxMsg *sb_HookMsg; /* Message that invokes a hook */
-
- /*
- * Pointer to Preview Screen. In 2.0, do not use this pointer. Use
- * sb_vWindow instead. READ ONLY!
- */
- struct Screen *sb_vScreen; /* Preview screen, or NULL */
-
- /*
- * sb_HelpLock is a lock on the directory where the help text resides.
- * READ ONLY!
- */
- BPTR sb_HelpLock; /* Where the help directory is */
-
- /*
- * sb_HostPort is a pointer to ImageFX's Arexx port. READ ONLY!
- */
- struct MsgPort *sb_HostPort; /* Scan arexx port */
-
- ULONG sb_Magic; /* Magic constant, just for fun */
-
- /*
- * sb_TextLock is a lock on the directory where ImageFX localization
- * text resides. READ ONLY!
- */
- BPTR sb_TextLock; /* Text directory lock */
-
- /*
- * More internal settings. READ ONLY!
- */
- short sb_PantoDX; /* Pantograph offsets */
- short sb_PantoDY;
-
- short sb_PantoCX; /* Pantograph center coords */
- short sb_PantoCY;
-
- UBYTE *sb_PenArray; /* Pen definition (DO NOT TOUCH) */
- short sb_PenWidth; /* Pen width (DO NOT TOUCH) */
- short sb_PenHeight; /* Pen height (DO NOT TOUCH) */
-
- UBYTE *sb_AirArray; /* Airbrush definition (DO NOT TOUCH) */
- short sb_AirWidth; /* Airbrush width (DO NOT TOUCH) */
- short sb_AirHeight; /* Airbrush height (DO NOT TOUCH) */
-
- UBYTE sb_Exclusive; /* Disable GUI - exclusive access */
- UBYTE sb_AirRT; /* Realtime airbrush - 2.0 only */
- /*
- * If sb_NoAttach is non-zero, when opening a new screen under OS V39+,
- * you should NOT attempt to attach it to any of the ImageFX screens.
- * This is controlled by the NOATTACHEDSCREENS tool type.
- */
- UBYTE sb_NoAttach; /* Do not attach screens under 3.x */
- UBYTE sb_DrawStyle; /* Current drawing style */
-
- /*
- * sb_LearnOpts is read after executing a module; any text found here
- * is output to the macro recording file as options for the module.
- * This should not be used by Hook programs.
- *
- */
- char sb_LearnOpts[64];
- /* A rather kludgy way to get loader
- and saver options back to ImageFX
- while learning - modules should
- place a string here describing
- the options used, and ImageFX
- will grab the string and spit
- it out to the learn file. */
-
- /********************** Additions in 1.6 (EGS) ************************/
-
- /*
- * sb_BufList is a list of BufNode structures describing all the
- * buffers in memory. It should be considered READ ONLY.
- */
- struct MinList sb_BufList; /* Multiple buffer support */
-
- ULONG sb_NewFlags; /* 2.0 flags */
- char *sb_EnvDir; /* Name of IFX's ENV: dir */
-
- /*
- * Obviously, these are only used in the EGS version:
- */
- APTR sb_EWindow; /* EGS windows */
- APTR sb_MWindow; /* only valid in EGS version */
- APTR sb_PWindow;
-
- struct Library *EGSIntuiBase;
- struct Library *EGSGfxBase;
-
- APTR sb_EScreen; /* custom EGS screen or NULL */
-
- /********************** Additions in 2.0 ************************/
-
- /*
- * sb_BrushList is a list of BufNode structures describing all the
- * brushes in memory. It should be considered READ ONLY.
- */
- struct MinList sb_BrushList; /* Multiple brush support */
-
- /*
- * More internal settings. READ ONLY!
- */
- UBYTE sb_Include, /* Include range */
- sb_Exclude, /* Exclude range */
- sb_TClose, /* Transparency closeness */
- pad8;
-
- /*
- * sb_BarSigs may be set by the programmer. It is normally 0.
- */
- ULONG sb_BarSigs; /* Signals to wait on for
- manually processing the
- status bar signals (eg.
- the cancel button). If you
- get one of these signals,
- call HandleBar() and if
- it returns TRUE, the user
- has cancelled. */
-
- /*
- * sb_vWindow should be used instead of sb_vScreen. sb_vWindow could
- * be non-NULL when sb_vScreen is NULL (eg. Workbench preview). When
- * rendering to the preview window, always use sb_vWindow.
- */
- struct Window *sb_vWindow; /* Preview window, or NULL */
- /* USE THIS INSTEAD OF vScreen!!! */
-
- /*
- * DO NOT TOUCH
- */
- struct ModuleBase *sb_PreviewBase;
- struct ModuleBase *sb_ScannerBase;
- struct ModuleBase *sb_RenderBase;
- struct ModuleBase *sb_PrinterBase;
- struct ModuleBase *sb_QuantizeBase;
- struct ModuleBase *sb_DitherBase;
-
- struct RexxMsg *sb_GuiOnlyMsg; /* (FUTURE EXPANSION) */
-
- /*
- * A kludge to allow us to read and write colormapped images directly,
- * without having to load as 24-bit and then render them. This is
- * virtually guaranteed to change in the future, so it will remain
- * undocumented.
- */
- struct MappedImage *sb_RenderedImage;
-
- char *sb_PubScrName; /* (2.0) public name of screen on which
- menu is open (if WBMode, this
- is another screen, otherwise,
- it is the screen ImageFX is
- open on (eg. "IMAGEFX.1")). */
-
- ULONG reserved[6]; /* reserved for future expansion */
-
- /*
- * ScanBase size increased in ImageFX 2.0!
- */
- };
-
- /* values for sb_Channel: */
- #define CHAN_ALL (0xFF)
- #define CHAN_RED (0x01)
- #define CHAN_GRN (0x02)
- #define CHAN_BLU (0x04)
-
-
- /* values for sb_NewFlags: */
- #define SBF_DISABLED 0x0001 /* status bar operation should
- check LMB via. nasty hardware
- method, because we're currently
- disabled */
- #define SBF_BUTTONDOWN 0x0002 /* set when the LMB is currently
- down during a drawing operation.
- xdrawmodes & xdrawstyles can
- use this information. */
- #define SBF_NOHOOKLEARN 0x0004 /* set if a hook has already
- created a Learn statement
- for itself, which disables
- ImageFX's automatic creation
- of a Learn statement. */
- #define SBF_GRIDENABLED 0x0008 /* 2.0: drawing grid enabled? */
- #define SBF_BRUSHIO 0x0010 /* 2.0: imagefx sets this flag when
- the user requests a brush
- load or save, as opposed to
- an image load or save. Loaders
- and savers can use this information
- to do special handling for
- brushes */
-
- #define MIRAGE_MAGIC 'TEK!' /* Magic constant */
-
- /*
- * These defines have remained since the dawn of time. Don't ask me why.
- */
- #define pScreen ScanBase->pScreen
- #define pWindow ScanBase->pWindow
- #define pRPort ScanBase->pRPort
- #define Prefs ScanBase->Prefs
-
- #define SCAN_MOD_H
- #endif
-