static public Initialize ( Compositor compositor ) : void | ||
compositor | Compositor | |
리턴 | void |
public CompositionList() { this.InitializeComponent(); this.Loaded += CompositionList_Loaded; this.Unloaded += CompositionList_Unloaded; // Get the current compositor _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; SurfaceLoader.Initialize(_compositor); // // Create the lights // _ambientLight = _compositor.CreateAmbientLight(); _pointLight = _compositor.CreatePointLight(); _distantLight = _compositor.CreateDistantLight(); _spotLight = _compositor.CreateSpotLight(); }
public CompositionImage() { this.DefaultStyleKey = typeof(CompositionImage); this.Background = new SolidColorBrush(Colors.Transparent); this._stretchMode = CompositionStretch.Uniform; this.Loading += CompImage_Loading; this.Unloaded += CompImage_Unloaded; this.SizeChanged += CompImage_SizeChanged; _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; // Intialize the statics as needed if (!_staticsInitialized) { _defaultPlaceholderBrush = _compositor.CreateColorBrush(Colors.DarkGray); TimeSpan duration = TimeSpan.FromMilliseconds(1000); _fadeOutAnimation = _compositor.CreateScalarKeyFrameAnimation(); _fadeOutAnimation.InsertKeyFrame(0, 1); _fadeOutAnimation.InsertKeyFrame(1, 0); _fadeOutAnimation.Duration = duration; _scaleAnimation = _compositor.CreateVector2KeyFrameAnimation(); _scaleAnimation.InsertKeyFrame(0, new Vector2(1.25f, 1.25f)); _scaleAnimation.InsertKeyFrame(1, new Vector2(1, 1)); _scaleAnimation.Duration = duration; _staticsInitialized = true; } // Initialize the surface loader if needed if (!SurfaceLoader.IsInitialized) { SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor); } _placeholderDelay = TimeSpan.FromMilliseconds(50); _surfaceBrush = _compositor.CreateSurfaceBrush(null); }