# AVSLib :: sample script # Copyright (c) 2007 George Zarkadas (gzarkadas@users.sourceforge.net) # This program is free software; you can redistribute it and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. # You should have received a copy of the GNU General Public License along with this program; # if not, write to the "Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA" LoadModule("avslib", "base", "constants") LoadPackage("avslib", "array") LoadModule("avslib", "clip", "core") LoadModule("avslib", "filters", "frames") LoadModule("avslib", "filters", "resize") LoadModule("avslib", "filters", "utility") # afford a start/end blank to make code nicer to look # it will be cleaned by the stuff below varfiles = """ r.txt g.txt b.txt w.txt h.txt x.txt y.txt """ old = ArrayDelimiterSet(CRLF) okflag = varfiles.ArrayOpFunc("Exist").ArrayOpFunc("CInt") varfiles = varfiles.ArrayReduce(okflag) old = ArrayDelimiterSet(old) FilterScript = """ star_mask=%g rect_color = MakeRGBColor(${read1}, ${read2}, ${read3}) ovl = BlankClip(last, width=last.SafeWidth(${read4}), \ height=last.SafeHeight(${read5}), color=rect_color) star_mask = star_mask.Resize(ovl.Width, ovl.Height).ScaleToPC() Overlay(last, ovl, ${read6} - Round(ovl.Width / 2), \ ${read7} - Round(ovl.Height / 2), mask=star_mask) """ clp = BlankClip(color=$102005, pixel_type="yv12", length=300) effmask = ImageSource("star%06d.jpg", 0, 48, 25.0).Reverse().Loop(10).Trim(0,299) effmask = effmask.ResizeToTarget(clp).ConvertToTarget(clp).ScaleToPC() SetDefaultResizer("bicubic") FrameFilterReader(clp, FilterScript, varfiles, effmask)