Java 类org.w3c.dom.svg.SVGPreserveAspectRatio 实例源码

项目:jasperreports    文件:BatikRenderer.java   
@Override
public void render(JasperReportsContext jasperReportsContext, Graphics2D grx, Rectangle2D rectangle) throws JRException
{
    ensureSvg(jasperReportsContext);

    AffineTransform transform = ViewBox.getPreserveAspectRatioTransform(
            new float[]{0, 0, (float) documentSize.getWidth(), (float) documentSize.getHeight()},
            SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE, true,
            (float) rectangle.getWidth(), (float) rectangle.getHeight());
    Graphics2D graphics = (Graphics2D) grx.create();
    try
    {
        graphics.translate(rectangle.getX(), rectangle.getY());
        graphics.transform(transform);

        // CompositeGraphicsNode not thread safe
        synchronized (rootNode)
        {
            rootNode.paint(graphics);
        }
    }
    finally
    {
        graphics.dispose();
    }
}
项目:Push2Display    文件:ViewBox.java   
/**
 * Returns the transformation matrix to apply to initalize a viewport or
 * null if the specified viewBox disables the rendering of the element.
 *
 * @param e the element with a viewbox
 * @param vb the viewBox definition as float
 * @param w the width of the effective viewport
 * @param h The height of the effective viewport
 * @param aPAR The animated preserveAspectRatio value
 * @param ctx The BridgeContext to use for error information
 */
public static AffineTransform getPreserveAspectRatioTransform
        (Element e, float[] vb, float w, float h,
         SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) {

    // 'preserveAspectRatio' attribute
    try {
        SVGPreserveAspectRatio pAR = aPAR.getAnimVal();
        short align = pAR.getAlign();
        boolean meet = pAR.getMeetOrSlice() ==
            SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
        return getPreserveAspectRatioTransform(vb, align, meet, w, h);
    } catch (LiveAttributeException ex) {
        throw new BridgeException(ctx, ex);
    }
}
项目:Push2Display    文件:ViewBox.java   
/**
 * Returns the transformation matrix to apply to initalize a viewport or
 * null if the specified viewBox disables the rendering of the element.
 *
 * @param e the element with a viewbox
 * @param vb the viewBox definition as float
 * @param w the width of the effective viewport
 * @param h The height of the effective viewport
 * @param aPAR The animated preserveAspectRatio value
 * @param ctx The BridgeContext to use for error information
 */
public static AffineTransform getPreserveAspectRatioTransform
        (Element e, float[] vb, float w, float h,
         SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) {

    // 'preserveAspectRatio' attribute
    try {
        SVGPreserveAspectRatio pAR = aPAR.getAnimVal();
        short align = pAR.getAlign();
        boolean meet = pAR.getMeetOrSlice() ==
            SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
        return getPreserveAspectRatioTransform(vb, align, meet, w, h);
    } catch (LiveAttributeException ex) {
        throw new BridgeException(ctx, ex);
    }
}
项目:feathers-sdk    文件:ViewBox.java   
/**
 * Returns the transformation matrix to apply to initalize a viewport or
 * null if the specified viewBox disables the rendering of the element.
 *
 * @param e the element with a viewbox
 * @param vb the viewBox definition as float
 * @param w the width of the effective viewport
 * @param h The height of the effective viewport
 * @param aPAR The animated preserveAspectRatio value
 * @param ctx The BridgeContext to use for error information
 */
public static AffineTransform getPreserveAspectRatioTransform
        (Element e, float[] vb, float w, float h,
         SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) {

    // 'preserveAspectRatio' attribute
    try {
        SVGPreserveAspectRatio pAR = aPAR.getAnimVal();
        short align = pAR.getAlign();
        boolean meet = pAR.getMeetOrSlice() ==
            SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
        return getPreserveAspectRatioTransform(vb, align, meet, w, h);
    } catch (LiveAttributeException ex) {
        throw new BridgeException(ctx, ex);
    }
}
项目:jasperreports    文件:AbstractSvgDataToGraphics2DRenderer.java   
@Override
public void render(JasperReportsContext jasperReportsContext, Graphics2D grx, Rectangle2D rectangle) throws JRException
{
    GraphicsNode rootNode = getRootNode(jasperReportsContext);

    AffineTransform transform = 
        ViewBox.getPreserveAspectRatioTransform(
            new float[]{0, 0, (float) documentSize.getWidth(), (float) documentSize.getHeight()},
            SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE, 
            true,
            (float) rectangle.getWidth(), 
            (float) rectangle.getHeight()
            );
    Graphics2D graphics = (Graphics2D) grx.create();
    try
    {
        graphics.translate(rectangle.getX(), rectangle.getY());
        graphics.transform(transform);

        // CompositeGraphicsNode not thread safe
        synchronized (rootNode)
        {
            rootNode.paint(graphics);
        }
    }
    finally
    {
        graphics.dispose();
    }
}
项目:Push2Display    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getBaseVal()}.
 */
public SVGPreserveAspectRatio getBaseVal() {
    if (baseVal == null) {
        baseVal = new BaseSVGPARValue();
    }
    return baseVal;
}
项目:Push2Display    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getAnimVal()}.
 */
