public override ApplyState Apply(ComputedStyle style, Value value) { RenderableData rd = style.RenderData; RasterDisplayableProperty rdp = rd.RasterProperty; if (value == null || value.IsType(typeof(Css.Keywords.None))) { // Remove RDP if (rdp != null) { // Destroy it: rdp.Destroy(); // Request a layout: rdp.RequestLayout(); // Clear: rd.RasterProperty = null; rdp = null; } } else if (rdp == null) { // RDP required: rd.RasterProperty = rdp = new RasterDisplayableProperty(rd); // Update the filter now! BuildFilter(value, rd, delegate(RenderableData ctx, SurfaceTexture tex){ // Hopefully tex is not null! // If so, we can write it into ctx.RasterProperty, which is hopefully // still available: RasterDisplayableProperty filterRdp = ctx.RasterProperty; if (filterRdp != null) { // Alright - update it with the filter (which might be null). // The filter goes between the FlatWorldUI and the Output. filterRdp.SetFilter(tex); // Request a layout: filterRdp.RequestLayout(); } }); } // Ok! return(ApplyState.Ok); }