Using a built-in dialog window, Astroart will manage automatically:
- Preview
- Real-time preview
- Comparison with the original image
- Undo
- Documentation
The parameters of the dialog window are prepared as a multiline text, for example:
Code: Select all
NUMBER "High pass" 70 0 100 5
NUMBER "Opacity" 100 0 100 5
BOOLEAN "Adaptive" 1
HELP "HighPassDemo.htm"
The SDK contains an example (for Visual Studio, Codeblocks GCC, Lazarus, Delphi), which creates a different dialog window, with an option to flip the image:
Code: Select all
void WINAPI pi_process(void *pimage, HWND whandle)
{
double *pv1,*pv2;
double vnew,vori,c1,c2;
int x,y,ix,iy,r;
bool cflip;
pv1 = (double*)fcallback(ac_getdialogparam, DLG_NAME, (void*)1, NULL);
c1 = *pv1 / 100.0;
c2 = 1.0 - c1;
pv2 = (double*)fcallback(ac_getdialogparam, DLG_NAME, (void*)2, NULL);
cflip = *pv2 != 0.0;
fcallback(ac_getsize, pimage, &dimx, &dimy);
r = fcallback(ac_getbuffer, pimage, &newbuffer,(void*)PC_GREEN);
if (r != 2) return;
r = fcallback(ac_getundobuffer, pimage, &undobuffer,(void*)PC_GREEN);
if (r != 2) return;
for (iy=0; iy<dimy; iy++) {
y = iy;
if (cflip)
y = dimy-1-iy;
for (ix=0; ix<dimx; ix++) {
x = ix;
vnew = getPixel(x,y)*5.0 - getPixel(x+1,y) - getPixel(x,y+1) - getPixel(x-1,y) - getPixel(x,y-1);
vori = getPixel(x,y);
setPixel(ix, iy, vnew*c1 + vori*c2);
}
}
}
The second section prepares the buffers.
The third section is the actual code of the filter. Just modify this section to experiment with your own filters.