Esempio n. 1
0
 protected virtual awt.PaintContext createContextInternal(image.ColorModel cm,
                                                          awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
                                                          awt.RenderingHints hints)
 {
     Matrix.Multiply(xform, _brushTransform.NativeObject, MatrixOrder.Append);
     return(NativeObject.createContext(cm, deviceBounds, userBounds, xform, hints));
 }
		/// <summary>
		/// Constructs a RenderContext with a given transform.
		/// </summary>
		public RenderContext(AffineTransform @usr2dev, Shape @aoi, RenderingHints @hints)
		{
		}
Esempio n. 3
0
 awt.PaintContext awt.Paint.createContext(image.ColorModel cm,
                                          awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
                                          awt.RenderingHints hints)
 {
     return(createContextInternal(cm, deviceBounds, userBounds, xform, hints));
 }
        public static PaintContext GetContext(BufferedImage bufImg, AffineTransform xform, RenderingHints hints, Rectangle devBounds)
        {
            WritableRaster raster = bufImg.Raster;
            ColorModel     cm     = bufImg.ColorModel;
            int            maxw   = devBounds.Width_Renamed;
            Object         val    = hints[RenderingHints.KEY_INTERPOLATION];
            bool           filter = (val == null ? (hints[RenderingHints.KEY_RENDERING] == RenderingHints.VALUE_RENDER_QUALITY) : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));

            if (raster is IntegerInterleavedRaster && (!filter || IsFilterableDCM(cm)))
            {
                IntegerInterleavedRaster iir = (IntegerInterleavedRaster)raster;
                if (iir.NumDataElements == 1 && iir.PixelStride == 1)
                {
                    return(new Int(iir, cm, xform, maxw, filter));
                }
            }
            else if (raster is ByteInterleavedRaster)
            {
                ByteInterleavedRaster bir = (ByteInterleavedRaster)raster;
                if (bir.NumDataElements == 1 && bir.PixelStride == 1)
                {
                    if (filter)
                    {
                        if (IsFilterableICM(cm))
                        {
                            return(new ByteFilter(bir, cm, xform, maxw));
                        }
                    }
                    else
                    {
                        return(new Byte(bir, cm, xform, maxw));
                    }
                }
            }
            return(new Any(raster, cm, xform, maxw, filter));
        }
		/// <summary>
		/// Sets the rendering hints of this <code>RenderContext</code>.
		/// </summary>
		public void setRenderingHints(RenderingHints @hints)
		{
		}
		/// <summary>
		/// Constructs a new object with the specified key/value pair.
		/// </summary>
		public RenderingHints(RenderingHints.Key @key, object @value)
		{
		}
		/// <summary>
		/// Adds all of the keys and corresponding values from the specified
		/// <code>RenderingHints</code> object to this
		/// <code>RenderingHints</code> object.
		/// </summary>
		public void add(RenderingHints @hints)
		{
		}
Esempio n. 8
0
		/// <summary>
		/// Sets the value of a single preference for the rendering algorithms.
		/// </summary>
		abstract public void setRenderingHint(RenderingHints.Key @hintKey, object @hintValue);
Esempio n. 9
0
 public JFreeChart(string title, Font titleFont, Plot plot, bool createLegend)
 {
   int num = createLegend ? 1 : 0;
   base.\u002Ector();
   JFreeChart jfreeChart = this;
   this.backgroundImageAlignment = 15;
   this.backgroundImageAlpha = 0.5f;
   if (plot == null)
   {
     string str = "Null 'plot' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new NullPointerException(str);
   }
   else
   {
     this.progressListeners = new EventListenerList();
     this.changeListeners = new EventListenerList();
     this.notify = true;
     RenderingHints.__\u003Cclinit\u003E();
     this.renderingHints = new RenderingHints((RenderingHints.Key) RenderingHints.KEY_ANTIALIASING, (object) RenderingHints.VALUE_ANTIALIAS_ON);
     this.borderVisible = false;
     this.borderStroke = (Stroke) new BasicStroke(1f);
     this.borderPaint = (Paint) Color.black;
     this.padding = RectangleInsets.__\u003C\u003EZERO_INSETS;
     this.plot = plot;
     plot.addChangeListener((PlotChangeListener) this);
     this.subtitles = (List) new ArrayList();
     if (num != 0)
     {
       LegendTitle.__\u003Cclinit\u003E();
       LegendTitle legendTitle = new LegendTitle((LegendItemSource) this.plot);
       legendTitle.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
       legendTitle.setFrame((BlockFrame) new LineBorder());
       legendTitle.setBackgroundPaint((Paint) Color.white);
       legendTitle.setPosition(RectangleEdge.__\u003C\u003EBOTTOM);
       this.subtitles.add((object) legendTitle);
       legendTitle.addChangeListener((TitleChangeListener) this);
     }
     if (title != null)
     {
       if (titleFont == null)
         titleFont = JFreeChart.__\u003C\u003EDEFAULT_TITLE_FONT;
       this.title = new TextTitle(title, titleFont);
       this.title.addChangeListener((TitleChangeListener) this);
     }
     this.backgroundPaint = JFreeChart.__\u003C\u003EDEFAULT_BACKGROUND_PAINT;
     this.backgroundImage = JFreeChart.__\u003C\u003EDEFAULT_BACKGROUND_IMAGE;
     this.backgroundImageAlignment = 15;
     this.backgroundImageAlpha = 0.5f;
   }
 }
