Plug-in SDK

Upcoming mother of all image editors
Post Reply
Oscar
Site Admin
Posts: 864
Joined: Fri Oct 22, 2010 9:54 am

Plug-in SDK

Post by Oscar »

Questions and discussion about the plug-in SDK
(this is just a placeholder so I can get a link while I am creating the web pages)

Plugin for the first beta (it will be included in standard installation)
QR Code (Building blocks) Add your QR bar code to the image
qrcode.zip
(33.89 KiB) Downloaded 690 times
Unzip it to the plugins folder.

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

I am looking forward to seeing your end product.

I looked at the SDK already, would it be possible to include some various blurs or edge preserving smooth as samples for the SDK as well?

Would it be also possible to support .NET for usage of c# or Visual Basic?

Andy

Oscar
Site Admin
Posts: 864
Joined: Fri Oct 22, 2010 9:54 am

Re: Plug-in SDK

Post by Oscar »

at this moment it is c++ but because everything is handled by the main program i don't think c# or vb would be any use here - there is nothing you can use from the .net or vb libraries as the UI is done by the photoreactor. And you would need to link to .net libraries or vb runtime - that would certainly be prone to mess.
So all you need to do is just to fill the part where you receive your input and output buffer and that part would be practically same in c# or VB. Everything else is generated by photoreactor in the generate source code so you don't even have to worry about it.

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

I'm excited about the use of the SDK. I read about various other image processing techniques (though sometimes the math is horribly complex for me) and would love to be able to incorporate some of the techniques I read about into an image processor. I do some photoshop, however that SDK is horribly complex. I am hoping that your SDK is easier to work with. Looking forward to seeing Photo Reactor in action.

Andy

Oscar
Site Admin
Posts: 864
Joined: Fri Oct 22, 2010 9:54 am

Re: Plug-in SDK

Post by Oscar »

Let me know if you need help with the SDK. It was designed to be super-duper easy and the Generate Code in tools does 100% of the set up.

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

I am posting the first 3rd party plugin for the upcoming Photo Reactor -- Luminance.
Luminance.zip
Extracts the Luminance from an RGB image
(47.63 KiB) Downloaded 710 times
This plugin extracts the luminance from a RGB image to be placed in the plugins folder.

There are a number of official color spaces and a few "special" color spaces that have no basis in reality. In fact I cannot guarantee anything has a basis in reality.

The plugin has 17 different outputs, some more impressive than others, but for the enjoyment of all.

This will not be guaranteed to work with the final version of Photo Reactor if the SDK changes at all.

When the final version of Photo Reactor comes out and the code still works I will post the code for everyone to play with / modify on their own.

enjoy
andy dansby

Delboy
Posts: 829
Joined: Sat Oct 23, 2010 9:28 am
Location: Reading, UK
Contact:

Re: Plug-in SDK

Post by Delboy »

Thank you Andy

Works great :)
DMFX Player v3.0.9.7 Released 02/03/2016

Oscar
Site Admin
Posts: 864
Joined: Fri Oct 22, 2010 9:54 am

Re: Plug-in SDK

Post by Oscar »

The plugin SDK use C++ polymorphism and so there is very little reason the base will need to change as new things can be added with backward and forward compatibility. Basically it mimics COM functionality without the burden on the developer to actually mess with COM or any of the COM registration problems.

Oscar
Site Admin
Posts: 864
Joined: Fri Oct 22, 2010 9:54 am

Re: Plug-in SDK

Post by Oscar »

As Andy wrote in my pm, the only thing that maybe needs more explanation is the UIParameters.
UIParameters are the parameters user see in the interface and in the sdk you need access to them to see if user changed anything.

The Generate Code will create all necessary functions and macros for you to work with the parameters and visually allow you to create the parameters. But some explanation may be necessary.

The first step is the creation of parameters (Generate Code handles this)

Code: Select all

int GetUIParameters (UIParameters* pParameters)
	{

		// label, value, min, max, type_of_control, special_value
		// use the UI builder in the software to generate this

		AddParameter(0,"Desaturate",80.0, 0.0, 100, TYPE_SLIDER, 0 );
		AddParameter(1,"Invert",0.0, 0.0, 1, TYPE_CHECKBOX, 0 );

		return 2;
	}
This basically calls the macro to fill up the UIParameters function and return the number of parameters. The code is generated visually in the interface so in general you don't need to create this, but in case of adding or changing the parameters you may. The first parameter in AddParameter is the ID of the parameter and in the generated code it is replaced by verbal name something like

Code: Select all

AddParameter(PARAM_DESATURATE,"Desaturate",80.0, 0.0, 100, TYPE_SLIDER, 0 );
if you look on the top of a generated pluginXXXX.cpp you will then see that

Code: Select all

#define PARAM_DESATURATE 0
This is just to make it easier if there are too many parameters.
Then there is a label ("desaturate") which will just appear on the slider or other control, following by the default value (80.0), minimum (0.0) and maximum (100.0). All numbers are always double, even integer ones or boolean for simplicity. Then there is the type of controller (the types are defined in the IPlugin.h and there are currently 19 different controls). The last parameter is a special value (again, it is set by the visual interface in generate code and it has different meaning for controls, for example in checkbox it determines which controls - if any should be disabled or enabled)

On interface this appears as:
input21.jpg
input21.jpg (3.85 KiB) Viewed 14435 times
And that is exactly what the code above does.

More interesting part is how to use the parameters.
Any function that you can change (and there are only few) in SDK will carry the current parameters. The most obvious function is the main process

Code: Select all

virtual void Process_Data (BYTE* pBGRA_out,BYTE* pBGRA_in, int nWidth, int nHeight, UIParameters* pParameters)
There are few macros to get the value from the ID. so in our case to get desaturate value

Code: Select all

double dEffect = GetValue(0)/100.0;
or using the verbal define

Code: Select all

double dEffect = GetValue(PARAM_DESATURATE)/100.0;
I am dividing it by 100, because the parameter is set as min = 0; max = 100 and I want my dEffect in 0..1.0
What the macro GetValue does is simply

Code: Select all

#define GetValue(N) (pParameters[N].m_dValue)
That means I can expand it like this and it would be valid:

Code: Select all

double dEffect = pParameters[PARAM_DESATURATE].m_dValue
Of course macro makes it nicer

I can do the same for a checkbox, because when checkbox is on it returns maximum value (1.0) when off it returns minimum value (0.0) but casting double to bool is really funny: BOOL bInvert = (BOOL) GetValue(1); would work, but it is potentially a bug source so there is another macro that simply compare the value with maximum value and return BOOL

Code: Select all

BOOL bInvert =  GetBOOLValue(1);
This is basically the basics of getting the parameters that user sets in the interface.

andydansby
Posts: 161
Joined: Fri Oct 29, 2010 6:00 am
Location: Syracuse, NY

Re: Plug-in SDK

Post by andydansby »

I am now posting my next 3rd party plugin for the upcoming Photo Reactor -- Sepia
Sepia.zip
Turns your image into an olde time image by placing a Sepia toning matrix to your image.
(32.81 KiB) Downloaded 677 times
There is 1 standard Sepia matrix commonly found which is the first choice, but playing with the numbers, there are a number of different Sepia matrix's that can be used. As usual, I probably went overboard. I am also including 5 types of Cyanotype for a total of 11 different filters.


enjoy
andy dansby

Post Reply