Examples of Gradient


Examples of com.sun.star.awt.Gradient

     
      /* apply a gradient fill style that goes from top left to bottom
         right and is changing its color from green to yellow */
      xPropSet.setPropertyValue( "FillStyle",
                                       com.sun.star.drawing.FillStyle.GRADIENT );
      Gradient aGradient = new Gradient();
      aGradient.Style = GradientStyle.LINEAR;
      aGradient.StartColor = 0x00ff00;
      aGradient.EndColor = 0xffff00;
      aGradient.Angle = 450;
      aGradient.Border = 0;
View Full Code Here

Examples of com.sun.star.awt.Gradient

     
      /* apply a gradient fill style that goes from top left to bottom
         right and is changing its color from green to yellow */
      xPropSet.setPropertyValue( "FillStyle",
                                       com.sun.star.drawing.FillStyle.GRADIENT );
      Gradient aGradient = new Gradient();
      aGradient.Style = GradientStyle.LINEAR;
      aGradient.StartColor = 0x00ff00;
      aGradient.EndColor = 0xffff00;
      aGradient.Angle = 450;
      aGradient.Border = 0;
View Full Code Here

Examples of com.sun.star.awt.Gradient

                if(isModifyColorsProp()){
                    setColorSettingsOfShape(xShape, "EllipseShape");
                }else{
                    FillStyle fillStyle = (FillStyle)xProp.getPropertyValue("FillStyle");
                    if(fillStyle == FillStyle.GRADIENT){
                        Gradient gradient = (Gradient)xProp.getPropertyValue("FillGradient");
                        if(m_IsLeftLayout)
                            setGradient(xShape, GradientStyle.RADIAL, gradient.StartColor, gradient.EndColor, (short)0, (short)0, (short)30, (short)50, (short)100, (short)100);
                        else
                            setGradient(xShape, GradientStyle.RADIAL, gradient.StartColor, gradient.EndColor, (short)0, (short)0, (short)50, (short)50, (short)100, (short)100);
                    }
View Full Code Here

Examples of com.sun.star.awt.Gradient

    public void initArrowShapeColor(){
        XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, getArrowShape());
        try {
            FillStyle fillStyle = (FillStyle)xProps.getPropertyValue("FillStyle");
            if(fillStyle.getValue() == FillStyle.GRADIENT_value){
                Gradient gradient = (Gradient)xProps.getPropertyValue("FillGradient");
                setArrowShapeColorProp(gradient.EndColor);
            }
            if(fillStyle.getValue() == FillStyle.SOLID_value)
                setArrowShapeColorProp(AnyConverter.toInt(xProps.getPropertyValue("FillColor")));
        } catch (Exception ex) {
View Full Code Here

Examples of com.sun.star.awt.Gradient

                xProp.setPropertyValue("CornerRadius", new Integer(600));

                getGui().disableControlDialogImageColor();

                xProp.setPropertyValue("FillStyle", FillStyle.GRADIENT);
                Gradient aGradient = new Gradient();
                aGradient.Style = GradientStyle.LINEAR;
                aGradient.StartColor = _startColor;
                aGradient.EndColor = _endColor;
                aGradient.Angle = 450;
                aGradient.Border = 0;
                aGradient.XOffset = 0;
                aGradient.YOffset = 0;
                aGradient.StartIntensity = 100;
                aGradient.EndIntensity = 100;
                aGradient.StepCount = 10;
                xProp.setPropertyValue("FillGradient", aGradient);
            }else if( m_Style == USER_DEFINE){
                if(!m_IsGradients){
                    xProp.setPropertyValue("FillStyle", FillStyle.SOLID);
                    xProp.setPropertyValue("FillColor", new Integer(m_iColor));
                }else{
                    getGui().disableControlDialogImageColor();
                    xProp.setPropertyValue("FillStyle", FillStyle.GRADIENT);
                    Gradient aGradient = new Gradient();
                    aGradient.Style = GradientStyle.LINEAR;
                    aGradient.StartColor = m_iStartColor;
                    aGradient.EndColor = m_iEndColor;
                    aGradient.Angle = 450;
                    aGradient.Border = 0;
View Full Code Here

Examples of com.sun.star.awt.Gradient

    public void setGradient(XShape xShape, GradientStyle gradientStyle, int startColor, int endColor, short angle, short border, short xOffset, short yOffset, short startIntensity, short endIntensity){
        XPropertySet xProp = null;
        try {
            xProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xShape);
            xProp.setPropertyValue("FillStyle", FillStyle.GRADIENT);
            Gradient aGradient = new Gradient();
            aGradient.Style = gradientStyle;
            aGradient.StartColor = startColor;
            aGradient.EndColor = endColor;
            aGradient.Angle = angle;
            aGradient.Border = border;
View Full Code Here

Examples of com.sun.star.awt.Gradient

        try {
            if (isSimpleColorMode()){
                setColorProp(AnyConverter.toInt(xProps.getPropertyValue("FillColor")));
            }
            if(isGradientColorMode()){
                Gradient aGradient = (Gradient)xProps.getPropertyValue("FillGradient");
                setStartColorProp(aGradient.StartColor);
                setEndColorProp(aGradient.EndColor);
                if(aGradient.Angle == 900)
                    setGradientDirectionProp(Diagram.HORIZONTAL);
            }
View Full Code Here

Examples of flash.swf.types.Gradient

        return s;
    }

    private Gradient decodeGradient(int shape, int filltype) throws IOException
    {
        Gradient gradient = (filltype == FillStyle.FILL_FOCAL_RADIAL_GRADIENT)? new FocalGradient() : new Gradient();
        r.syncBits();
        gradient.spreadMode = r.readUBits( 2 );
        gradient.interpolationMode = r.readUBits( 2 );
        int count = r.readUBits( 4 );
        gradient.records = new GradRecord[count];
View Full Code Here

Examples of flash.swf.types.Gradient

        return matrix;
    }

    private Gradient parseGradient(String s, boolean hasAlpha)
    {
        Gradient gradient = new Gradient(); // todo - support focal

        // todo add error checking
        //    count must be 1..8
        //    number of parts must be even
        //    ratio must be 0..255
View Full Code Here

Examples of flash.swf.types.Gradient

        fs = new FillStyle();
        fs.matrix = MatrixBuilder.build(gt);

        fs.type = FillStyle.FILL_LINEAR_GRADIENT;

                fs.gradient = new Gradient();
                fs.gradient.records = new GradRecord[2];
        fs.gradient.records[0] = new GradRecord(0, SwfUtils.colorToInt(gp.getColor1())); //from left
        fs.gradient.records[1] = new GradRecord(255,  SwfUtils.colorToInt(gp.getColor2())); //to right
      }
      else if (paint instanceof LinearGradientPaint)
      {
        LinearGradientPaint lgp = (LinearGradientPaint)paint;
                Point2D start = lgp.getStartPoint();
        Point2D end = lgp.getEndPoint();

        AffineTransform gt = objectBoundingBoxTransform(start, end, width, height, width, height);

        fs = new FillStyle();
        fs.matrix = MatrixBuilder.build(gt);

        Color[] colors = lgp.getColors();
        float[] ratios = lgp.getFractions();

        if (colors.length == 0 || colors.length != ratios.length) //Invalid fill so we skip
        {
          return null;
        }
        else if (colors.length == 1) //Solid fill
        {
          return new FillStyle(SwfUtils.colorToInt(colors[0]));
        }
        else
        {
          fs.type = FillStyle.FILL_LINEAR_GRADIENT;

          //Maximum of 8 gradient control points records
          int len = ratios.length;
          if (len > 8)
            len = 8;
                    fs.gradient = new Gradient();
                    fs.gradient.records = new GradRecord[len];

          for (int i = 0; i < len; i++)
          {
            fs.gradient.records[i] = new GradRecord((int)Math.rint(255 * ratios[i]), SwfUtils.colorToInt(colors[i]));
          }

        }
      }
      else if (paint instanceof RadialGradientPaint)
      {
        RadialGradientPaint rgp = (RadialGradientPaint)paint;

        //Note: Flash doesn't support the focal point of a radial gradient
        //Point2D cp = rgp.getCenterPoint();
        //Point2D fp = rgp.getFocusPoint();
        double diameter = rgp.getRadius() * 2.0;
        double outerX = diameter * rgp.getTransform().getScaleX();
        double outerY = diameter * rgp.getTransform().getScaleY();

        AffineTransform gt = objectBoundingBoxTransform(null, null, width, height, outerX, outerY);
        fs = new FillStyle();
        fs.matrix = MatrixBuilder.build(gt);

        fs.type = FillStyle.FILL_RADIAL_GRADIENT;

        Color[] colors = rgp.getColors();
        float[] ratios = rgp.getFractions();

                fs.gradient = new Gradient();
                fs.gradient.records = new GradRecord[ratios.length <= 8 ? ratios.length : 8];
        for (int i = 0; i < ratios.length && i < 8; i++)
        {
          fs.gradient.records[i] = new GradRecord((int)Math.rint(255 * ratios[i]), SwfUtils.colorToInt(colors[i]));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.