Esempio n. 10
0
		/// <summary>
		/// Returns the value of a single preference for the rendering algorithms.
		/// </summary>
		public object getRenderingHint(RenderingHints.Key @hintKey)
		{
			return default(object);
		}
        /// <summary>
        /// Constructor for RadialGradientPaintContext.
        /// </summary>
        /// <param name="paint"> the {@code RadialGradientPaint} from which this context
        ///              is created </param>
        /// <param name="cm"> the {@code ColorModel} that receives
        ///           the {@code Paint} data (this is used only as a hint) </param>
        /// <param name="deviceBounds"> the device space bounding box of the
        ///                     graphics primitive being rendered </param>
        /// <param name="userBounds"> the user space bounding box of the
        ///                   graphics primitive being rendered </param>
        /// <param name="t"> the {@code AffineTransform} from user
        ///          space into device space (gradientTransform should be
        ///          concatenated with this) </param>
        /// <param name="hints"> the hints that the context object uses to choose
        ///              between rendering alternatives </param>
        /// <param name="cx"> the center X coordinate in user space of the circle defining
        ///           the gradient.  The last color of the gradient is mapped to
        ///           the perimeter of this circle. </param>
        /// <param name="cy"> the center Y coordinate in user space of the circle defining
        ///           the gradient.  The last color of the gradient is mapped to
        ///           the perimeter of this circle. </param>
        /// <param name="r"> the radius of the circle defining the extents of the
        ///          color gradient </param>
        /// <param name="fx"> the X coordinate in user space to which the first color
        ///           is mapped </param>
        /// <param name="fy"> the Y coordinate in user space to which the first color
        ///           is mapped </param>
        /// <param name="fractions"> the fractions specifying the gradient distribution </param>
        /// <param name="colors"> the gradient colors </param>
        /// <param name="cycleMethod"> either NO_CYCLE, REFLECT, or REPEAT </param>
        /// <param name="colorSpace"> which colorspace to use for interpolation,
        ///                   either SRGB or LINEAR_RGB </param>
        internal RadialGradientPaintContext(RadialGradientPaint paint, ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform t, RenderingHints hints, float cx, float cy, float r, float fx, float fy, float[] fractions, Color[] colors, CycleMethod cycleMethod, ColorSpaceType colorSpace) : base(paint, cm, deviceBounds, userBounds, t, hints, fractions, colors, cycleMethod, colorSpace)
        {
            // copy some parameters
            CenterX = cx;
            CenterY = cy;
            FocusX  = fx;
            FocusY  = fy;
            Radius  = r;

            this.IsSimpleFocus = (FocusX == CenterX) && (FocusY == CenterY);
            this.IsNonCyclic   = (cycleMethod == CycleMethod.NO_CYCLE);

            // for use in the quadractic equation
            RadiusSq = Radius * Radius;

            float dX = FocusX - CenterX;
            float dY = FocusY - CenterY;

            double distSq = (dX * dX) + (dY * dY);

            // test if distance from focus to center is greater than the radius
            if (distSq > RadiusSq * SCALEBACK)
            {
                // clamp focus to radius
                float scalefactor = (float)System.Math.Sqrt(RadiusSq * SCALEBACK / distSq);
                dX     = dX * scalefactor;
                dY     = dY * scalefactor;
                FocusX = CenterX + dX;
                FocusY = CenterY + dY;
            }

            // calculate the solution to be used in the case where X == focusX
            // in cyclicCircularGradientFillRaster()
            Trivial = (float)System.Math.Sqrt(RadiusSq - (dX * dX));

            // constant parts of X, Y user space coordinates
            ConstA = A02 - CenterX;
            ConstB = A12 - CenterY;

            // constant second order delta for simple loop
            GDeltaDelta = 2 * (A00 * A00 + A10 * A10) / RadiusSq;
        }
