Skip to content

daelsepara/Pixel-Scaler-for-Windows-Plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixel Scaler for Windows Plugin

How to create a filter plugin DLL for Pixel Scaler

Image format

The filter's input and output format is raw 8-bit RGB without an alpha channel. This is essentially an unsigned char array in C/C++ terms. The size of the array is Width * Height * 3, i.e. 1 byte for each color channel. In the future this might change.

Required Exports

Although there is strictly no pre-defined way to code a filter plugin that will work with PixelScaler, the following functions are expected by the program

void Release()

This is where you perform clean-up procedures such as freeing resources, especially the filter's scaled output. This is called before the DLL is unloaded by PixelScaler.

void Apply(int argc, void** argv)

Actual application of the filter occurs here. Two arguments are passed in this function, the number of arguments argc, and an array of pointers argv to the actual parameters. PixelScaler assumes that the first 3 arguments are:

  • pointer to the input image (in 8-bit RGB format as described above), i.e. unsigned char* Input
  • pointer to an integer variable indicating the width of the input, i.e. int* Width
  • pointer to an integer variable indicating the height of the input, i.e. int* Height

Beyond the first three parameters, you have absolute freedom on how to process it. In the sample code provided here, the parameter values are read in the following manner:

auto Input = ((unsigned char*)(argv[0]));
auto srcx = *((int*)(argv[1]));
auto srcy = *((int*)(argv[2]));

Code to process other parameters (argv[3] and beyond) can easily adapted from the above example

void Threshold(bool threshold)

Passing a true value to this function indicates that the color comparison in FilterCommon.h should use Luminance, Chromaticity U, and V thresholds when comparing pixel colors. The default setting for the internal variable is false.

int ID()

This returns a numeric (integer) ID for your filter plugin. This may or may not be unique.

int Scale()

Indicates scaling factor of the filter's output. For 2 X magnification, this should return 2

int Parameters()

This just returns the number of special parameters that your plugin can handle. PixelScaler does not actively use this yet, but this is for future expansions. For now, it returns 0

const char* Name()

The name of the plugin

const char* Description()

Brief description of the plugin

unsigned char* Image()

Returns a pointer to the raw 8-bit RGB unsigned char buffer containing the most recent output (if any) of the filter, otherwise, it is null.

Releases

No releases published

Packages

No packages published