%ffp // 20.04.2008 V1.0 Category: "easy.Filter" Title: "Color balance" Filename: "colorbalance.8bf" Copyright: "© 2008" Author: "Alois Zingl" Version: "1.0" URL: "http://free.pages.at/easyfilter/filtermeister.html" Description:"Adjust the color balance." SupportedModes: RGBMode, RGB48Mode ctl(10): PushButton, "Reset", pos=(370,160) ctl(0): Groupbox, "Color Balance", pos=(280,5), size=(200,45) // shadows ctl(1): "Cyan - Red", range=(-100,100), pos=(350,15), color=verydarkgray, Invisible ctl(2): "Mangenta - Green", range=(-100,100), pos=(350,25), color=verydarkgray, Invisible ctl(3): "Yellow - Blue", range=(-100,100), pos=(350,35), color=verydarkgray, Invisible // midtones ctl(4): "Cyan - Red", range=(-100,100), pos=(350,15), color=gray ctl(5): "Mangenta - Green", range=(-100,100), pos=(350,25), color=gray ctl(6): "Yellow - Blue", range=(-100,100), pos=(350,35), color=gray // highlights ctl(7): "Cyan - Red", range=(-100,100), pos=(350,15), color=verylightgray, Invisible ctl(8): "Mangenta - Green", range=(-100,100), pos=(350,25), color=verylightgray, Invisible ctl(9): "Yellow - Blue", range=(-100,100), pos=(350,35), color=verylightgray, Invisible ctl(11): RadioButton(Group), "&Shadows", pos=(300,65), size=(45,10), Action=none ctl(12): Radiobutton, "&Midtones", pos=(350,65), size=(45,10), Action=none, val=1 ctl(13): RadioButton, "&Highlights", pos=(410,65), size=(45,10), Action=none ctl(14): CheckBox, "&Preserve Luminosity", pos=(300,75), val=1 ctl(15): Groupbox, "Tone Balance", pos=(280,55), size=(200,35), val=1 ctl(16):statictext(center),"!D !C, !A, V!V", pos=(280,110),size=(200,10) ctl(17):statictext(center),"!U", pos=(280,130),size=(200,10) ctl(CTL_PREVIEW): modify, pos=(5,5), size=(260,153) OnCtl(n): { if (n>10&&n<14) // radiobutton Tone Balance for (i=0; i<9; i++) enableCtl(i+1,-(i/3+11==n)); if (n==10) // Reset for (i=1; i<10; i++) setCtlVal(i,0); return false; } OnFilterStart: { int s, e, M=imageMode>15; // 8-bit value r = p-((257*i+1)>>1); // 16-bit reminder p = get(i+256*z); p += ((get(i+1+256*z)-p)*r+63)/128; } pset(x,y,z,p); } } } return true; } OnFilterEnd: { updateProgress(0,1); return false; }