/** * Construct Java Graphics object which translates graphic calls in ppt Drawing layer. * * @param group The shape group to write the graphics calls into. */ public PPGraphics2D(ShapeGroup group){ this._group = group; _transform = new AffineTransform(); _stroke = new BasicStroke(); _paint = Color.black; _font = new Font("Arial", Font.PLAIN, 12); _background = Color.black; _foreground = Color.white; _hints = new RenderingHints(null); }
/// <summary> /// Constructs a new ColorConvertOp from two ColorSpace objects. /// The RenderingHints argument may be null. /// This Op is primarily useful for calling the filter method on /// Rasters, in which case the two ColorSpaces define the operation /// to be performed on the Rasters. In that case, the number of bands /// in the source Raster must match the number of components in /// srcCspace, and the number of bands in the destination Raster /// must match the number of components in dstCspace. For BufferedImages, /// the two ColorSpaces define intermediate spaces through which the /// source is converted before being converted to the destination space. </summary> /// <param name="srcCspace"> the source <code>ColorSpace</code> </param> /// <param name="dstCspace"> the destination <code>ColorSpace</code> </param> /// <param name="hints"> the <code>RenderingHints</code> object used to control /// the color conversion, or <code>null</code> </param> /// <exception cref="NullPointerException"> if either srcCspace or dstCspace is null </exception> public ColorConvertOp(ColorSpace srcCspace, ColorSpace dstCspace, RenderingHints hints) { if ((srcCspace == null) || (dstCspace == null)) { throw new NullPointerException("ColorSpaces cannot be null"); } if ((srcCspace is ICC_ColorSpace) && (dstCspace is ICC_ColorSpace)) { ProfileList = new ICC_Profile [2]; // 2 profiles in the list ProfileList [0] = ((ICC_ColorSpace)srcCspace).Profile; ProfileList [1] = ((ICC_ColorSpace)dstCspace).Profile; GetMinMaxValsFromColorSpaces(srcCspace, dstCspace); } else { /* non-ICC case: 2 ColorSpaces in list */ CSList = new ColorSpace[2]; CSList[0] = srcCspace; CSList[1] = dstCspace; } this.Hints = hints; }
/// <summary> /// Constructs a new ColorConvertOp which will convert /// from a source color space to a destination color space. /// The RenderingHints argument may be null. /// This Op can be used only with BufferedImages, and will convert /// directly from the ColorSpace of the source image to that of the /// destination. The destination argument of the filter method /// cannot be specified as null. </summary> /// <param name="hints"> the <code>RenderingHints</code> object used to control /// the color conversion, or <code>null</code> </param> public ColorConvertOp(RenderingHints hints) { ProfileList = new ICC_Profile [0]; // 0 length list this.Hints = hints; }
/// <summary> /// Constructor for LinearGradientPaintContext. /// </summary> /// <param name="paint"> the {@code LinearGradientPaint} from which this context /// is created </param> /// <param name="cm"> {@code ColorModel} that receives /// the <code>Paint</code> 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="start"> gradient start point, in user space </param> /// <param name="end"> gradient end point, in user space </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 LinearGradientPaintContext(LinearGradientPaint paint, ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform t, RenderingHints hints, Point2D start, Point2D end, float[] fractions, Color[] colors, CycleMethod cycleMethod, ColorSpaceType colorSpace) : base(paint, cm, deviceBounds, userBounds, t, hints, fractions, colors, cycleMethod, colorSpace) { // A given point in the raster should take on the same color as its // projection onto the gradient vector. // Thus, we want the projection of the current position vector // onto the gradient vector, then normalized with respect to the // length of the gradient vector, giving a value which can be mapped // into the range 0-1. // projection = // currentVector dot gradientVector / length(gradientVector) // normalized = projection / length(gradientVector) float startx = (float)start.X; float starty = (float)start.Y; float endx = (float)end.X; float endy = (float)end.Y; float dx = endx - startx; // change in x from start to end float dy = endy - starty; // change in y from start to end float dSq = dx * dx + dy * dy; // total distance squared // avoid repeated calculations by doing these divides once float constX = dx / dSq; float constY = dy / dSq; // incremental change along gradient for +x DgdX = A00 * constX + A10 * constY; // incremental change along gradient for +y DgdY = A01 * constX + A11 * constY; // constant, incorporates the translation components from the matrix Gc = (A02 - startx) * constX + (A12 - starty) * constY; }
/// <summary> /// Constructs a RenderContext with a given transform and rendering hints. /// The area of interest is taken to be the entire renderable area. /// </summary> /// <param name="usr2dev"> an AffineTransform. </param> /// <param name="hints"> a RenderingHints object containing rendering hints. </param> public RenderContext(AffineTransform usr2dev, RenderingHints hints) : this(usr2dev, null, hints) { }
/** * Replaces the values of all preferences for the rendering * algorithms with the specified <code>hints</code>. * The existing values for all rendering hints are discarded and * the new Set of known hints and values are Initialized from the * specified {@link Map} object. * Hint categories include controls for rendering quality and * overall time/quality trade-off in the rendering Process. * Refer to the <code>RenderingHints</code> class for defInitions of * some common keys and values. * @param hints the rendering hints to be Set * @see RenderingHints */ public void SetRenderingHints(Map hints){ this._hints = new RenderingHints(hints); }
/// <summary> /// Creates and returns a <seealso cref="PaintContext"/> used to /// generate a linear color gradient pattern. /// See the <seealso cref="Paint#createContext specification"/> of the /// method in the <seealso cref="Paint"/> interface for information /// on null parameter handling. /// </summary> /// <param name="cm"> the preferred <seealso cref="ColorModel"/> which represents the most convenient /// format for the caller to receive the pixel data, or {@code null} /// if there is no preference. </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="xform"> the <seealso cref="AffineTransform"/> from user /// space into device space. </param> /// <param name="hints"> the set of hints that the context object can use to /// choose between rendering alternatives. </param> /// <returns> the {@code PaintContext} for /// generating color patterns. </returns> /// <seealso cref= Paint </seealso> /// <seealso cref= PaintContext </seealso> /// <seealso cref= ColorModel </seealso> /// <seealso cref= Rectangle </seealso> /// <seealso cref= Rectangle2D </seealso> /// <seealso cref= AffineTransform </seealso> /// <seealso cref= RenderingHints </seealso> public virtual PaintContext CreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { return(new GradientPaintContext(cm, P1, P2, xform, Color1_Renamed, Color2_Renamed, Cyclic_Renamed)); }
/// <summary> /// Constructs a <code>LookupOp</code> object given the lookup /// table and a <code>RenderingHints</code> object, which might /// be <code>null</code>. </summary> /// <param name="lookup"> the specified <code>LookupTable</code> </param> /// <param name="hints"> the specified <code>RenderingHints</code>, /// or <code>null</code> </param> public LookupOp(LookupTable lookup, RenderingHints hints) { this.Ltable = lookup; this.Hints = hints; NumComponents = Ltable.NumComponents; }
/// <summary> /// Constructs a RenderContext with a given transform. /// </summary> public RenderContext(AffineTransform @usr2dev, Shape @aoi, RenderingHints @hints) { }
/// <summary> /// Creates and returns a <seealso cref="PaintContext"/> used to /// generate a circular radial color gradient pattern. /// See the description of the <seealso cref="Paint#createContext createContext"/> method /// for information on null parameter handling. /// </summary> /// <param name="cm"> the preferred <seealso cref="ColorModel"/> which represents the most convenient /// format for the caller to receive the pixel data, or {@code null} /// if there is no preference. </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="transform"> the <seealso cref="AffineTransform"/> from user /// space into device space. </param> /// <param name="hints"> the set of hints that the context object can use to /// choose between rendering alternatives. </param> /// <returns> the {@code PaintContext} for /// generating color patterns. </returns> /// <seealso cref= Paint </seealso> /// <seealso cref= PaintContext </seealso> /// <seealso cref= ColorModel </seealso> /// <seealso cref= Rectangle </seealso> /// <seealso cref= Rectangle2D </seealso> /// <seealso cref= AffineTransform </seealso> /// <seealso cref= RenderingHints </seealso> public override PaintContext CreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) { // avoid modifying the user's transform... transform = new AffineTransform(transform); // incorporate the gradient transform transform.Concatenate(GradientTransform); return(new RadialGradientPaintContext(this, cm, deviceBounds, userBounds, transform, hints, (float)Center.X, (float)Center.Y, Radius_Renamed, (float)Focus.X, (float)Focus.Y, Fractions_Renamed, Colors_Renamed, CycleMethod_Renamed, ColorSpace_Renamed)); }
/// <summary> /// Sets the rendering hints of this <code>RenderContext</code>. /// </summary> public void setRenderingHints(RenderingHints @hints) { }
public abstract PaintContext CreateContext(image.ColorModel cm, Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform, RenderingHints hints);
// 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(); }
public PaintContext createContext( java.awt.image.ColorModel cm, Rectangle r, java.awt.geom.Rectangle2D r2d, java.awt.geom.AffineTransform xform, RenderingHints rhs ) { if (currentPaintContext != null) { return currentPaintContext; } currentPaintContext = new Color.ColorPaintContext(value); return currentPaintContext; }
/** * Returns the value of a single preference for the rendering algorithms. * Hint categories include controls for rendering quality and overall * time/quality trade-off in the rendering Process. Refer to the * <code>RenderingHints</code> class for defInitions of some common * keys and values. * @param hintKey the key corresponding to the hint to Get. * @return an object representing the value for the specified hint key. * Some of the keys and their associated values are defined in the * <code>RenderingHints</code> class. * @see RenderingHints */ public Object GetRenderingHint(RenderingHints.Key hintKey){ return _hints.Get(hintKey); }
/// <summary> /// Creates and returns a <seealso cref="PaintContext"/> used to /// generate a linear color gradient pattern. /// See the <seealso cref="Paint#createContext specification"/> of the /// method in the <seealso cref="Paint"/> interface for information /// on null parameter handling. /// </summary> /// <param name="cm"> the preferred <seealso cref="ColorModel"/> which represents the most convenient /// format for the caller to receive the pixel data, or {@code null} /// if there is no preference. </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="transform"> the <seealso cref="AffineTransform"/> from user /// space into device space. </param> /// <param name="hints"> the set of hints that the context object can use to /// choose between rendering alternatives. </param> /// <returns> the {@code PaintContext} for /// generating color patterns. </returns> /// <seealso cref= Paint </seealso> /// <seealso cref= PaintContext </seealso> /// <seealso cref= ColorModel </seealso> /// <seealso cref= Rectangle </seealso> /// <seealso cref= Rectangle2D </seealso> /// <seealso cref= AffineTransform </seealso> /// <seealso cref= RenderingHints </seealso> public override PaintContext CreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) { // avoid modifying the user's transform... transform = new AffineTransform(transform); // incorporate the gradient transform transform.Concatenate(GradientTransform); if ((Fractions_Renamed.Length == 2) && (CycleMethod_Renamed != CycleMethod.REPEAT) && (ColorSpace_Renamed == ColorSpaceType.SRGB)) { // faster to use the basic GradientPaintContext for this // common case bool cyclic = (CycleMethod_Renamed != CycleMethod.NO_CYCLE); return(new GradientPaintContext(cm, Start, End, transform, Colors_Renamed[0], Colors_Renamed[1], cyclic)); } else { return(new LinearGradientPaintContext(this, cm, deviceBounds, userBounds, transform, hints, Start, End, Fractions_Renamed, Colors_Renamed, CycleMethod_Renamed, ColorSpace_Renamed)); } }
/** * Sets the value of a single preference for the rendering algorithms. * Hint categories include controls for rendering quality and overall * time/quality trade-off in the rendering Process. Refer to the * <code>RenderingHints</code> class for defInitions of some common * keys and values. * @param hintKey the key of the hint to be Set. * @param hintValue the value indicating preferences for the specified * hint category. * @see RenderingHints */ public void SetRenderingHint(RenderingHints.Key hintKey, Object hintValue){ _hints.Put(hintKey, hintValue); }
/// <summary> /// Constructs a ConvolveOp given a Kernel, an edge condition, and a /// RenderingHints object (which may be null). </summary> /// <param name="kernel"> the specified <code>Kernel</code> </param> /// <param name="edgeCondition"> the specified edge condition </param> /// <param name="hints"> the specified <code>RenderingHints</code> object </param> /// <seealso cref= Kernel </seealso> /// <seealso cref= #EDGE_NO_OP </seealso> /// <seealso cref= #EDGE_ZERO_FILL </seealso> /// <seealso cref= java.awt.RenderingHints </seealso> public ConvolveOp(Kernel kernel, int edgeCondition, RenderingHints hints) { this.Kernel_Renamed = kernel; this.EdgeHint = edgeCondition; this.Hints = hints; }
/// <summary> /// Creates and returns a <seealso cref="PaintContext"/> used to /// generate a tiled image pattern. /// See the <seealso cref="Paint#createContext specification"/> of the /// method in the <seealso cref="Paint"/> interface for information /// on null parameter handling. /// </summary> /// <param name="cm"> the preferred <seealso cref="ColorModel"/> which represents the most convenient /// format for the caller to receive the pixel data, or {@code null} /// if there is no preference. </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="xform"> the <seealso cref="AffineTransform"/> from user /// space into device space. </param> /// <param name="hints"> the set of hints that the context object can use to /// choose between rendering alternatives. </param> /// <returns> the {@code PaintContext} for /// generating color patterns. </returns> /// <seealso cref= Paint </seealso> /// <seealso cref= PaintContext </seealso> /// <seealso cref= ColorModel </seealso> /// <seealso cref= Rectangle </seealso> /// <seealso cref= Rectangle2D </seealso> /// <seealso cref= AffineTransform </seealso> /// <seealso cref= RenderingHints </seealso> public virtual PaintContext CreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { if (xform == null) { xform = new AffineTransform(); } else { xform = (AffineTransform)xform.Clone(); } xform.Translate(Tx, Ty); xform.Scale(Sx, Sy); return(TexturePaintContext.GetContext(BufImg, xform, hints, deviceBounds)); }