Esempio n. 12
0
 /// <summary>
 /// Adds all of the keys and corresponding values from the specified
 /// <code>RenderingHints</code> object to this
 /// <code>RenderingHints</code> object.
 /// </summary>
 public void add(RenderingHints @hints)
 {
 }
        /// <summary>
        /// Constructor for MultipleGradientPaintContext superclass.
        /// </summary>
        protected internal MultipleGradientPaintContext(MultipleGradientPaint mgp, ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform t, RenderingHints hints, float[] fractions, Color[] colors, CycleMethod cycleMethod, ColorSpaceType colorSpace)
        {
            if (deviceBounds == null)
            {
                throw new NullPointerException("Device bounds cannot be null");
            }

            if (userBounds == null)
            {
                throw new NullPointerException("User bounds cannot be null");
            }

            if (t == null)
            {
                throw new NullPointerException("Transform cannot be null");
            }

            if (hints == null)
            {
                throw new NullPointerException("RenderingHints cannot be null");
            }

            // The inverse transform is needed to go from device to user space.
            // Get all the components of the inverse transform matrix.
            AffineTransform tInv;

            try
            {
                // the following assumes that the caller has copied the incoming
                // transform and is not concerned about it being modified
                t.Invert();
                tInv = t;
            }
            catch (NoninvertibleTransformException)
            {
                // just use identity transform in this case; better to show
                // (incorrect) results than to throw an exception and/or no-op
                tInv = new AffineTransform();
            }
            double[] m = new double[6];
            tInv.GetMatrix(m);
            A00 = (float)m[0];
            A10 = (float)m[1];
            A01 = (float)m[2];
            A11 = (float)m[3];
            A02 = (float)m[4];
            A12 = (float)m[5];

            // copy some flags
            this.CycleMethod = cycleMethod;
            this.ColorSpace  = colorSpace;

            // we can avoid copying this array since we do not modify its values
            this.Fractions = fractions;

            // note that only one of these values can ever be non-null (we either
            // store the fast gradient array or the slow one, but never both
            // at the same time)
            int[]   gradient  = (mgp.Gradient != null) ? mgp.Gradient.get() : null;
            int[][] gradients = (mgp.Gradients != null) ? mgp.Gradients.get() : null;

            if (gradient == null && gradients == null)
            {
                // we need to (re)create the appropriate values
                CalculateLookupData(colors);

                // now cache the calculated values in the
                // MultipleGradientPaint instance for future use
                mgp.Model = this.Model;
                mgp.NormalizedIntervals = this.NormalizedIntervals;
                mgp.IsSimpleLookup      = this.IsSimpleLookup;
                if (IsSimpleLookup)
                {
                    // only cache the fast array
                    mgp.FastGradientArraySize = this.FastGradientArraySize;
                    mgp.Gradient = new SoftReference <int[]>(this.Gradient);
                }
                else
                {
                    // only cache the slow array
                    mgp.Gradients = new SoftReference <int[][]>(this.Gradients);
                }
            }
            else
            {
                // use the values cached in the MultipleGradientPaint instance
                this.Model = mgp.Model;
                this.NormalizedIntervals   = mgp.NormalizedIntervals;
                this.IsSimpleLookup        = mgp.IsSimpleLookup;
                this.Gradient              = gradient;
                this.FastGradientArraySize = mgp.FastGradientArraySize;
                this.Gradients             = gradients;
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Creates a context for the compositing operation.
 /// The context contains state that is used in performing
 /// the compositing operation. </summary>
 /// <param name="srcColorModel">  the <seealso cref="ColorModel"/> of the source </param>
 /// <param name="dstColorModel">  the <code>ColorModel</code> of the destination </param>
 /// <returns> the <code>CompositeContext</code> object to be used to perform
 /// compositing operations. </returns>
 public CompositeContext CreateContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints)
 {
     return(new SunCompositeContext(this, srcColorModel, dstColorModel));
 }