Andy’s Text Filter
Andy’s Text Filter
Friday, September 30, 2005
Ever wished you could neaten up your timeline by adding text as a filter instead of a clip?
No, me neither, but one guy did, seriously! Ha ha ha. What a loser eh? So why bother re-posting it here?
Err... you mean other than fleshing out entries for my FCP plug-ins style blog? Damn you’re hard to please. Ah well then, here’s one reason, you ... nah, no. Well you could ... nah, forget that too. Ermm...
Oh no wait, hang on a minute, I think I’ve got a good one ... what if you have to add a disclaimer like “Amateur Video” everywhere that a certain clip source is used, or an attribution tag, like “Courtesy Joe Blogg’s Productions” or similar. This would be an easy way of adding that tag as a filter to the source clip so that it would automatically appear anywhere and everywhere that the clip was used. Hey, you know that isn’t such a bad idea. Sorry Steve, I take it all back.
scriptid "Andy's Text" //DO NOT LOCALIZE
filter "Andy's Text"
group "Text"
fullFrame
input str, "Text", text, "SAMPLE TEXT" textheight 10;
input fontname, "Font", FontList, "", "str";
input fontsize, "Size", slider, 36, 0, 1000 ramp 80 detent 36;
input fontstyle, "Style", popup, 1, "Plain", "Bold", "Italic", "Bold/Italic";
input center, "Center", point, 0, 0.3;
input fontcolor, "Font Color", color, 255, 255, 255, 255;
input ignoreOpacity, "Ignore Opacity (Faster)", checkbox, 1
input opacityTC, "Opacity", slider, 100, 0, 100 detent 100;
input backcolor, "Back Color", color, 255, 0, 0, 0;
code
float a, d, w, h;
point centeroftxt, framesize, poly[4], txtbox[4];
resetText;
fontcolor.a = 255;
backcolor.a = 255;
dimensionsof(dest, framesize.x, framesize.y);
fontsize *= (framesize.x / 640)
setTextFont(fontname);
setTextSize(fontsize);
if fontstyle == 4 // bold & italic
setTextstyle(kbolditalic);
else if fontstyle == 3 // italic
setTextstyle(kitalic);
else if fontstyle == 2 // bold
setTextstyle(kbold);
else // plain
setTextstyle(kplain);
end if;
centeroftxt = framesize;
centeroftxt *= center;
measurestringplain(str, w, h, a, d, aspectof(dest));
makerect(txtbox, centeroftxt.x-w/2, centeroftxt.y-a/2, w, a);
poly = txtbox;
scale(poly, centeroftxt, 1.1, 1.5);
if ignoreOpacity
// This performs faster, because it avoids a bunch of extra processing
dest = src1
backcolor.a = 255
fillpoly( poly, dest, backcolor )
else
channelfill(dest, 0, 0, 0, 0);
fillpoly(poly, dest, kwhite);
channelcopy(dest, dest, kred, knone, knone, knone);
channelfill(dest, -1, backcolor.r, backcolor.g, backcolor.b);
Matte(dest, src1, dest, opacityTC/100, kalpha);
end if
drawstringplain(str, txtbox, dest, fontcolor, aspectof(dest));