# AVSLib :: 'deprecated' package :: 'clip' module
# Copyright (c) 2005 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"

DefineModule("avslib", "deprecated", "clip")

global __load__ = Eval("""
	LoadModule("avslib", "base", "core")
	LoadModule("avslib", "clip", "core")
	""")

# Returns the dimension passed in appropriately modified so that 
# passing it to a resize function will not crash Avisynth (ver. < 2.5.6)
# or result in an error dialog box (ver. >= 2.5.6).
# Deprecated; use SafeWidth, SafeHeight instead.
# Will be removed in version 1.5.0
#
Function ResizeSafe(clip c, int "width", int "height", bool "interlaced")
{
	interlaced = Default(interlaced, false)
	Assert(__xor2(Defined(width), Defined(height)), \
		"ResizeSafe: exactly one of 'width', 'height' must be specified")
	return Defined(width) \
		? SafeWidth(c, width) \
		: SafeHeight(c, height, interlaced)
}
