CodeWarrior (OS 9)/FX.h

/*
    File:       FX.h
 
    Contains:   
 
    Written by: EL  
 
    Copyright:  Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
                08/2000     JM              Carbonized, non-Carbon code is commented out
                                            for demonstration purposes.
                7/13/1999   KG              Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
#include "CarbonPrefix.h"
#include <Types.h>
#include <Windows.h>
 
#define     numTItems       8
#define     numAItems       8
#define     numCItems       4
#define     numMItems       3
#define     numDItems       2
#define     numBItems       3
#define     numPItems       2
#define     numLItems       2
 
enum {
    transferID = 1,
    arithmeticID,
    ditherID,
    colorizationID,
    searchProcID,
    paintBucketID,
    lassoID,
    pixelAverageID,
    customID
};
 
typedef struct {
    Str255  label;
    Rect    rect;
} itemType;
 
typedef struct {
    int     tItem;
    int     aItem;
    int     cItem;
    int     mItem;
    int     dItem;
    int     bItem;
    int     pItem;
    int     lItem;
} itemSettings;
 
extern  WindowPtr       gWindow;
extern  GWorldPtr       gGWorld;
extern  int             gCurrentExample;
extern  itemSettings    settings;
 
extern  itemType    tItem[numTItems];
extern  itemType    aItem[numAItems];
extern  itemType    cItem[numCItems];
extern  itemType    dItem[numDItems];
extern  itemType    mItem[numMItems];
extern  itemType    bItem[numBItems];
extern  itemType    pItem[numPItems];
extern  itemType    lItem[numLItems];
 
void initMac();
void resetItems();
void createWindow();
void createOffscreen(int pictItem);
void defineItems();
void updateWindow();
void drawBackground();
void drawAllItems();
void drawSourceImage();
long drawFXImage();
 
void drawTransferItems();
void drawArithmeticItems();
void drawColorizeItems();
void drawDitherItems();
void drawMappingItems();
void drawDestinationItems();
void drawPaintBucketItems();
void drawLassoToolItems();
 
void drawExampleName();
void drawTime(long ticks);
 
void drawName(int left, int top, Str255 name );
void drawItem(int left, int top, Str255 *label, Boolean listEnabled, Boolean itemEnabled );
 
void drawDeepBox(Rect *rect);
void eraseRect(Rect *rect);
 
void eventLoop();
 
void setMenuItem( MenuHandle menu, int itemNum, Boolean enabled );
void adjustMenus();
//void setMenuItem();
void handleMenu(long mSelect);
 
void doAboutBox();
void drawMyString( int col, int *row, int increment, Str255 string);
void setUpMenus();
 
void transferExample(Rect *rect, int item);
void arithmeticExample(Rect *rect, int item);
void colorizationExample(Rect   * rect, int item);
void ditherExample(Rect * rect,int item);
void mappingExample(Rect * rect, int    item);
void paintBucketExample(Rect *rect, int exampleItem, Point point);
void lassoToolExample(Rect  * rect, int exampleItem,Rect *frame);
void pixelAverageExample(Rect   *rect, int   item);
void customExample(Rect * rect,int  item);
 
GrafPtr CreateGrafPort(Rect *bounds);
void    DisposeGrafPort(GrafPtr doomedPort);
int setTransferMode(int  item );
int setArithmeticMode(int item);
int setDitherMode(int item);
pascal Boolean matchProc(RGBColor *color, long      *position );
pascal Boolean searchProc(RGBColor  * color, long       *position);