Exemplo n.º 1
0
        /// <summary>
        /// Constructs an <CODE>AffineTransformOp</CODE> given an affine transform
        /// and the interpolation type.
        /// </summary>
        /// <param name="xform"> The <CODE>AffineTransform</CODE> to use for the operation. </param>
        /// <param name="interpolationType"> One of the integer
        /// interpolation type constants defined by this class:
        /// <seealso cref="#TYPE_NEAREST_NEIGHBOR TYPE_NEAREST_NEIGHBOR"/>,
        /// <seealso cref="#TYPE_BILINEAR TYPE_BILINEAR"/>,
        /// <seealso cref="#TYPE_BICUBIC TYPE_BICUBIC"/>. </param>
        /// <exception cref="ImagingOpException"> if the transform is non-invertible. </exception>
        public AffineTransformOp(AffineTransform xform, int interpolationType)
        {
            ValidateTransform(xform);
            this.Xform = (AffineTransform)xform.Clone();
            switch (interpolationType)
            {
            case TYPE_NEAREST_NEIGHBOR:
            case TYPE_BILINEAR:
            case TYPE_BICUBIC:
                break;

            default:
                throw new IllegalArgumentException("Unknown interpolation type: " + interpolationType);
            }
            this.InterpolationType_Renamed = interpolationType;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs an <CODE>AffineTransformOp</CODE> given an affine transform.
        /// The interpolation type is determined from the
        /// <CODE>RenderingHints</CODE> object.  If the interpolation hint is
        /// defined, it will be used. Otherwise, if the rendering quality hint is
        /// defined, the interpolation type is determined from its value.  If no
        /// hints are specified (<CODE>hints</CODE> is null),
        /// the interpolation type is {@link #TYPE_NEAREST_NEIGHBOR
        /// TYPE_NEAREST_NEIGHBOR}.
        /// </summary>
        /// <param name="xform"> The <CODE>AffineTransform</CODE> to use for the
        /// operation.
        /// </param>
        /// <param name="hints"> The <CODE>RenderingHints</CODE> object used to specify
        /// the interpolation type for the operation.
        /// </param>
        /// <exception cref="ImagingOpException"> if the transform is non-invertible. </exception>
        /// <seealso cref= java.awt.RenderingHints#KEY_INTERPOLATION </seealso>
        /// <seealso cref= java.awt.RenderingHints#KEY_RENDERING </seealso>
        public AffineTransformOp(AffineTransform xform, RenderingHints hints)
        {
            ValidateTransform(xform);
            this.Xform = (AffineTransform)xform.Clone();
            this.Hints = hints;

            if (hints != null)
            {
                Object value = hints[hints.KEY_INTERPOLATION];
                if (value == null)
                {
                    value = hints[hints.KEY_RENDERING];
                    if (value == hints.VALUE_RENDER_SPEED)
                    {
                        InterpolationType_Renamed = TYPE_NEAREST_NEIGHBOR;
                    }
                    else if (value == hints.VALUE_RENDER_QUALITY)
                    {
                        InterpolationType_Renamed = TYPE_BILINEAR;
                    }
                }
                else if (value == hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)
                {
                    InterpolationType_Renamed = TYPE_NEAREST_NEIGHBOR;
                }
                else if (value == hints.VALUE_INTERPOLATION_BILINEAR)
                {
                    InterpolationType_Renamed = TYPE_BILINEAR;
                }
                else if (value == hints.VALUE_INTERPOLATION_BICUBIC)
                {
                    InterpolationType_Renamed = TYPE_BICUBIC;
                }
            }
            else
            {
                InterpolationType_Renamed = TYPE_NEAREST_NEIGHBOR;
            }
        }
Exemplo n.º 3
0
        // Various constructors that allow different levels of
        // specificity. If the Shape is missing the whole renderable area
        // is assumed. If hints is missing no hints are assumed.

        /// <summary>
        /// Constructs a RenderContext with a given transform.
        /// The area of interest is supplied as a Shape,
        /// and the rendering hints are supplied as a RenderingHints object.
        /// </summary>
        /// <param name="usr2dev"> an AffineTransform. </param>
        /// <param name="aoi"> a Shape representing the area of interest. </param>
        /// <param name="hints"> a RenderingHints object containing rendering hints. </param>
        public RenderContext(AffineTransform usr2dev, Shape aoi, RenderingHints hints)
        {
            this.Hints   = hints;
            this.Aoi     = aoi;
            this.Usr2dev = (AffineTransform)usr2dev.Clone();
        }