static int parseAlpha(SVGProperties pSVGProperties, bool pModeFill) { float?opacity = pSVGProperties.getFloatProperty(SVGConstants.ATTRIBUTE_OPACITY); if (opacity == null) { opacity = pSVGProperties.getFloatProperty(pModeFill ? SVGConstants.ATTRIBUTE_FILL_OPACITY : SVGConstants.ATTRIBUTE_STROKE_OPACITY); } if (opacity == null) { return(255); } else { return((int)(255 * opacity)); } }
public SVGGradientStop parseGradientStop(SVGProperties pSVGProperties) { float offset = pSVGProperties.getFloatProperty(SVGConstants.ATTRIBUTE_OFFSET, 0f); string stopColor = pSVGProperties.getStringProperty(SVGConstants.ATTRIBUTE_STOP_COLOR); int rgb = this.parseColor(stopColor.Trim(), Color.Black); int alpha = this.parseGradientStopAlpha(pSVGProperties); return(new SVGGradientStop(offset, alpha | rgb)); }
bool applyStrokeProperties(SVGProperties pSVGProperties) { float?width = pSVGProperties.getFloatProperty(SVGConstants.ATTRIBUTE_STROKE_WIDTH); if (width != null) { this.mPaint.StrokeWidth = width.Value; } string linecap = pSVGProperties.getStringProperty(SVGConstants.ATTRIBUTE_STROKE_LINECAP); if (SVGConstants.ATTRIBUTE_STROKE_LINECAP_VALUE_ROUND.Equals(linecap)) { this.mPaint.StrokeCap = Paint.Cap.Round; } else if (SVGConstants.ATTRIBUTE_STROKE_LINECAP_VALUE_SQUARE.Equals(linecap)) { this.mPaint.StrokeCap = Paint.Cap.Square; } else if (SVGConstants.ATTRIBUTE_STROKE_LINECAP_VALUE_BUTT.Equals(linecap)) { this.mPaint.StrokeCap = Paint.Cap.Butt; } string linejoin = pSVGProperties.getStringProperty(SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_); if (SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_MITER.Equals(linejoin)) { this.mPaint.StrokeJoin = Paint.Join.Miter; } else if (SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_ROUND.Equals(linejoin)) { this.mPaint.StrokeJoin = Paint.Join.Round; } else if (SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_BEVEL.Equals(linejoin)) { this.mPaint.StrokeJoin = Paint.Join.Bevel; } return(true); }
public SVGGradientStop parseGradientStop(SVGProperties pSVGProperties) { float offset = pSVGProperties.getFloatProperty(SVGConstants.ATTRIBUTE_OFFSET, 0f); string stopColor = pSVGProperties.getStringProperty(SVGConstants.ATTRIBUTE_STOP_COLOR); int rgb = this.parseColor(stopColor.Trim(), Color.Black); int alpha = this.parseGradientStopAlpha(pSVGProperties); return new SVGGradientStop(offset, alpha | rgb); }
static int parseAlpha(SVGProperties pSVGProperties, bool pModeFill) { float? opacity = pSVGProperties.getFloatProperty(SVGConstants.ATTRIBUTE_OPACITY); if(opacity == null) { opacity = pSVGProperties.getFloatProperty(pModeFill ? SVGConstants.ATTRIBUTE_FILL_OPACITY : SVGConstants.ATTRIBUTE_STROKE_OPACITY); } if(opacity == null) { return 255; } else { return (int) (255 * opacity); } }
bool applyStrokeProperties(SVGProperties pSVGProperties) { float? width = pSVGProperties.getFloatProperty(SVGConstants.ATTRIBUTE_STROKE_WIDTH); if (width != null) { this.mPaint.StrokeWidth = width.Value; } string linecap = pSVGProperties.getStringProperty(SVGConstants.ATTRIBUTE_STROKE_LINECAP); if (SVGConstants.ATTRIBUTE_STROKE_LINECAP_VALUE_ROUND.Equals(linecap)) { this.mPaint.StrokeCap = Paint.Cap.Round; } else if (SVGConstants.ATTRIBUTE_STROKE_LINECAP_VALUE_SQUARE.Equals(linecap)) { this.mPaint.StrokeCap = Paint.Cap.Square; } else if (SVGConstants.ATTRIBUTE_STROKE_LINECAP_VALUE_BUTT.Equals(linecap)) { this.mPaint.StrokeCap = Paint.Cap.Butt; } string linejoin = pSVGProperties.getStringProperty(SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_); if (SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_MITER.Equals(linejoin)) { this.mPaint.StrokeJoin = Paint.Join.Miter; } else if (SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_ROUND.Equals(linejoin)) { this.mPaint.StrokeJoin = Paint.Join.Round; } else if (SVGConstants.ATTRIBUTE_STROKE_LINEJOIN_VALUE_BEVEL.Equals(linejoin)) { this.mPaint.StrokeJoin = Paint.Join.Bevel; } return true; }