%ffp //------------------------------------- // FM_TEMPLATE_2 //------------------------------------- Category: "REC's Filters" Title: "Image FM_Template_2" Copyright: "Copyright ©2001" Author: "Ron Chambers" Organization: "REC Filters, Inc." Filename: "fm_template_2" Description: "Image FM_Template_2" Version: "v1.0" URL: "mailto://rfchmbrs@swbell.net" About: "REC's Image FM_Template_2 Plug-in !V\n" "!c\n!A\n!U" Dialog: Text = "REC's Image FM_Template_2 Plug-in !V !c !A", Color=darkblue, Gradient = ( midnightblue, mediumblue, v ) //------------------------------------- SupportedModes: RGBMode //------------------------------------- ctl[00]: "PARAMETER (Range 0-255)", Action=NONE, val = 02, range=(0,255), tooltip="Default 2" ctl[01]: CHECKBOX, "CHECK", Action=NONE, val = 00, tooltip="Default No" ctl[98]: PUSHBUTTON (notify,mouseover), "Preview", Action=PREVIEW, tooltip="Preview", size=(34,14), Pos=(343,108) ctl[99]: PUSHBUTTON (notify,mouseover), "Help", tooltip="HELP", size=(34,14), Pos=(307,108) ctl[CTL_LOGO]: PUSHBUTTON (notify,mouseover), "About", Action=ABOUT, tooltip="About", size=(34,14), Pos=(343,126) ctl[CTL_OK]: PUSHBUTTON (notify,mouseover), "Apply", Action=APPLY, tooltip="Apply", size=(34,14), Pos=(307,126) //------------------------------------- // OnCtl //------------------------------------- OnCtl(n): { //------------------------------------- // mouseover/mouseout //------------------------------------- if (n==98 || n==99 || n==CTL_LOGO || n==CTL_OK) { if (n==98) {strcpy(str8, "PREVIEW"); strcpy(str9, "Preview");} if (n==99) {strcpy(str8, "HELP"); strcpy(str9, "Help");} if (n==CTL_LOGO) {strcpy(str8, "ABOUT"); strcpy(str9, "About");} if (n==CTL_OK) {strcpy(str8, "APPLY"); strcpy(str9, "Apply");} switch(e) { case FME_MOUSEOVER: setCtlText(n, str8); break; case FME_MOUSEOUT: setCtlText(n, str9); break; } } //------------------------------------- // help file //------------------------------------- if (n==99 && e==FME_CLICKED) { snprintf( str0, 255, "%s", filterInstallDir ); // Info("help dir = %s", str0); if( shellExec( "open", "fm_template_2_help.html", NULL, str0 ) != -1 ) ErrorOk( "Help is not available." ); } return false; //perform default action }//OnCtl //------------------------------------- // OnFilterStart //------------------------------------- OnFilterStart: { if( imageMode != RGBMode ) { ErrorOk("This filter only works on RGB images."); doAction(CA_CANCEL); } return false; }//OnFilterStart //------------------------------------- // ForEveryTile //------------------------------------- ForEveryTile: { int iVal; int XZ; int Zend; int range; bool check; int cost, total_cost; //------------------------------------- // Initialize variables //------------------------------------- range = ctl(00); check = ctl(01); Zend = Z; if (imageMode == RGBMode) Zend = RGBMode; //------------------------------------- // cost function //------------------------------------- XZ = (x_end-x_start+1) * Z; total_cost = XZ * (y_end-y_start+1) * (3 + Z - Zend); cost = 0; //------------------------------------- // move input channel data to work array //------------------------------------- for (y= y_start; y < y_end; y++) { for (x = x_start; x < x_end; x++) { for (z = 0; z