imager
AQSIS_V 1.6.0


segment Data

USES 8782080

param uniform  color background
param uniform  string texturename
varying  float resolution[3]
varying  float lenx
varying  float leny
varying  color tex


segment Init
	pushif 1
	pushif 0
	pushif 0
	settc
	pop background
	pushis ""
	pop texturename


segment Code
	S_CLEAR
	pushif 1
	pushis "Format"
	option resolution
	eqff
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 0
	pushif 0
	ipushv resolution
	pushv P
	xcomp
	divff
	pop lenx
	pushif 1
	ipushv resolution
	pushv P
	ycomp
	divff
	pop leny
:0
	RS_POP
	S_CLEAR
	pushis ""
	pushv texturename
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 2
	pushv leny
	pushv lenx
	pushif 0
	pushv texturename
	pushif 0
	ctexture2
	pop tex
	pushv tex
	pushv alpha
	pushif 1
	subff
	mulfc
	pushv Ci
	addcc
	pop Ci
:2
	RS_INVERSE
	RS_JZ 1
	pushv background
	pushv alpha
	pushif 1
	subff
	mulfc
	pushv Ci
	addcc
	pop Ci
:1
	RS_POP
	pushif 1
	setfc
	pop Oi
