Code Monkey home page Code Monkey logo

pixel-scaler-for-windows-plugin's Introduction

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.

pixel-scaler-for-windows-plugin's People

Contributors

daelsepara avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.