%ffp

// This is a simple template for a FilterMeister filter. To get 
// started simply replace the current values with your own 
// ones. You can also try to replace parts of the current code 
// or even add your own code.


//------------------------------------------------------------------------------------------
// Filter Infos

// The name of the sub menu on which your filter will appear 
// in the graphics application
Category:         "Harry's Filters"	

// The name of the filter and the sub menu item
Title:            "Colorize"	

// Your plugin will be saved under this name
Filename:         "Colorize.8bf"	

// Other values
Copyright:        "Freeware"
Author:           "Harald Heim"
Organization:     "The Plugin Site"
URL:              "http://thepluginsite.com"
Description:      "Colorize the Image\n"
Version:          "1.0"

// Determines what will be displayed on the About dialog of your 
// plugin: Title (!T), Version (!V), Description (!D), Copyright (!c) 
// and URL (!U) each in a separate line
About:           "!T !V\n!D\n!c\n!U"			


//------------------------------------------------------------------------------------------
// Filter Control Definitions

ctl(0): "Red",             //The slider label
        Range=(-128,128),  //Value range of the slider
        Pos=(220,20),      //Position of the slider on the dialog
        Size=(*,7),        //Size of the slider
        Val=0              //Initial value of the slider

ctl(1): "Green", Range=(-128,128), Pos=(220,30), Size=(*,7), Val=0
ctl(2): "Blue", Range=(-128,128), Pos=(220,40), Size=(*,7), Val=0

// Hide the Edit button and the logo
ctl[CTL_EDIT]: None
ctl[CTL_LOGO]: None


//------------------------------------------------------------------------------------------
// Here comes the filter code

ForEveryTile:
{

	int c;
	
	
	for (y=y_start; y<y_end; ++y){ 		// loop through all rows

		//Update progress bar and cancel if ESC key was pressed
		if ( updateProgress(y,Y) ) break;
		
		for (x=x_start; x<x_end; ++x){ 	// loop through all columns
			
			for (z=0; z<Z; ++z){ 	// loop through all channels
		
				// Read a color value
				c = pget (x,y,z);
	
				// Process the color value. 
				// In this case the value of the appropriate 
				// slider is added to the color value
				c = c + ctl(z);
				
				//Write color value
				pset ( x, y, z, c );
		
			} // for z
		
		} // for x
	
	} // for y
	
	//Stop processing and apply the effect
	return true;
}