コード例 #1
0
        public SVGGradient parseGradient(Attributes pAttributes, bool pLinear)
        {
            string id = pAttributes.GetStringAttribute(SVGConstants.ATTRIBUTE_ID);

            if (id == null)
            {
                return(null);
            }

            SVGGradient svgGradient = new SVGGradient(id, pLinear, pAttributes);

            this.mSVGGradientMap[id] = svgGradient;
            return(svgGradient);
        }
コード例 #2
0
ファイル: SVGGradient.cs プロジェクト: znsoft/TUSA
        private void resolveHref(Dictionary <String, SVGGradient> pSVGGradientMap)
        {
            SVGGradient parent = pSVGGradientMap[this.mHref];

            if (parent == null)
            {
                throw new SVGParseException("Could not resolve href: '" + this.mHref + "' of SVGGradient: '" + this.mID + "'.");
            }
            else
            {
                parent.ensureHrefResolved(pSVGGradientMap);
                this.mParent = parent;
                this.mSVGAttributes.setParentSVGAttributes(this.mParent.mSVGAttributes);
                if (this.mSVGGradientStops == null)
                {
                    this.mSVGGradientStops          = this.mParent.mSVGGradientStops;
                    this.mSVGGradientStopsColors    = this.mParent.mSVGGradientStopsColors;
                    this.mSVGGradientStopsPositions = this.mParent.mSVGGradientStopsPositions;
                }
            }
        }
コード例 #3
0
        Shader getGradientShader(string pGradientShaderID)
        {
            SVGGradient svgGradient = this.mSVGGradientMap[pGradientShaderID];

            if (svgGradient == null)
            {
                throw new SVGParseException("No SVGGradient found for id: '" + pGradientShaderID + "'.");
            }
            else
            {
                Shader gradientShader = svgGradient.getShader();
                if (gradientShader != null)
                {
                    return(gradientShader);
                }
                else
                {
                    svgGradient.ensureHrefResolved(this.mSVGGradientMap);
                    return(svgGradient.createShader());
                }
            }
        }
コード例 #4
0
ファイル: SVGHandler.cs プロジェクト: znsoft/xamsvg
 void parseRadialGradient(Attributes pAttributes)
 {
     this.mCurrentSVGGradient = this.mSVGPaint.parseGradient(pAttributes, false);
 }
コード例 #5
0
ファイル: SVGHandler.cs プロジェクト: znsoft/xamsvg
 void parseLinearGradient(Attributes pAttributes)
 {
     this.mCurrentSVGGradient = this.mSVGPaint.parseGradient(pAttributes, true);
 }
コード例 #6
0
ファイル: SVGGradient.cs プロジェクト: jdluzen/xamsvg
		private void resolveHref(Dictionary<String, SVGGradient> pSVGGradientMap) {
			SVGGradient parent = pSVGGradientMap[this.mHref];
			if(parent == null) {
				throw new SVGParseException("Could not resolve href: '" + this.mHref + "' of SVGGradient: '" + this.mID + "'.");
			} else {
				parent.ensureHrefResolved(pSVGGradientMap);
				this.mParent = parent;
				this.mSVGAttributes.setParentSVGAttributes(this.mParent.mSVGAttributes);
				if(this.mSVGGradientStops == null) {
					this.mSVGGradientStops = this.mParent.mSVGGradientStops;
					this.mSVGGradientStopsColors = this.mParent.mSVGGradientStopsColors;
					this.mSVGGradientStopsPositions = this.mParent.mSVGGradientStopsPositions;
				}
			}
		}
コード例 #7
0
ファイル: SVGPaint.cs プロジェクト: jdluzen/xamsvg
		public SVGGradient parseGradient(Attributes pAttributes, bool pLinear) {
			string id = pAttributes.GetStringAttribute(SVGConstants.ATTRIBUTE_ID);
			if(id == null) {
				return null;
			}

			SVGGradient svgGradient = new SVGGradient(id, pLinear, pAttributes);
			this.mSVGGradientMap[id] = svgGradient;
			return svgGradient;
		}
コード例 #8
0
ファイル: SVGHandler.cs プロジェクト: jdluzen/xamsvg
		void parseRadialGradient(Attributes pAttributes) {
			this.mCurrentSVGGradient = this.mSVGPaint.parseGradient(pAttributes, false);
		}
コード例 #9
0
ファイル: SVGHandler.cs プロジェクト: jdluzen/xamsvg
		void parseLinearGradient(Attributes pAttributes) {
			this.mCurrentSVGGradient = this.mSVGPaint.parseGradient(pAttributes, true);
		}