subtype idKGScriptParserduration?đ framebaseencodingparms inputFormat inputCountpublicbogtitlemore filters atuitype typedefaultstringvaluespudwww.fxscript.org stringamounteffect strengthminmax?€?€?€ rgb_balance rgb slopeÂČBČBHBHrbalancer slopeÂČBČBHBHgbalanceg slopeÂČBČBHBHbbalanceb slopeÂČBČBHBH rgb_offset rgb offsetÀC€rampA roffsetr offsetÀC€.A goffsetg offsetÀC€.A boffsetb offsetÀC€.A rgb_gamma rgb gamma@€?€?€rgammar gamma@€?€?€ggammag gamma@€?€?€bgammab gamma@€?€?€ rgb_sinusoidrgb film curveż€?€ rsinusoid r film curveż€?€ gsinusoid g film curveż€?€ bsinusoid b film curveż€?€graphondraw graph (preview only)privatestaticsscriptŘ//--------------------------------// // Stib's Colour Engine // //for more visit www.fxscript.org // //--------------------------------// //copyright 2003-2005 stephen dixon //This software is free - you may modify and distribute it as you wish as long as: //* the source remains open //*you clearly identify my code as the basis for the modification //* this message remains with the source //this software is released under the terms of the GNU Public license //this software comes with no warranty of fitness for any purpose whatsoever, ok? //if you like it or if you do something creative with it let me know, I'd love to hear from you. //colour engine is a rename of my old colouriser plugin, if you're wondering. filter "RGB colour engine"; group "stib's filters"; // an all purpose, industrial strength, YUV aware colour tool 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 rgb_Balance, "rgb slope", slider, 50, -100, 100; 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 rgb_Offset, "rgb offset", slider, 0, -256, 256 ramp 10; 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 rgb_Gamma, "rgb gamma", slider, 1, 0, 4; 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 rgb_Sinusoid, "rgb film curve", slider, 0, -1, 1; 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 (preview only)", CheckBox, true //InformationFlag("YUVaware") //broken. so broken code rgb_Balance -= 50; //munge our slider values into something more useful rgb_Gamma -=1; float i, clut_RGB[3][256], RGBBalance[3], RGBOffset[3], RGBGamma[3], RGBSinusoid[3] float ColourChannel,w, h; //load the slider values into some arrays RGBBalance = {rBalance+rgb_Balance, gBalance+rgb_Balance, bBalance+rgb_Balance}; RGBOffset = {rOffset+rgb_Offset, gOffset+rgb_Offset, bOffset+rgb_Offset}; RGBGamma = {rGamma+rgb_Gamma, gGamma+rgb_Gamma, bGamma+rgb_Gamma}; RGBSinusoid = {rSinusoid+rgb_Sinusoid, gSinusoid+rgb_Sinusoid, bSinusoid+rgb_Sinusoid}; // the r, g & b Balance sliders provide the an input to output function of the form y = a(x^b)+c+d.sin(kx) // here we plot the graph into CLUTs. for ColourChannel = 0 to 2 if (amount + RGBBalance[ColourChannel] + RGBOffset[ColourChannel]+ RGBGamma[ColourChannel] +RGBSinusoid[ColourChannel]!=51) 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; //process in RGB format without conversion levelmap(src1, dest, LinearRamp, clut_RGB[0], clut_RGB[1], clut_RGB[2]); if GraphOn && previewing{ //only draw the graph in previews, so you don't have to worry about turning it off for final renders float screenwidth, screenheight color lineColour[3]; string labelStr[3]; 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 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. It kept chucking errors. labelStr[0] = "r" labelStr[1] = "g" labelStr[2] = "b" 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}; DrawSoftDot(Dest, RgraphPoint, kRound, 3, 5, 1, lineColour[ColourChannel], 100, 1) // plot the red graph end if next; DrawString(labelStr[ColourChannel], RgraphPoint.X, RgraphPoint.Y, 10, dest, lineColour[ColourChannel], 1) next; string advertising SetTextSize(screenwidth/20) advertising = "stib's RGB colour engine" DrawString(advertising, XLeft.X, Xright.Y+10, 10, dest, kRed, 1) end if; nameRGB colour enginescriptidZgroupstib's filtersencoded