subtype idKGScriptParserduration?đ framebaseencodingparms inputFormat inputCountpublicbogtitlemore filters atuitype typedefaultstringvaluespudwww.fxscript.org stringamounteffect strengthminmax?€?€?€rbalancer slopeÂČBČBHBHgbalanceg slopeÂČBČBHBHbbalanceb slopeÂČBČBHBHroffsetr offsetÀC€rampA goffsetg offsetÀC€+A boffsetb offsetÀC€+A rgammar gamma@€?€?€ggammag gamma@€?€?€bgammab gamma@€?€?€ rsinusoid r film curveż€?€ gsinusoid g film curveż€?€ bsinusoid b film curveż€?€graphon draw graphprivatestaticsscript filter "colouriser 2.3"; group "stib's filters"; // a colouriser using CLUTs input bog, "more filters at", Label, "string" input spud, "www.fxscript.org", Label, "string" input amount, "effect strength", slider, 1, 0, 1; input rBalance, "r slope", slider, 50, -100, 100; input gBalance, "g slope", slider, 50, -100, 100; input bBalance, "b slope", slider, 50, -100, 100; input rOffset, "r offset", slider, 0, -256, 256 ramp 10; input gOffset, "g offset", slider, 0, -256, 256 ramp 10; input bOffset, "b offset", slider, 0, -256, 256 ramp 10; input rGamma, "r gamma", slider, 1, 0, 4; input gGamma, "g gamma", slider, 1, 0, 4; input bGamma, "b gamma", slider, 1, 0, 4; input rSinusoid, "r film curve", slider, 0, -1, 1; input gSinusoid, "g film curve", slider, 0, -1, 1; input bSinusoid, "b film curve", slider, 0, -1, 1; input GraphOn, "draw graph", CheckBox, false code float i, clut_RGB[3][256], RGBBalance[3], RGBOffset[3], RGBGamma[3], RGBSinusoid[3] float ColourChannel; color lineColour[3]; //load the slider values into some arrays RGBBalance = {rBalance, gBalance, bBalance}; RGBOffset = {rOffset, gOffset, bOffset}; RGBGamma = {rGamma, gGamma, bGamma}; RGBSinusoid = {rSinusoid, gSinusoid, bSinusoid}; // the r, g & b Balance sliders provide the an input to output function of the form y = a(x^b)+c+dsin(kx) // here we plot the graph into CLUTs. for ColourChannel = 0 to 2 if (amount != 0) and ((RGBBalance[ColourChannel] != 50) or (RGBOffset[ColourChannel] != 0) or (RGBGamma[ColourChannel] != 1) or (RGBSinusoid[ColourChannel]!=0)) then //skip all this pallaver if the level slider is not changed for i = 0 to 255 clut_RGB[ColourChannel][i] = i * (1-amount)/255 + amount * ((RGBBalance[ColourChannel]/50 * Power(i/255, RGBGamma[ColourChannel])) + RGBOffset[ColourChannel]/255 + (0-RGBSinusoid[ColourChannel])/2*(RGBBalance[ColourChannel]/50*sin(i/255*360))) ; // ooh that's an ugly one. the default slope + overall level control * (( slope * gamma ) + offset + sinusoidality) // I used to have checks for values > 256 and <0 here but you don't need em -levelmap takes care of this itself next; else clut_RGB[ColourChannel] = LinearRamp end if; next; levelmap(src1, dest, LinearRamp, clut_RGB[0], clut_RGB[1], clut_RGB[2]); if GraphOn { float screenwidth, screenheight point Xleft ,Xright , Ytop, RgraphPoint , GgraphPoint , BgraphPoint DimensionsOf(dest, screenwidth, screenheight); screenheight *= 0.8; screenwidth *= 0.8; Xleft = {0-screenwidth/2, screenheight/2} Xright = {screenwidth/2, screenheight/2} Ytop = {screenwidth/2, 0-screenheight/2} Line(Xleft , Xright , dest, kwhite, 2) Line(Xright , Ytop , dest, kwhite, 2) //x & y axes for ColourChannel = 0 to 2 for i = 0 to 255 if clut_RGB[ColourChannel][i] > 0 and clut_RGB[ColourChannel][i] < 1 RgraphPoint = {i/256*screenwidth - screenwidth/2,(screenheight/2)-clut_RGB[ColourChannel][i]*screenheight}; lineColour[0] = {0,255,0,0} lineColour[1] = {0,0,255,0}; lineColour[2] = {0,0,0,255}; //for some reason I couldn't do all this in one line. I kept chucking errors. DrawSoftDot(Dest, RgraphPoint, kRound, 3, 5, 1, lineColour[ColourChannel], 100, 1) // plot the red graph end if next; next; end if; namecolouriser 2.3scriptidNgroupstib's filtersencoded