public SVGPreserveAspectRatio getAnimVal() {
    if (animVal == null) {
        animVal = new AnimSVGPARValue();
    }
    return animVal;
}
项目:Push2Display    文件:AnimatablePreserveAspectRatioValue.java   
/**
 * Returns a string representation of this object.
 */
public String toStringRep() {
    if (align < 1 || align > 10) {
        return null;
    }
    String value = ALIGN_VALUES[align];
    if (align == SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE) {
        return value;
    }
    if (meetOrSlice < 1 || meetOrSlice > 2) {
        return null;
    }
    return value + ' ' + MEET_OR_SLICE_VALUES[meetOrSlice];
}
项目:Push2Display    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getBaseVal()}.
 */
public SVGPreserveAspectRatio getBaseVal() {
    if (baseVal == null) {
        baseVal = new BaseSVGPARValue();
    }
    return baseVal;
}
项目:Push2Display    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getAnimVal()}.
 */
public SVGPreserveAspectRatio getAnimVal() {
    if (animVal == null) {
        animVal = new AnimSVGPARValue();
    }
    return animVal;
}
项目:Push2Display    文件:AnimatablePreserveAspectRatioValue.java   
/**
 * Returns a string representation of this object.
 */
public String toStringRep() {
    if (align < 1 || align > 10) {
        return null;
    }
    String value = ALIGN_VALUES[align];
    if (align == SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE) {
        return value;
    }
    if (meetOrSlice < 1 || meetOrSlice > 2) {
        return null;
    }
    return value + ' ' + MEET_OR_SLICE_VALUES[meetOrSlice];
}
项目:feathers-sdk    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getBaseVal()}.
 */
public SVGPreserveAspectRatio getBaseVal() {
    if (baseVal == null) {
        baseVal = new BaseSVGPARValue();
    }
    return baseVal;
}
项目:feathers-sdk    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * <b>DOM</b>: Implements {@link SVGAnimatedPreserveAspectRatio#getAnimVal()}.
 */
public SVGPreserveAspectRatio getAnimVal() {
    if (animVal == null) {
        animVal = new AnimSVGPARValue();
    }
    return animVal;
}
项目:feathers-sdk    文件:AnimatablePreserveAspectRatioValue.java   
/**
 * Returns a string representation of this object.
 */
public String toStringRep() {
    if (align < 1 || align > 10) {
        return null;
    }
    String value = ALIGN_VALUES[align];
    if (align == SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE) {
        return value;
    }
    if (meetOrSlice < 1 || meetOrSlice > 2) {
        return null;
    }
    return value + ' ' + MEET_OR_SLICE_VALUES[meetOrSlice];
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link
 * PreserveAspectRatioHandler#startPreserveAspectRatio()}.
 */
public void startPreserveAspectRatio() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_UNKNOWN;
    meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#none()}.
 */
public void none() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMaxYMax()}.
 */
public void xMaxYMax() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMaxYMid()}.
 */
public void xMaxYMid() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMaxYMin()}.
 */
public void xMaxYMin() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMidYMax()}.
 */
public void xMidYMax() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMidYMid()}.
 */
public void xMidYMid() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMidYMin()}.
 */
public void xMidYMin() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMinYMax()}.
 */
public void xMinYMax() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMinYMid()}.
 */
public void xMinYMid() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMinYMin()}.
 */
public void xMinYMin() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#meet()}.
 */
public void meet() throws ParseException {
    meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#slice()}.
 */
public void slice() throws ParseException {
    meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE;
}
项目:Push2Display    文件:AbstractSVGPreserveAspectRatio.java   
public void reset() {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
    meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
    //setAttributeValue(getValueAsString());
}
项目:Push2Display    文件:SVGOMAnimatedPreserveAspectRatio.java   
/**
 * Returns the base value of the attribute as an {@link AnimatableValue}.
 */
public AnimatableValue getUnderlyingValue(AnimationTarget target) {
    SVGPreserveAspectRatio par = getBaseVal();
    return new AnimatablePreserveAspectRatioValue(target, par.getAlign(),
                                                  par.getMeetOrSlice());
}
项目:Push2Display    文件:AnimatablePreserveAspectRatioValue.java   
/**
 * Returns a zero value of this AnimatableValue's type.
 */
public AnimatableValue getZeroValue() {
    return new AnimatablePreserveAspectRatioValue
        (target, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE,
         SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET);
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link
 * PreserveAspectRatioHandler#startPreserveAspectRatio()}.
 */
public void startPreserveAspectRatio() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_UNKNOWN;
    meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#none()}.
 */
public void none() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMaxYMax()}.
 */
public void xMaxYMax() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMaxYMid()}.
 */
public void xMaxYMid() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMaxYMin()}.
 */
public void xMaxYMin() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMidYMax()}.
 */
public void xMidYMax() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMidYMid()}.
 */
public void xMidYMid() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMidYMin()}.
 */
public void xMidYMin() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMinYMax()}.
 */
public void xMinYMax() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX;
}
项目:Push2Display    文件:SVGAnimationEngine.java   
/**
 * Implements {@link PreserveAspectRatioHandler#xMinYMid()}.
 */
public void xMinYMid() throws ParseException {
    align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID;
}