//-------------------------------------------------------------------------------
//
//ÊÊÊ File:
//ÊÊÊÊÊÊÊ prah.c
//
#include "PIDefines.h"
#ifdef __PIMWCWMacPPC__
ÊÊÊ #include "prah-PPC.ch"
#elif defined(__PIMWCWMac68K__)
ÊÊÊ #include "prah-68k.ch"
ÊÊÊ // We're using Metrowerks and they have an A4 library, so set that up:
ÊÊÊ #include <SetupA4.h>
ÊÊÊ #include <A4Stuff.h>
ÊÊÊ
ÊÊÊ #define UseA4 // We've now defined this for quick checks later.
#else
ÊÊÊ #include "prah.h"
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// Peker til tabellen
//prcomplex *sincos_tab;
//-------------------------------------------------------------------------------
//ÊÊÊ Prototypes.
//-------------------------------------------------------------------------------
// Everything comes in and out of ENTRYPOINT. It must be first routine in source:
MACPASCAL void ENTRYPOINT (const short selector,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ FilterRecord *filterParamBlock,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ long *data,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ short *result);
void InitGlobals (Ptr globalPtr); ÊÊÊÊÊÊÊÊÊÊÊ // Initialize globals.
void ValidateParameters (GPtr globals);ÊÊÊÊÊÊÊ // Validates (inits) parameters.
void DoStart (GPtr globals); ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ // Main routine.
void DoParameters (GPtr globals);
void DoPrepare (GPtr globals);
void DoContinue (GPtr globals);
void DoFinish (GPtr globals);
void StartWithAdvanceState (GPtr globals);
void prah (GPtr globals, const Boolean doProgress);
void CalcProxyScaleFactor (Rect proxyScaleRect, Rect *proxyRect, short *scaleFactor);
boolean ParametersTest(GPtr globals);
void ZoomInRect (GPtr globals, Boolean mask);
void ZoomOutRect (GPtr globals, Boolean mask);
void StartNoAdvanceState (GPtr globals);
void DoInitialRect (GPtr globals);
Boolean DoNextRect (GPtr globals);
//void Ret(GPtr globals);
void BuildProxy (GPtr globals);
void scaleRect(Rect *l, short n, short d);
void shrinkRect(Rect *l, short x, short y);
void copyRect(Rect *l, const Rect *r);
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
//-------------------------------------------------------------------------------
//ÊÊÊ Globals -- Define global variables for plug-in scope.
//-------------------------------------------------------------------------------
// Windows global for plug-in (considered a Dynamically Linked Library).
// Leave NULL for Macintosh; many cross-platform library utilities require
// something passed in for hDllInstance:
Handle hDllInstance = NULL;
//-------------------------------------------------------------------------------
//ÊÊÊ ENTRYPOINT Export -- Export our entrypoint
//
//ÊÊÊ Have to export our info for PPCGlue stub which needs a descriptor built
//ÊÊÊ to be called from within a 68k code fragment.
//-------------------------------------------------------------------------------
#ifdef __PIMacPPC__ ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ // For "fat" PowerMac plug-ins
ÊÊÊ enum
ÊÊÊ {
ÊÊÊÊÊÊÊ uppEntryProcInfo = kPascalStackBased
ÊÊÊÊÊÊÊÊÊÊÊ | RESULT_SIZE(0)
ÊÊÊÊÊÊÊÊÊÊÊ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
ÊÊÊÊÊÊÊÊÊÊÊ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FilterRecord *)))
ÊÊÊÊÊÊÊÊÊÊÊ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *)))
ÊÊÊÊÊÊÊÊÊÊÊ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *)))
ÊÊÊ };
ÊÊÊ #if PRAGMA_EXPORT_SUPPORTED
ÊÊÊÊÊÊÊ #pragma export on
ÊÊÊ #endif
ÊÊÊ RoutineDescriptor main_PPC = BUILD_ROUTINE_DESCRIPTOR(uppEntryProcInfo, main);
ÊÊÊ #if PRAGMA_EXPORT_SUPPORTED
ÊÊÊÊÊÊÊ #pragma export reset
ÊÊÊ #endif
#endif
//-------------------------------------------------------------------------------
//
//ÊÊÊ ENTRYPOINT / main
//
//ÊÊÊ All calls to the plug-in module come through this routine.
//ÊÊÊ It must be placed first in the resource. To achieve this,
//ÊÊÊ most development systems require this be the first routine
//ÊÊÊ in the source.
//
//ÊÊÊ The entrypoint will be "pascal void" for Macintosh,
//ÊÊÊ "void" for Windows.
//
//ÊÊÊ Inputs:
//ÊÊÊÊÊÊÊ const short selector ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ Host provides selector indicating
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ what command to do.
//
//ÊÊÊÊÊÊÊ FilterRecord *filterParamBlock ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ Host provides pointer to parameter
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ block containing pertinent data
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ and callbacks from the host.
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ See PIFilter.h.
//
//ÊÊÊ Outputs:
//ÊÊÊÊÊÊÊ FilterRecord *filterParamBlock ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ Host provides pointer to parameter
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ block containing pertinent data
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ and callbacks from the host.
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ See PIFilter.h.
//
//ÊÊÊÊÊÊÊ long *data ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ Use this to store a handle to our
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ global parameters structure, which
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ is maintained by the host between
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ calls to the plug-in.
//
//ÊÊÊÊÊÊÊ short *result ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ Return error result or noErr. Some
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ errors are handled by the host, some
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ are silent, and some you must handle.
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ See PIGeneral.h.
//
//-------------------------------------------------------------------------------
MACPASCAL void ENTRYPOINT (const short selector,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ FilterRecord *filterParamBlock,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ long *data,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ short *result)
{
ÊÊÊ //---------------------------------------------------------------------------
ÊÊÊ //ÊÊÊ (1) Enter code resource if Mac 68k.
ÊÊÊ //---------------------------------------------------------------------------
ÊÊÊ
ÊÊÊ #ifdef UseA4 ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ // Are we in 68k Mac MW?
ÊÊÊÊÊÊÊ EnterCodeResource();ÊÊÊÊ // A4-globals
ÊÊÊ #endif
ÊÊÊ
ÊÊÊ //---------------------------------------------------------------------------
ÊÊÊ //ÊÊÊ (2) Check for about box request.
ÊÊÊ //
ÊÊÊ //ÊÊÊÊ The about box is a special request; the parameter block is not filled
ÊÊÊ //ÊÊÊÊ out, none of the callbacks or standard data is available. Instead,
ÊÊÊ //ÊÊÊÊ the parameter block points to an AboutRecord, which is used
ÊÊÊ //ÊÊÊÊ on Windows.
ÊÊÊ //---------------------------------------------------------------------------
ÊÊÊ if (selector == filterSelectorAbout)
ÊÊÊ {
ÊÊÊÊÊÊÊ DoAbout((AboutRecordPtr)filterParamBlock);
ÊÊÊ }
ÊÊÊ else
ÊÊÊ { // do the rest of the process as normal:
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ //ÊÊÊ (3) Initialize function and global pointers.
ÊÊÊÊÊÊÊ //
ÊÊÊÊÊÊÊ //ÊÊÊÊ Initialize function pointer routine dispatcher. We use this to jump
ÊÊÊÊÊÊÊ //ÊÊÊÊ to the different routines, instead of a long obnoxious switch
ÊÊÊÊÊÊÊ //ÊÊÊÊ statement. All routines are expected to have the same prototype
ÊÊÊÊÊÊÊ //ÊÊÊÊ of "void RoutineName (globals)". Returns any errors in gResult.
ÊÊÊÊÊÊÊ //
ÊÊÊÊÊÊÊ //ÊÊÊÊ WARNING: These better be in the order of the selector AND there
ÊÊÊÊÊÊÊ //ÊÊÊÊ better be a routine for every selector call.
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ static const FProc routineForSelector [] =
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ /* filterSelectorAbout ÊÊÊÊÊÊÊÊÊÊÊÊ DoAbout, */
ÊÊÊÊÊÊÊÊÊÊÊ /* filterSelectorParameters */ÊÊÊ DoParameters,
ÊÊÊÊÊÊÊÊÊÊÊ /* filterSelectorPrepare */ÊÊÊÊÊÊÊ DoPrepare,
ÊÊÊÊÊÊÊÊÊÊÊ /* filterSelectorStart */ÊÊÊÊÊÊÊ DoStart,
ÊÊÊÊÊÊÊÊÊÊÊ /* filterSelectorContinue */ÊÊÊ DoContinue,
ÊÊÊÊÊÊÊÊÊÊÊ /* filterSelectorFinish */ÊÊÊÊÊÊÊ DoFinish
ÊÊÊÊÊÊÊ };
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ Ptr globalPtr = NULL; ÊÊÊÊÊÊÊ // Pointer for global structure
ÊÊÊÊÊÊÊ GPtr globals = NULL; ÊÊÊÊÊÊÊÊ // actual globals
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ //ÊÊÊ (4) Allocate and initalize globals.
ÊÊÊÊÊÊÊ //
ÊÊÊÊÊÊÊ //ÊÊÊÊ AllocateGlobals requires the pointer to result, the pointer to the
ÊÊÊÊÊÊÊ //ÊÊÊÊ parameter block, a pointer to the handle procs, the size of our local
ÊÊÊÊÊÊÊ //ÊÊÊÊ "Globals" structure, a pointer to the long *data, a Function
ÊÊÊÊÊÊÊ //ÊÊÊÊ Proc (FProc) to the InitGlobals routine. It automatically sets-up,
ÊÊÊÊÊÊÊ //ÊÊÊÊ initializes the globals (if necessary), results result to 0, and
ÊÊÊÊÊÊÊ //ÊÊÊÊ returns with a valid pointer to the locked globals handle or NULL.
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ globalPtr = AllocateGlobals ((uint32)result,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ (uint32)filterParamBlock,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ filterParamBlock->handleProcs,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ sizeof(Globals),
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ data,
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ InitGlobals);
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ if (globalPtr == NULL)
ÊÊÊÊÊÊÊ { // Something bad happened if we couldn't allocate our pointer.
ÊÊÊÊÊÊÊ // Fortunately, everything's already been cleaned up,
ÊÊÊÊÊÊÊ // so all we have to do is report an error.
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ *result = memFullErr;
ÊÊÊÊÊÊÊ return;
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ // Get our "globals" variable assigned as a Global Pointer struct with the
ÊÊÊÊÊÊÊ // data we've returned:
ÊÊÊÊÊÊÊ globals = (GPtr)globalPtr;
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ //ÊÊÊ (5) Dispatch selector.
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ if (selector > filterSelectorAbout && selector <= filterSelectorFinish)
ÊÊÊÊÊÊÊÊÊÊÊ (routineForSelector[selector-1])(globals); // dispatch using jump table
ÊÊÊÊÊÊÊ else
ÊÊÊÊÊÊÊÊÊÊÊ gResult = filterBadParameters;
ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ //-----------------------------------------------------------------------
ÊÊÊÊÊÊÊ //ÊÊÊ (6) Unlock data, and exit resource.
ÊÊÊÊÊÊÊ //
ÊÊÊÊÊÊÊ //ÊÊÊ Result is automatically returned in *result, which is
ÊÊÊÊÊÊÊ //ÊÊÊ pointed to by gResult.
ÊÊÊÊÊÊÊ //----------------------------------------------------------------------- ÊÊÊ
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ // unlock handle pointing to parameter block and data so it can move
ÊÊÊÊÊÊÊ // if memory gets shuffled:
ÊÊÊÊÊÊÊ if ((Handle)*data != NULL)
ÊÊÊÊÊÊÊÊÊÊÊ PIUnlockHandle((Handle)*data);
ÊÊÊ
ÊÊÊ } // about selector specialÊÊÊÊÊÊÊ
ÊÊÊ
ÊÊÊ #ifdef UseA4 ÊÊÊÊÊÊÊÊÊÊÊ // Are we in 68k Mac MW?
ÊÊÊÊÊÊÊ ExitCodeResource(); // A4-globals
ÊÊÊ #endif
ÊÊÊ
} // end ENTRYPOINT
//-------------------------------------------------------------------------------
//
//ÊÊÊ InitGlobals
//ÊÊÊ
//ÊÊÊ Initalize any global values here. Called only once when global
//ÊÊÊ space is reserved for the first time.
//
//ÊÊÊ Inputs:
//ÊÊÊÊÊÊÊ Ptr globalPtr ÊÊÊÊÊÊÊ Standard pointer to a global structure.
//
//ÊÊÊ Outputs:
//ÊÊÊÊÊÊÊ Initializes any global values with their defaults.
//
//-------------------------------------------------------------------------------
void InitGlobals (Ptr globalPtr)
{ÊÊÊ
ÊÊÊ // create "globals" as a our struct global pointer so that any
ÊÊÊ // macros work:
ÊÊÊ GPtr globals = (GPtr)globalPtr;
ÊÊÊ
ÊÊÊ // Initialize global variables:
ÊÊÊ ValidateParameters (globals);
ÊÊÊ
} // end InitGlobals
//-------------------------------------------------------------------------------
//
//ÊÊÊ ValidateParameters
//
//ÊÊÊ Initialize parameters to default values.
//
//ÊÊÊ Inputs:
//ÊÊÊÊÊÊÊ GPtr globals ÊÊÊÊÊÊÊ Pointer to global structure.
//
//-------------------------------------------------------------------------------
void ValidateParameters (GPtr globals)
{
ÊÊÊ if (gStuff->parameters == NULL)
ÊÊÊ { // We haven't created these yet.
ÊÊÊÊÊÊÊ gStuff->parameters = PINewHandle ((long) sizeof (TParameters));
ÊÊÊÊÊÊÊ if (gStuff->parameters != NULL)
ÊÊÊÊÊÊÊ { // Got it. Fill out the fields. ÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ gKanal1=128;
ÊÊÊÊÊÊÊÊÊÊÊ gKanal2=128;
ÊÊÊÊÊÊÊÊÊÊÊ gKanal3=128;
ÊÊÊÊÊÊÊÊÊÊÊ gKanal4=128; ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ gUseAdvance = false;
ÊÊÊÊÊÊÊÊÊÊÊ gZoomFactor=6; ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ gHostIsPremiereWin = IsWindows(HostIsPremiere());
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ else
ÊÊÊÊÊÊÊ { // Oops. Couldn't allocate memory.
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ gResult = memFullErr;
ÊÊÊÊÊÊÊÊÊÊÊ return;
ÊÊÊÊÊÊÊ }
ÊÊÊ } // parameters
ÊÊÊ
} // end ValidateParameters
/*****************************************************************************/
/* Inicializace vstupnch parametr? filtru - neprob?hne p?i voln "Posledn Filtr"*/
void DoParameters (GPtr globals)
{ÊÊÊ
ÊÊÊ ValidateParameters (globals);
ÊÊÊ if (gStuff->parameters != NULL)
ÊÊÊ {
ÊÊÊ }
ÊÊÊ gQueryForParameters = TRUE;
}
/*****************************************************************************/
/* V?po?et pot?ebn pam?ti pro funkci filtru */
void DoPrepare (GPtr globals)
{
ÊÊÊ shortÊÊÊÊ rowWidth = 0;
ÊÊÊ shortÊÊÊÊ total = 0;
ÊÊÊ longÊÊÊ oneRow = 0;
ÊÊÊ longÊÊÊ inOutRow = 0;
ÊÊÊ longÊÊÊ inOutAndMask = 0;
ÊÊÊ
ÊÊÊ gStuff->bufferSpace = 0;ÊÊÊ
ÊÊÊ ValidateParameters (globals);
ÊÊÊ total = gStuff->imageSize.v;
ÊÊÊ rowWidth = gStuff->imageSize.h;ÊÊÊ
ÊÊÊ oneRow = rowWidth * (gStuff->planes);
ÊÊÊ inOutRow = oneRow * 2;
ÊÊÊ inOutAndMask = inOutRow + rowWidth;
ÊÊÊ while (((inOutAndMask * gRowSkip) < (gStuff->maxSpace-gStuff->bufferSpace)) && (gRowSkip < total)) gRowSkip++;
ÊÊÊ gStuff->maxSpace = gRowSkip * inOutAndMask + gStuff->bufferSpace;
ÊÊÊ
}
/*****************************************************************************/
/* Zobrazen UI a za?tek filtrace */
void DoStart (GPtr globals)
{ÊÊÊ
ÊÊÊ RectÊÊÊ imageRect;
ÊÊÊÊÊÊÊ return;
ÊÊÊ ValidateParameters (globals); // Pokud nejsou inicializovny parametry filtru, tak je inicializuje
ÊÊÊ // lze pou?t Advance ?
ÊÊÊ gUseAdvance = AdvanceStateAvailable () &&
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ DisplayPixelsAvailable () &&
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ !gHostIsPremiereWin;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ // Adobe Premiere for Windows doesn't do AdvanceState right
ÊÊÊ ReadScriptParams (globals); ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ // P?e?te p?edchoz nastaven filtru
ÊÊÊ if (gQueryForParameters)
ÊÊÊ {
ÊÊÊÊÊÊÊ DoUI (globals); ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ // Zobraz UI
ÊÊÊÊÊÊÊ gQueryForParameters = FALSE;
ÊÊÊ }
ÊÊÊ else
ÊÊÊ {
ÊÊÊÊÊÊÊ imageRect.top = 0;//pokud je filtr vyvoln bez UI - inicializace rozmeru I/O oblast
ÊÊÊÊÊÊÊ imageRect.left = 0;
ÊÊÊÊÊÊÊ imageRect.bottom = gStuff->imageSize.v;
ÊÊÊÊÊÊÊ imageRect.right = gStuff->imageSize.h;
ÊÊÊÊÊÊÊ copyRect(&gStuff->filterRect, &imageRect);
ÊÊÊÊÊÊÊ copyRect(&gStuff->inRect, &imageRect);ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ gStuff->inLoPlane = gStuff->outLoPlane = 0;
ÊÊÊÊÊÊÊ gStuff->inHiPlane = gStuff->outHiPlane = gStuff->planes - 1;
ÊÊÊÊÊÊÊ copyRect(&gStuff->maskRect, &gStuff->filterRect);
ÊÊÊÊÊÊÊ gStuff->inputRate = long2fixed(1L);
ÊÊÊÊÊÊÊ gStuff->maskRate = gStuff->inputRate;
ÊÊÊÊÊÊÊ gStuff->inputPadding = plugInWantsEdgeReplication;
ÊÊÊÊÊÊÊ gStuff->outputPadding = gStuff->inputPadding;
ÊÊÊÊÊÊÊ gStuff->maskPadding = gStuff->inputPadding;
ÊÊÊ
ÊÊÊÊÊÊÊ gResult = AdvanceState ();
ÊÊÊÊÊÊÊ DoZoomRect (globals,false);
//ÊÊÊÊÊÊÊ Ret(globals);
ÊÊÊÊÊÊÊ
ÊÊÊ }
ÊÊÊ if (gResult != noErr) return;
ÊÊÊ
ÊÊÊ if (gUseAdvance) StartWithAdvanceState(globals);
}
ÊÊÊ
/*****************************************************************************/
/* Pokra?ovn filtrace - pokud se filtruje po ?stech - not Advance */
void DoContinue (GPtr globals)
{
ÊÊÊ if (TestAbort () || gResult != noErr)
ÊÊÊ {
ÊÊÊÊÊÊÊ gResult = userCanceledErr;
ÊÊÊÊÊÊÊ return;
ÊÊÊ }
ÊÊÊ if (!gUseAdvance)
ÊÊÊ {
ÊÊÊÊÊÊÊ Prah(globals,true);
ÊÊÊÊÊÊÊ if (!DoNextRect (globals))
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ PISetRect (&gStuff->inRect, 0, 0, 0, 0);
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ PISetRect (&gStuff->outRect, 0, 0, 0, 0);
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ PISetRect (&gStuff->maskRect, 0, 0, 0, 0);
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊ }
ÊÊÊ else
ÊÊÊ {
ÊÊÊÊÊÊÊ PISetRect (&gStuff->inRect, 0, 0, 0, 0);
ÊÊÊÊÊÊÊ PISetRect (&gStuff->outRect, 0, 0, 0, 0);
ÊÊÊÊÊÊÊ PISetRect (&gStuff->maskRect, 0, 0, 0, 0);
ÊÊÊ }
}
/*****************************************************************************/
/* òklid po filtru a zpis nastaven parametr? filtru */
void DoFinish (GPtr globals)
{
ÊÊÊ WriteScriptParams (globals);
}
/*****************************************************************************/
/* Filtrace celeho obrazu najednou */
void StartWithAdvanceState (GPtr globals)
{
ÊÊÊ int16 row;
ÊÊÊ int32 total;
ÊÊÊ total = gStuff->filterRect.bottom - gStuff->filterRect.top;
ÊÊÊ gStuff->inLoPlane = gStuff->outLoPlane = 0;
ÊÊÊ gStuff->inHiPlane = gStuff->outHiPlane = gStuff->planes - 1;
ÊÊÊ
ÊÊÊ /* Pokud chceme pou?t kanly*/
ÊÊÊ #if useAlpha
ÊÊÊ if (!gStuff->isFloating)
ÊÊÊ {
ÊÊÊÊÊÊÊ gStuff->wantsAbsolute = true;
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ if (gStuff->inLayerPlanes !=0 && gStuff->inTransparencyMask != 0)
ÊÊÊÊÊÊÊÊÊÊÊ gStuff->inHiPlane = gStuff->absLayerPlanes - 1 +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absTransparencyMask +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absInvertedLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absNonLayerPlanes;
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ if (gStuff->outLayerPlanes !=0 && gStuff->outTransparencyMask !=0)
ÊÊÊÊÊÊÊÊÊÊÊ gStuff->outHiPlane = gStuff->outLayerPlanes - 1 +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outTransparencyMask +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outInvertedLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outNonLayerPlanes;
ÊÊÊ }
ÊÊÊ #endif
ÊÊÊ gStuff->inRect.left = gStuff->outRect.left = gStuff->maskRect.left = gStuff->filterRect.left = 0;
ÊÊÊ gStuff->inRect.right = gStuff->outRect.right = gStuff->maskRect.right = gStuff->filterRect.right = gStuff->imageSize.h;
ÊÊÊ gStuff->inputRate = long2fixed (1L);
ÊÊÊ gStuff->maskRate = long2fixed (1L);
ÊÊÊ for (row = 0; row < gStuff->imageSize.v; row += gRowSkip)
ÊÊÊ {
ÊÊÊÊÊÊÊ if (TestAbort () || gResult != noErr)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ gResult = userCanceledErr;
ÊÊÊÊÊÊÊÊÊÊÊ goto done;
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ gStuff->inRect.top = gStuff->outRect.top = gStuff->maskRect.top = gStuff->filterRect.top=row;
ÊÊÊÊÊÊÊ gStuff->inRect.bottom = gStuff->outRect.bottom = gStuff->maskRect.bottom = gStuff->filterRect.bottom=row + gRowSkip;
ÊÊÊÊÊÊÊ gResult = AdvanceState ();ÊÊÊ
ÊÊÊÊÊÊÊ if (gResult != noErr)
ÊÊÊÊÊÊÊÊÊÊÊ goto done; ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ Prah (globals, true);
ÊÊÊÊÊÊÊ }
done:
ÊÊÊ PISetRect (&gStuff->inRect, 0, 0, 0, 0);
ÊÊÊ PISetRect (&gStuff->outRect, 0, 0, 0, 0);
ÊÊÊ PISetRect (&gStuff->maskRect, 0, 0, 0, 0);
}
/******************************************************/
/* proveden filtrace ÊÊÊÊÊÊÊÊÊÊÊ */
void Prah(GPtr globals, Boolean doProgress )
{
ÊÊÊ short i, j;
ÊÊÊ int plane;
ÊÊÊ int prah[4];
ÊÊÊ const short total = gStuff->filterRect.bottom - gStuff->filterRect.top;ÊÊÊ //celkov? pocet v?stupnho ?dk?
ÊÊÊ const short outColumns= gStuff->outRect.right - gStuff->outRect.left; //pocet sloupc? v?stupnho obrzku
ÊÊÊ const short outRows = gStuff->outRect.bottom - gStuff->outRect.top;ÊÊÊ // pocet ?dk? v?stupnho obrzku
ÊÊÊ const short outPlanes = gStuff->outHiPlane - gStuff->outLoPlane + 1; //pocet kanl? v?stupnho obrzku
ÊÊÊ const short inColumns = gStuff->imageSize.h; ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ //pocet sloupc? vstupniho obrzku
ÊÊÊ const short inRows = gStuff->imageSize.v; ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ //pocet ?dk? vstupniho obrzku
ÊÊÊ const short inPlanes = gStuff->inHiPlane - gStuff->inLoPlane + 1; ÊÊÊÊÊÊÊ //pocet kanl? vstupniho obrzku
ÊÊÊ
unsigned8 *srcPtr = (unsigned8 *) gStuff->inData;ÊÊÊ //ukazatel na vstupn obrzek
ÊÊÊ unsigned8 *dstPtr = (unsigned8 *) gStuff->outData; ÊÊÊ //ukazatel na v?stupn obrzek
ÊÊÊ unsigned8 *mskPtr = (unsigned8 *) gStuff->maskData; ÊÊÊ //ukazatel na masku vstupnho obrzku
ÊÊÊ Boolean maskPixel = false;
ÊÊÊ
ÊÊ prah[0]=gKanal1;//nastaven jednotliv?ch prah?
ÊÊÊ prah[1]=gKanal2;
ÊÊÊ prah[2]=gKanal3;
ÊÊÊ prah[3]=gKanal4;
ÊÊÊ for (i=0; i < inRows; i++)
ÊÊÊ {
ÊÊÊÊÊÊÊ srcPtr = (unsigned8 *) gStuff->inData + (i * inColumns * inPlanes);//nastav na prvn pixel v ?dku i
ÊÊÊÊÊÊÊ dstPtr = (unsigned8 *) gStuff->outData + (i * inColumns * inPlanes);//nastav na prvn pixel v ?dku i
ÊÊÊÊÊÊÊ mskPtr = (unsigned8 *) gStuff->maskData + (i * inColumns);ÊÊÊ //nastav na prvn pixel v ?dkuÊÊÊ i
ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ if (doProgress) UpdateProgress ((long) (gStuff->outRect.top + i) - gStuff->filterRect.top,(long) total);
ÊÊÊÊÊÊÊ for(j=0;j<inColumns;j++)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ maskPixel = (!mskPtr [0]); //na?ten masky
ÊÊÊÊÊÊÊÊÊÊÊ if (!maskPixel) ÊÊÊ //pokud nen maska uprav
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ for (plane = 0; plane < inPlanes; plane++)
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ if(srcPtr[plane]>prah[plane]) srcPtr[plane]=255;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ else srcPtr[plane]=0;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊÊÊÊÊ else //pokud je tak neupravuj
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ for (plane = 0; plane < inPlanes; plane++) dstPtr [plane] = srcPtr [plane]; ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ } ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ srcPtr += inPlanes;//nastav na dal? pixel v ?dku i
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr += inPlanes;//nastav na dal? pixel v ?dku i
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr++; //nastav na dal? pixel v ?dku i
ÊÊÊÊÊÊÊ } ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊ }
}
/*****************************************************************************/
/* V?po?et a pravy rozm?r? obrzku pro pot?eby UI */
void CalcGlobalProxies (GPtr globals)
{
ÊÊÊ RectÊÊÊ imageRect,imageRect1;
ÊÊÊ int16ÊÊÊ selCenterH, selCenterV;
ÊÊÊ int16ÊÊÊ selLength, selWidth;
ÊÊÊ int16ÊÊÊ length, width;
ÊÊÊ int16ÊÊÊ length2, width2;
ÊÊÊ length = (gOrigProxyRect.bottom - gOrigProxyRect.top); // zobrazovan v??ka
ÊÊÊ length2 = length / 2;
ÊÊÊ width = (gOrigProxyRect.right - gOrigProxyRect.left); // zobrazovan ??ka
ÊÊÊ width2 = width / 2;
ÊÊÊ selLength = gStuff->imageSize.v; // Vybran v??ka
ÊÊÊ selWidth = gStuff->imageSize.h; // Vybran ??ka
ÊÊÊ //Vycentrovn preview
ÊÊÊ selCenterV = (selLength / 2);
ÊÊÊ selCenterH = (selWidth / 2);
ÊÊÊ imageRect.top = selCenterV - (length2);
ÊÊÊ imageRect.left = selCenterH - (width2);
ÊÊÊ imageRect.bottom = imageRect.top+length;
ÊÊÊ imageRect.right = imageRect.left+width;
ÊÊÊ imageRect1.top = 0;
ÊÊÊ imageRect1.left = 0;
ÊÊÊ imageRect1.bottom = gStuff->imageSize.v;
ÊÊÊ imageRect1.right = gStuff->imageSize.h;
copyRect(&gProxyScaleRect, &imageRect);
ÊÊÊ copyRect(&gStuff->inRect, &imageRect1);
ÊÊÊ copyRect(&gStuff->outRect, &imageRect);
}
void SetupFilterRecordForProxy (GPtr globals, Rect proxyScaleRect, short scaleFactor)
{
ÊÊÊ #ifdef __PIMWCW__
ÊÊÊÊÊÊÊ #pragma unused (proxyScaleRect)
ÊÊÊÊÊÊÊ #pragma unused (scaleFactor)
ÊÊÊ #endif
ÊÊÊ gStuff->inLoPlane = gStuff->outLoPlane = 0;
ÊÊÊ gStuff->inHiPlane = gStuff->outHiPlane = gStuff->planes - 1;
ÊÊÊ copyRect(&gStuff->maskRect, &gStuff->filterRect);
ÊÊÊ gStuff->inputRate = long2fixed(1L);
ÊÊÊ gStuff->maskRate = gStuff->inputRate;
ÊÊÊ gStuff->inputPadding = plugInWantsEdgeReplication;
ÊÊÊ gStuff->outputPadding = gStuff->inputPadding;
ÊÊÊ gStuff->maskPadding = gStuff->inputPadding;
ÊÊÊ gResult = AdvanceState ();
}
ÊÊÊ
void CalcProxyScaleFactor (Rect proxyScaleRect, Rect *proxyRect, short *scaleFactor)
{
ÊÊÊ short filterHeight;
ÊÊÊ short filterWidth;
ÊÊÊ short itemHeight;
ÊÊÊ short itemWidth;
ÊÊÊ Point fraction;
ÊÊÊ shrinkRect (proxyRect, kGutter, kGutter); ÊÊÊÊÊÊÊÊ // for the border
ÊÊÊ filterHeight = (proxyScaleRect.bottom - proxyScaleRect.top);
ÊÊÊ filterWidth = (proxyScaleRect.right - proxyScaleRect.left);
ÊÊÊ itemHeight = (proxyRect->bottom - proxyRect->top);
ÊÊÊ itemWidth = (proxyRect->right - proxyRect->left);
ÊÊÊ if (itemHeight > filterHeight) itemHeight = filterHeight;
ÊÊÊ if (itemWidth > filterWidth) itemWidth = filterWidth;
ÊÊÊ fraction.h = ((filterWidth + itemWidth) / itemWidth)-1;
ÊÊÊ fraction.v = ((filterHeight + itemHeight) / itemHeight)-1;
ÊÊÊ if (fraction.h > fraction.v) *scaleFactor = fraction.h;
ÊÊÊ else *scaleFactor = fraction.v;
ÊÊÊ copyRect (proxyRect, &proxyScaleRect);ÊÊÊ
ÊÊÊ scaleRect (proxyRect, 1, *scaleFactor);
}
/****************************************************************************/
/* Hlavn rutina Zoomovn preview */
void DoZoomRect (GPtr globals,Boolean mask)
{ÊÊÊ
ÊÊÊ if (gResult == userCanceledErr) return;
ÊÊÊÊÊÊÊ
ÊÊÊ if (gRepFactor <= 1 && gRepFactor > 0)
ÊÊÊÊÊÊÊ ZoomOutRect (globals, mask);
ÊÊÊ else if (gRepFactor > 1)
ÊÊÊÊÊÊÊ ZoomInRect (globals, mask); ÊÊÊÊÊÊÊ
}
/*****************************************************************************/
/* Zoom in. Zv?t?en gRepFactor >= 1 */
/*****************************************************************************/
void ZoomInRect (GPtr globals, Boolean mask)
{
ÊÊÊ short offsetOutColumns, offsetOutRows;
ÊÊÊ short centerInColumns, centerInRows;
ÊÊÊ short offsetInColumns, offsetInRows;
ÊÊÊ short difColumns, difRows;ÊÊÊ
ÊÊÊ short proxyCenterCol, proxyCenterRow;
ÊÊÊ short proxyOffsetCol, proxyOffsetRow;
ÊÊÊ int srcX,srcY ;
ÊÊÊ int i,j,ii,jj,max,polo,plane;
ÊÊÊ unsigned8 *dstPtr;
ÊÊÊ unsigned8 *mskPtr;
ÊÊÊ unsigned8 *mskPtr2;
ÊÊÊ const short outColumns= gStuff->outRect.right - gStuff->outRect.left;
ÊÊÊ const short outRows = gStuff->outRect.bottom - gStuff->outRect.top;ÊÊÊ
ÊÊÊ const short outPlanes = gStuff->outHiPlane - gStuff->outLoPlane + 1;
ÊÊÊ const short inColumns = gStuff->imageSize.h;
ÊÊÊ const short inRows = gStuff->imageSize.v;
ÊÊÊ const short inPlanes =gStuff->outHiPlane - gStuff->outLoPlane + 1;
ÊÊÊ double pomoc;ÊÊÊ
ÊÊÊ Boolean maskPixel = false;
ÊÊÊ
ÊÊÊ offsetOutColumns = outColumns / 2;
ÊÊÊ offsetOutRows = outRows / 2;
ÊÊÊ centerInColumns = inColumns / 2;
ÊÊÊ centerInRows = inRows / 2;
ÊÊÊ offsetInColumns = (short)(inColumns * gRepFactor / 2);
ÊÊÊ offsetInRows = (short)(inRows * gRepFactor / 2);
ÊÊÊ difColumnsÊÊÊÊÊÊÊ = offsetInColumns - offsetOutColumns;
ÊÊÊ difRows = offsetInRows - offsetOutRows;
difColumns /= (short)gRepFactor;
ÊÊÊ difRows /=(short)gRepFactor;
ÊÊÊ gPozice.x=gSPozice.x+(short)gDif.x;
ÊÊÊ if (gPozice.x> difColumns) gPozice.x=difColumns;
ÊÊÊ if (gPozice.x<-difColumns) gPozice.x=-difColumns;
ÊÊÊ gPozice.y=gSPozice.y+(short)gDif.y;
ÊÊÊ if (gPozice.y> difRows) gPozice.y=difRows;
ÊÊÊ if (gPozice.y<-difRows) gPozice.y=-difRows;
ÊÊÊ proxyCenterCol = gOrigProxyRect.left + ((gOrigProxyRect.right - gOrigProxyRect.left) / 4);
ÊÊÊ proxyCenterRow = gOrigProxyRect.top + ((gOrigProxyRect.bottom - gOrigProxyRect.top) / 4);
ÊÊÊ proxyOffsetCol = outColumns / 2;
ÊÊÊ proxyOffsetRow = outRows / 2;
ÊÊÊ
ÊÊÊ max
=(int)sqrt((inRows
/2)*(inRows
/2)+(inColumns
/2)*(inColumns
/2));
ÊÊÊ for (i = 0; i < outRows; i ++)
ÊÊÊ {
ÊÊÊÊÊÊÊ i--;
ÊÊÊÊÊÊÊ for(ii = 1;ii<=gRepFactor;ii++)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ i++;
ÊÊÊÊÊÊÊÊÊÊÊ if(i==outRows) break;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2= (unsigned8 *)gSHOWmask + (i * outColumns);
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr = (unsigned8 *)gStuff->outData + (i * outColumns * outPlanes); ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr = (unsigned8 *)gFFTmask + (- gPozice.x + difColumns + (((int)(i/gRepFactor) + difRows - gPozice.y ) * inColumns));
ÊÊÊÊÊÊÊÊÊÊÊ srcX= - gPozice.x + difColumns + (((int)(i/gRepFactor) + difRows - gPozice.y ) * inColumns);
ÊÊÊÊÊÊÊÊÊÊÊ srcY=srcX-((short)(srcX/inColumns))*inColumns; ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ for (j = 0; j < outColumns; j ++)
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ j--;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ for (jj = 1;jj<=gRepFactor;jj++)
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ if (gIMaska) mskPtr2[0] = 255-mskPtr[0];
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ else mskPtr2[0]=255;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ if(!mask)
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ if (mskPtr[0]) for(plane=0;plane<inPlanes;plane++) dstPtr[plane]=((gInten*gFFTdata[((srcX/inColumns)*inColumns+srcY)*inPlanes+plane]/100)+(100-gInten)*gFFTdata2[((srcX/inColumns)*inColumns+srcY)*inPlanes+plane]/100); ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ else ÊÊÊÊÊÊÊ for(plane=0;plane<inPlanes;plane++) dstPtr[plane]=gFFTdata[((srcX/inColumns)*inColumns+srcY)*inPlanes+plane];
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr2++;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ dstPtr +=outPlanes;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ j++;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ if (j==outColumns) break;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ srcY ++;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr++;
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ }
ÊÊÊ }
ÊÊÊ
ÊÊÊ gProxyRect.left = proxyCenterCol - proxyOffsetCol > gOrigProxyRect.left
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterCol - proxyOffsetCol : gOrigProxyRect.left;
ÊÊÊ gProxyRect.right = proxyCenterCol + proxyOffsetCol < gOrigProxyRect.right
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterCol + proxyOffsetCol : gOrigProxyRect.right;
ÊÊÊ gProxyRect.top = proxyCenterRow - proxyOffsetRow > gOrigProxyRect.top
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterRow - proxyOffsetRow : gOrigProxyRect.top;
ÊÊÊ gProxyRect.bottom = proxyCenterRow + proxyOffsetRow < gOrigProxyRect.bottom
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterRow + proxyOffsetRow : gOrigProxyRect.bottom;
}
ÊÊÊ
/*****************************************************************************/
/* Zoom Out. Zmen?en gRepFactor between 0...1. */
void ZoomOutRect (GPtr globals,ÊÊÊ Boolean mask)
{
ÊÊÊ const unsigned8 kUIBackcolor = 191;
ÊÊÊ short offsetOutColumns, offsetOutRows;
ÊÊÊ short startOutColumns, startOutRows, endOutColumns, endOutRows;
ÊÊÊ const short outColumns= gStuff->outRect.right - gStuff->outRect.left;
ÊÊÊ const short outRows = gStuff->outRect.bottom - gStuff->outRect.top;ÊÊÊ
ÊÊÊ const short outPlanes = gStuff->outHiPlane - gStuff->outLoPlane + 1;
ÊÊÊ const short inColumns = gStuff->imageSize.h;
ÊÊÊ const short inRows = gStuff->imageSize.v;
ÊÊÊ const short inPlanes = gStuff->inHiPlane - gStuff->inLoPlane + 1;
ÊÊÊ short centerInColumns, centerInRows;
ÊÊÊ short offsetInColumns, offsetInRows;
ÊÊÊ short difColumns, difRows;
short offset = 0;
ÊÊÊ short proxyCenterCol, proxyCenterRow;
ÊÊÊ short proxyOffsetCol, proxyOffsetRow;
ÊÊÊ float HFactor = 0;
float VFactor = 0;
ÊÊÊ double pomoc;
ÊÊÊ unsigned8 *dstPtr;
ÊÊÊ unsigned8 *mskPtr;
ÊÊÊ unsigned8 *mskPtr2;
ÊÊÊ int i,j,srcX,srcY,max,polo,plane;
ÊÊÊ Boolean maskPixel = false;
ÊÊÊ
ÊÊÊ offsetOutColumns = outColumns / 2;
ÊÊÊ offsetOutRows = outRows / 2;
ÊÊÊ startOutColumns = 0;
ÊÊÊ startOutRows = 0;
ÊÊÊ endOutColumns = outColumns-1;
ÊÊÊ endOutRows = outRows-1;
ÊÊÊ centerInColumns = inColumns / 2;
ÊÊÊ centerInRows = inRows / 2;
ÊÊÊ offsetInColumns = (short)(inColumns * gRepFactor / 2);
ÊÊÊ offsetInRows = (short)(inRows * gRepFactor / 2);
ÊÊÊ difColumnsÊÊÊÊÊÊÊ = offsetInColumns - offsetOutColumns;
ÊÊÊ difRows = offsetInRows - offsetOutRows;
ÊÊÊ
ÊÊÊ if (difColumns<0)
ÊÊÊ {
ÊÊÊÊÊÊÊ difColumns++;
ÊÊÊÊÊÊÊ startOutColumns-=difColumns;
ÊÊÊÊÊÊÊ difColumns--;
ÊÊÊÊÊÊÊ endOutColumns+=difColumns;
ÊÊÊÊÊÊÊ difColumns=0;
ÊÊÊ }
ÊÊÊ if (difRows<0)
ÊÊÊ {
ÊÊÊÊÊÊÊ difRows++;
ÊÊÊÊÊÊÊ startOutRows-=difRows;
ÊÊÊÊÊÊÊ difRows--;
ÊÊÊÊÊÊÊ endOutRows+=difRows;
ÊÊÊÊÊÊÊ difRows=0;
ÊÊÊ }
ÊÊÊ gPozice.x=gSPozice.x+(short)gDif.x;
ÊÊÊ if (gPozice.x> difColumns) gPozice.x=difColumns;
ÊÊÊ if (gPozice.x<-difColumns) gPozice.x=-difColumns;
ÊÊÊ gPozice.y=gSPozice.y+(short)gDif.y;
ÊÊÊ if (gPozice.y> difRows) gPozice.y=difRows;
ÊÊÊ if (gPozice.y<-difRows) gPozice.y=-difRows;
ÊÊÊ proxyCenterCol = gOrigProxyRect.left + ((gOrigProxyRect.right - gOrigProxyRect.left) / 2);
ÊÊÊ proxyCenterRow = gOrigProxyRect.top + ((gOrigProxyRect.bottom - gOrigProxyRect.top) / 2);
ÊÊÊ proxyOffsetCol = (short)((outColumns * gRepFactor) / 2);
ÊÊÊ proxyOffsetRow = (short)((outRows * gRepFactor) / 2);
ÊÊÊ if (!mask)
ÊÊÊ {
ÊÊÊÊÊÊÊ for (i = 0;i < startOutRows;i ++)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr = (unsigned8 *) gStuff->outData + (i * outColumns* outPlanes);
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2= (unsigned8 *) gSHOWmask + (i * outColumns);
ÊÊÊÊÊÊÊÊÊÊÊ for (j = 0; j < outColumns; j ++)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ for(plane=0;plane<inPlanes;plane++) dstPtr [plane] = kUIBackcolor;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2[0]=255;
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr +=outPlanes;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2++;
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ }
ÊÊÊ }
ÊÊÊ max
=(int)sqrt((inRows
/2)*(inRows
/2)+(inColumns
/2)*(inColumns
/2));
ÊÊÊ for (i = startOutRows;i < endOutRows; i ++)
ÊÊÊ {
ÊÊÊÊÊÊÊ srcX = (short)((-gPozice.x+difColumns)/gRepFactor) + ((i - startOutRows + (short)((-gPozice.y+difRows)/gRepFactor) + offset) * inColumns );
ÊÊÊÊÊÊÊ dstPtr = (unsigned8 *) gStuff->outData + (i * outColumns* outPlanes);
ÊÊÊ mskPtr2= (unsigned8 *) gSHOWmask + (i * outColumns);
ÊÊÊÊÊÊÊ mskPtr = (unsigned8 *) gFFTmask + (short)((-gPozice.x+difColumns)/gRepFactor) + ((i - startOutRows + (short)((-gPozice.y + difRows)/gRepFactor) + offset) * inColumns);
ÊÊÊÊÊÊÊ HFactor=0;
ÊÊÊÊÊÊÊ for (j = 0; j < startOutColumns;j ++)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ for(plane=0;plane<inPlanes;plane++) dstPtr [plane] = kUIBackcolor;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2[0]=255;
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr += outPlanes;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2++;
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ srcY=srcX-((short)(srcX/inColumns))*inColumns; ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ for (j = startOutColumns;j < endOutColumns; j ++)
ÊÊÊÊÊÊÊ { ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ if (gIMaska) mskPtr2[0] = 255-mskPtr[0];
ÊÊÊÊÊÊÊÊÊÊÊ else mskPtr2[0]=255;
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ if(!mask)
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ if(mskPtr[0]) for(plane=0;plane<inPlanes;plane++) dstPtr[plane]=((gInten*gFFTdata[((srcX/inColumns)*inColumns+srcY)*inPlanes+plane]/100)+(100-gInten)*gFFTdata2[((srcX/inColumns)*inColumns+srcY)*inPlanes+plane]/100); ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ else ÊÊÊÊÊÊÊ for(plane=0;plane<inPlanes;plane++) dstPtr[plane]=gFFTdata[((srcX/inColumns)*inColumns+srcY)*inPlanes+plane];
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr +=outPlanes;
ÊÊÊÊÊÊÊÊÊÊÊ srcY ++;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr++;
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2++;
ÊÊÊÊÊÊÊÊÊÊÊ HFactor += ((1/gRepFactor)-1);
ÊÊÊÊÊÊÊÊÊÊÊ while(HFactor>=0.5)
{
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ HFactor-=1;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ srcY ++;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr++;
}
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ if(!mask)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ for (j = endOutColumns; j < outColumns; j ++)
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ for(plane=0;plane<inPlanes;plane++) dstPtr [plane] = kUIBackcolor;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr2[0]=255;
ÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ dstPtr += outPlanes;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr2++;
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ VFactor += ((1/gRepFactor)-1);
ÊÊÊÊÊÊÊ while(VFactor>=0.5)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ VFactor-=1;
ÊÊÊÊÊÊÊÊÊÊÊ offset+=1;
ÊÊÊÊÊÊÊ }
ÊÊÊ }
ÊÊÊ if(!mask)
ÊÊÊ {
ÊÊÊÊÊÊÊ for (i = endOutRows; i < outRows; i ++)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ dstPtr = (unsigned8 *) gStuff->outData + (i * outColumns* outPlanes);
ÊÊÊÊÊÊÊÊÊÊÊ mskPtr2= (unsigned8 *) gSHOWmask + (i * outColumns);
ÊÊÊÊÊÊÊÊÊÊÊ for (j = 0; j < outColumns; j ++)
ÊÊÊÊÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ for(plane=0;plane<inPlanes;plane++) dstPtr [plane] = kUIBackcolor;ÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr2[0]=255;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ dstPtr += outPlanes;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ mskPtr2++;
ÊÊÊÊÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ }
ÊÊÊ }
ÊÊÊ gProxyRect.left = proxyCenterCol - proxyOffsetCol > gOrigProxyRect.left
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterCol - proxyOffsetCol : gOrigProxyRect.left;
ÊÊÊ gProxyRect.right = proxyCenterCol + proxyOffsetCol < gOrigProxyRect.right
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterCol + proxyOffsetCol : gOrigProxyRect.right;
ÊÊÊ gProxyRect.top = proxyCenterRow - proxyOffsetRow > gOrigProxyRect.top
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ? proxyCenterRow - proxyOffsetRow : gOrigProxyRect.top;
ÊÊÊ gProxyRect.bottom = proxyCenterRow + proxyOffsetRow < gOrigProxyRect.bottom;
}
ÊÊÊ
/*****************************************************************************/
/* Zooms in by one factor (parts of 1.0 until 1.0, then 1.0, 2.0, etc. */
void ZoomIn (short *zoom)
{
ÊÊÊ if (*zoom >= kNumZooms)
ÊÊÊÊÊÊÊ *zoom += kNumZooms;
ÊÊÊ else (*zoom)++;
}
void ZoomOut (short *zoom)
{
ÊÊÊ if (*zoom >= (kNumZooms*2))
ÊÊÊÊÊÊÊ *zoom -= kNumZooms;
ÊÊÊ else (*zoom)--;
}
/*****************************************************************************/
/* Takes an enumeration and returns corresponding zoom size */
short GetZoomFactor (GPtr globals)
{
ÊÊÊ shortÊÊÊ sub = 0;
ÊÊÊ shortÊÊÊ returnValue = noErr;
ÊÊÊ
ÊÊÊ /* check for zoomFactor bounds */
ÊÊÊ
ÊÊÊ if (gZoomFactor <= kMinZoom)
ÊÊÊ {
ÊÊÊÊÊÊÊ gZoomFactor = kMinZoom;
ÊÊÊÊÊÊÊ returnValue = hitLowBounds;
ÊÊÊ }
ÊÊÊ else if (gZoomFactor >= kMaxZoom)
ÊÊÊ {
ÊÊÊÊÊÊÊ gZoomFactor = kMaxZoom;
ÊÊÊÊÊÊÊ returnValue = hitHighBounds;
ÊÊÊ }
ÊÊÊ
ÊÊÊ sub = gZoomFactor % kNumZooms;
ÊÊÊ
ÊÊÊ switch (sub)
ÊÊÊÊÊÊÊ {
ÊÊÊÊÊÊÊÊÊÊÊ case 1:
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gRepFactor = (float)0.25;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ break;
ÊÊÊÊÊÊÊÊÊÊÊ case 2:
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gRepFactor = (float)0.33;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ break;
ÊÊÊÊÊÊÊÊÊÊÊ case 3:
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gRepFactor = (float)0.50;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ break;
ÊÊÊÊÊÊÊÊÊÊÊ case 4:
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gRepFactor = (float)0.66;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ break;
ÊÊÊÊÊÊÊÊÊÊÊ case 5:
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gRepFactor = (float)0.80;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ break;
ÊÊÊÊÊÊÊÊÊÊÊ default:
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gRepFactor = (float)0;
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ break;
ÊÊÊÊÊÊÊ }
ÊÊÊÊÊÊÊ gRepFactor += gZoomFactor / kNumZooms;
ÊÊÊ return returnValue;
}
void scaleRect(Rect *l, short n, short d) {
ÊÊÊ l->left = (l->left * n) / d;
ÊÊÊ l->top = (l->top * n) / d;
ÊÊÊ l->right = (l->right * n) / d;
ÊÊÊ l->bottom = (l->bottom * n) / d;
}
void shrinkRect(Rect *l, short x, short y) {
ÊÊÊ l->left += x;
ÊÊÊ l->top += y;
ÊÊÊ l->right -= x;
ÊÊÊ l->bottom -= y;
}
void copyRect(Rect *l, const Rect *r) {
ÊÊÊ l->left = r->left;
ÊÊÊ l->top = r->top;
ÊÊÊ l->right = r->right;
ÊÊÊ l->bottom = r->bottom;
}
/******************************************************************************/
/* NEPOU?ITO - Pokud se filtruje po ?stech */
void StartNoAdvanceState (GPtr globals)
{
ÊÊÊ DoInitialRect(globals);
}
/*****************************************************************************/
/* NEPOU?ITO - inicializace prvn filtrovan ?sti - filtrovn po ?stech */
void DoInitialRect (GPtr globals)
{
ÊÊÊ int32 total;
ÊÊÊ total = gStuff->filterRect.bottom - gStuff->filterRect.top;
ÊÊÊ gStuff->inLoPlane = gStuff->outLoPlane = 0;
ÊÊÊ gStuff->inHiPlane = gStuff->outHiPlane = gStuff->planes - 1;
ÊÊÊ
ÊÊÊ /* Pou?t Alfa kanl? */
ÊÊÊ #if useAlpha
ÊÊÊ if (!gStuff->isFloating)
ÊÊÊ {
ÊÊÊÊÊÊÊ gStuff->wantsAbsolute = true;
ÊÊÊÊÊÊÊ if (gStuff->inLayerPlanes !=0 && gStuff->inTransparencyMask != 0)
ÊÊÊÊÊÊÊÊÊÊÊ gStuff->inHiPlane = gStuff->absLayerPlanes - 1 +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absTransparencyMask +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absInvertedLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->absNonLayerPlanes;
ÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊ if (gStuff->outLayerPlanes !=0 && gStuff->outTransparencyMask !=0)
ÊÊÊÊÊÊÊÊÊÊÊ gStuff->outHiPlane = gStuff->outLayerPlanes - 1 +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outTransparencyMask +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outInvertedLayerMasks +
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ gStuff->outNonLayerPlanes;
ÊÊÊ }
ÊÊÊ #endif
ÊÊÊ gStuff->inputRate = long2fixed (1L);
ÊÊÊ gStuff->maskRate = long2fixed (1L);
ÊÊÊ gStuff->maskPadding = gStuff->outputPadding = gStuff->inputPadding = 255;
ÊÊÊ gStuff->inRect = gStuff->outRect = gStuff->maskRect = gStuff->filterRect;
ÊÊÊ gStuff->inRect.bottom = gStuff->outRect.bottom = gStuff->maskRect.bottom = gStuff->inRect.top + gRowSkip;
}
/*****************************************************************************/
/* NEPOU?ITO - Dotaz na dal? ?st */
Boolean DoNextRect (GPtr globals)
{
ÊÊÊ gStuff->inRect.top += gRowSkip; // next batch
ÊÊÊ gStuff->inRect.bottom += gRowSkip; // next batch
ÊÊÊ gStuff->outRect = gStuff->maskRect = gStuff->inRect;
ÊÊÊ
ÊÊÊ return gStuff->inRect.top < gStuff->filterRect.bottom;
}