Ejemplo n.º 1
0
		public override void Apply(ComputedStyle style,Value value){
			
			// Is it lit?
			bool lit=(value!=null && value.Boolean);
			
			if(!lit && style.Shading==null){
				// Essentially ignore it anyway.
				return;
			}
			
			if(style.Shading==null){
				// It's lit:
				style.RequireShading().Lit=true;
			}else{
				// It's not lit:
				style.Shading.Lit=false;
				
				// Optimise - might no longer need the shading info:
				style.Shading.Optimise();
			}
			
			// Request a layout now:
			style.RequestLayout();
			
		}
Ejemplo n.º 2
0
		public override void Apply(ComputedStyle style,Value value){
			
			// Got text at all?:
			if(GetText(style)==null){
				return;
			}
			
			// Apply the property:
			if(value==null || value.Text=="none"){
				
				// Clear the shadow:
				style.TextShadow=null;
				
			}else{
			
				// The glow properties:
				int blur=0;
				Color colour=Color.black;
				
				ShadowData data=style.TextShadow;
				
				if(data==null){
					data=new ShadowData();
					style.TextShadow=data;
				}
				
				data.HOffset=value[0].PX;
				data.VOffset=value[1].PX;
				
				// Grab the blur:
				Value innerValue=value[2];
				
				if(innerValue.Type==ValueType.Color){
					colour=innerValue.ToColor();
				}else{
					blur=innerValue.PX;
					
					// Grab the colour:
					innerValue=value[3];
					
					if(innerValue.Type==ValueType.Color){
						colour=innerValue.ToColor();
					}
					
				}
			
				if(colour.a==1f){
					// Default transparency:
					colour.a=0.8f;
				}
				
				data.Colour=colour;
				data.Blur=blur;
				
			}
			
			// Apply the changes - doesn't change anything about the actual text, so we just want a layout:
			style.RequestLayout();
			
		}
Ejemplo n.º 3
0
		public override void Apply(ComputedStyle style,Value value){
			
			// Got any text at all?:
			if(GetText(style)==null){
				return;
			}
			
			// Apply the property:
			if(value==null || value.Text=="none"){
				
				// Clear the stroke:
				style.TextStroke=null;
				
			}else{
			
				// The stroke properties:
				int blur=0;
				Color colour=Color.black;
				
				int thickness=value[0].PX;
				
				if(thickness==0){
					
					style.TextStroke=null;
					
				}else{
					
					StrokeData data=style.TextStroke;
					
					if(data==null){
						data=new StrokeData();
						style.TextStroke=data;
					}
					
					data.Thickness=thickness;
				
					// Grab the blur:
					Value innerValue=value[1];
					
					if(innerValue.Type==ValueType.Color){
						colour=innerValue.ToColor();
					}else{
						blur=innerValue.PX;
						
						// Grab the colour:
						innerValue=value[2];
						
						if(innerValue.Type==ValueType.Color){
							colour=innerValue.ToColor();
						}
						
					}
					
					data.Colour=colour;
					data.Blur=blur;
				
				}
				
			}
			
			// Apply the changes - doesn't change anything about the actual text, so we just want a layout:
			style.RequestLayout();
		}
		public override void Apply(ComputedStyle style,Value value){
			
			ShaderSet family=null;
			
			// Apply:
			if(value!=null){
				
				// Lowercase so we can have the best chance at spotting the standard set (which is optimised for).
				string familyLC=value.Text.ToLower();
				
				if(familyLC!="standardui" && familyLC!="standard" && familyLC!="" && familyLC!="none"){
					
					// Get the family:
					family=ShaderSet.Get(value.Text);
					
				}
				
			}
			
			// Apply it here:
			if(style.Shading!=null){
				
				// Update it:
				style.Shading.Shaders=family;
				
				if(family==null){
					// Check if the shading data is no longer in use:
					style.Shading.Optimise();
				}
				
			}else if(family!=null){
				
				style.RequireShading().Shaders=family;
				
			}
			
			// Request a layout now:
			style.RequestLayout();
			
		}