<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="jit.chromakey" module="jit" category="Jitter Compositing">
	<digest>
		Key images based on chromatic distance
	</digest>
	<description>
		Produces an chromakey effect based on a reference color. Tolerance and fade settings allow for control over the resulting combined image. An alternate mode outputs a matrix with the keying values, which can be used by other Jitter objects.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Jitter
		</metadata>
		<metadata name="tag">
			Jitter Compositing
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="matrix">
			<digest>
				in
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="matrix">
			<digest>
				in2
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="matrix">
			<digest>
				out
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="matrix">
			<digest>
				dumpout
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--MOP-->
	<mop matrixinputcount="2" matrixoutputcount="1">
		<matrixinput name="in2" planelink="1" typelink="1" dimlink="1" minplanecount="1" maxplanecount="32" mindimcount="1" maxdimcount="32" ioproc="resamp">
			<types>
				char long float32 float64
			</types>
		</matrixinput>
		<matrixoutput name="out" planelink="1" typelink="1" dimlink="1" minplanecount="1" maxplanecount="32" mindimcount="1" maxdimcount="32">
			<types>
				char long float32 float64
			</types>
		</matrixoutput>
	</mop>
	<!--MESSAGES-->
	<jittermethodlist>
		<jittermethod name="bang" />
		<jittermethod name="clear" />
		<jittermethod name="exportattrs" />
		<jittermethod name="exportsummary" />
		<jittermethod name="getattributes" />
		<jittermethod name="getstate" />
		<jittermethod name="jit_matrix" />
		<jittermethod name="importattrs" />
		<jittermethod name="outputmatrix" />
		<jittermethod name="summary" />
	</jittermethodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="alphaignore" get="1" set="1" type="int" size="1">
			<digest>
				Ignore alpha channel
			</digest>
			<description>
				Ignore alpha channel flag (default = 1)
				<br />
				0 = use alpha channel (plane 0) when calculating chromatic distance
				<br />
				1 = ignore alpha channel (plane 0) when calculating chromatic distance
				<br />
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Ignore Alpha Channel" />
			</attributelist>
		</attribute>
		<attribute name="color" get="1" set="1" type="float" size="32">
			<digest>
				Reference color
			</digest>
			<description>
				The reference color to be used for keying (default = all 0.)
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Target Color" />
			</attributelist>
		</attribute>
		<attribute name="fade" get="1" set="1" type="float" size="1">
			<digest>
				Fade amount
			</digest>
			<description>
				The amount of fade (default = 0.)
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Fade" />
			</attributelist>
		</attribute>
		<attribute name="maxkey" get="1" set="1" type="float" size="1">
			<digest>
				Maximum keying value
			</digest>
			<description>
				The maximum keying value (default = 1.)
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Maximum Key Value" />
			</attributelist>
		</attribute>
		<attribute name="minkey" get="1" set="1" type="float" size="1">
			<digest>
				The minimum keying value (default = 0.)
			</digest>
			<description>
				Minimum keying value
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Minimum Key Value" />
			</attributelist>
		</attribute>
		<attribute name="mode" get="1" set="1" type="int" size="1">
			<digest>
				Output mode
			</digest>
			<description>
				Output mode (default = 0)
				<br />
				0 = perform keying and output matrix
				<br />
				1 = output the key map for use elsewhere
				<br />
				2 = alpha contains key map, other planes are from left input
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="Composite">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Key Map in All Channels">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Key Map in Alpha">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Keying Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
		<attribute name="tol" get="1" set="1" type="float" size="1">
			<digest>
				Tolerance
			</digest>
			<description>
				The tolerated distance -- the range of variance from which an input cell's absolute value can diverge when calculating keying (default = 0.)
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="atom" size="1" value="1" />
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Behavior" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Tolerance" />
			</attributelist>
		</attribute>
	</attributelist>
	<jitterattributelist>
		<jitterattribute name="outputmode" />
		<jitterattribute name="adapt" />
		<jitterattribute name="in2_name" />
		<jitterattribute name="in2_type" />
		<jitterattribute name="in2_dim" />
		<jitterattribute name="in2_planecount" />
		<jitterattribute name="out_name" />
		<jitterattribute name="type" />
		<jitterattribute name="dim" />
		<jitterattribute name="planecount" />
	</jitterattributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="jit.chromakey.png" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="jit.alphablend" />
		<seealso name="jit.keyscreen" />
		<seealso name="jit.lumakey" />
		<seealso name="jit.op" />
		<seealso name="jitterchapter10" module="jit" type="tutorial" />
	</seealsolist>
	<discussion>
		The <o>jit.chromakey</o> object measures the chromatic distance of each of the left input's cells (pixels) with a reference color (a.k.a &quot;green screening&quot;). The total chromatic distance is calculated by summing the absolute value of each color channel's distance from the reference color's corresponding color channel.
		<p>
			If the distance is less than or equal to a tolerated distance (<m>tol</m>) value, the right input cell is multiplied by a maximum keying (<m>maxkey</m>) value.
		</p>
		<p>
			If the distance is greater than the tolerated distance but less than the sum of the tolerated value and a set fade value (<m>fade</m>) an interpolated value between the some value between <m>minkey</m> and <m>maxkey</m> values is applied.
		</p>
		<p>
			For values whose distance is greater than the sum of the tolerated and fade values, the right input cell is multiplied by the <m>minkey</m> value.
		</p>
		<p>
			The left input is always multiplied by the additive inverse of the left input's multiplicand.
		</p>
		<p>
			The <o>jit.chromakey</o> object has two modes of output; the first keys between the two input sources, and the second mode will output the keying values (i.e., the left input multiplicands) rather than applying the keying -- the left input is ignored. This is useful for outputting keying information for use with other Jitter objects. Keying can be inverted by swapping the <m>minkey</m> and <m>maxkey</m> values.
		</p>
	</discussion>
</c74object>
