protected void UpdateTexture(string url) { lock (_imageSync) { var imageData = Utils.DownloadImage(url); _texture = ContentManager.Instance.GetTexture(imageData, _itemTitle); if (_texture == null) { return; } if (!_texture.IsAllocated) { _texture.Allocate(); } if (!_texture.IsAllocated) { return; } //ImagePlayerSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ImagePlayerSettings>() ?? new ImagePlayerSettings(); _animator = STILL_IMAGE_ANIMATION; //settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; SurfaceDescription desc = _texture.Texture.GetLevelDescription(0); _textureMaxUv = new SizeF(_texture.Width / (float)desc.Width, _texture.Height / (float)desc.Height); // Reset animation _animator.Initialize(); _state = PlayerState.Active; } }
protected void UpdateTexture(ImageItem item) { lock (imageSync) { itemTitle = item.ImageId; texture = ContentManager.Instance.GetTexture(item.ImageData, item.ImageId); if (texture == null) { return; } if (!texture.IsAllocated) { texture.Allocate(); } if (!texture.IsAllocated) { return; } //ImagePlayerSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ImagePlayerSettings>() ?? new ImagePlayerSettings(); animator = STILL_IMAGE_ANIMATION; //settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; SurfaceDescription desc = texture.Texture.GetLevelDescription(0); textureMaxUV = new SizeF(texture.Width / (float)desc.Width, texture.Height / (float)desc.Height); // Reset animation animator.Initialize(); state = PlayerState.Active; } }
void Awake() { _animator = GetComponent <IAnimator>(); _animator.OnTrigger += HandleTrigger; _audioSource = GetComponent <AudioSource>(); _spriteAnimator = _animator as ISpriteAnimator; _imageAnimator = _animator as IImageAnimator; }
protected void ReloadSettings() { ImagePlayerSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <ImagePlayerSettings>() ?? new ImagePlayerSettings(); double durationSec = settings.SlideShowImageDuration; _slideShowImageDuration = durationSec == 0 ? TS_INFINITE : TimeSpan.FromSeconds(durationSec); _animator = settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; }
public void Reset() { IImageAnimator animator = Animation; if (animator != null) { animator.Initialize(); } _refresh = true; }
public RectangleF GetTextureClip(Size outputSize) { // TODO: Execute animation in own timer lock (_syncObj) { _animator = _animator ?? STILL_IMAGE_ANIMATION; DateTime displayTime = _pauseTime ?? DateTime.Now; RectangleF textureClip = _animator.GetZoomRect(ImageSize.ToSize2(), outputSize, displayTime); return(new RectangleF(textureClip.X * _textureMaxUV.Width, textureClip.Y * _textureMaxUV.Height, textureClip.Width * _textureMaxUV.Width, textureClip.Height * _textureMaxUV.Height)); } }
protected void ReloadSettings() { ImagePlayerSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <ImagePlayerSettings>() ?? new ImagePlayerSettings(); double durationSec = settings.SlideShowImageDuration; _slideShowImageDuration = durationSec == 0 ? TS_INFINITE : TimeSpan.FromSeconds(durationSec); // Use animation only in slideshow mode var newAnimator = _slideShowEnabled && settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; bool reInit = newAnimator != _animator; _animator = newAnimator; // Reset animation if the animator has been changed (i.e. toggling between single image/slideshow) if (reInit) { _animator.Initialize(); } }
public Vector4 GetTextureClip() { IImageAnimator animator = Animation; // TODO: Execute animation in own timer if (animator == null || !AnimationEnabled) { return(_brushTransform); } Size size = new Size((int)BrushDimensions.X, (int)BrushDimensions.Y); Size outputSize = new Size((int)_vertsBounds.Width, (int)_vertsBounds.Height); RectangleF textureClip = animator.GetZoomRect(size, outputSize, DateTime.Now); var vector4 = new Vector4( -textureClip.X * TextureMaxUV.X, -textureClip.Y * TextureMaxUV.Y, textureClip.Width * TextureMaxUV.X, textureClip.Height * TextureMaxUV.Y ); return(vector4); }
protected void UpdateTexture(string url) { lock (_imageSync) { var imageData = Utils.DownloadImage(url); _texture = ContentManager.Instance.GetTexture(imageData, _itemTitle); if (_texture == null) return; if (!_texture.IsAllocated) _texture.Allocate(); if (!_texture.IsAllocated) return; //ImagePlayerSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ImagePlayerSettings>() ?? new ImagePlayerSettings(); _animator = STILL_IMAGE_ANIMATION; //settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; SurfaceDescription desc = _texture.Texture.GetLevelDescription(0); _textureMaxUv = new SizeF(_texture.Width / (float)desc.Width, _texture.Height / (float)desc.Height); // Reset animation _animator.Initialize(); _state = PlayerState.Active; } }
protected void ReloadSettings() { ImagePlayerSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ImagePlayerSettings>() ?? new ImagePlayerSettings(); double durationSec = settings.SlideShowImageDuration; _slideShowImageDuration = durationSec == 0 ? TS_INFINITE : TimeSpan.FromSeconds(durationSec); _animator = settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; }
public RectangleF GetTextureClip(Size outputSize) { // TODO: Execute animation in own timer lock (_syncObj) { _animator = _animator ?? STILL_IMAGE_ANIMATION; DateTime displayTime = _pauseTime.HasValue ? _pauseTime.Value : DateTime.Now; RectangleF textureClip = _animator.GetZoomRect(ImageSize.ToSize2(), outputSize, displayTime); return new RectangleF(textureClip.X * _textureMaxUV.Width, textureClip.Y * _textureMaxUV.Height, textureClip.Width * _textureMaxUV.Width, textureClip.Height * _textureMaxUV.Height); } }
protected void ReloadSettings() { ImagePlayerSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<ImagePlayerSettings>() ?? new ImagePlayerSettings(); double durationSec = settings.SlideShowImageDuration; _slideShowImageDuration = durationSec == 0 ? TS_INFINITE : TimeSpan.FromSeconds(durationSec); // Use animation only in slideshow mode var newAnimator = _slideShowEnabled && settings.UseKenBurns ? new KenBurnsAnimator() : STILL_IMAGE_ANIMATION; bool reInit = newAnimator != _animator; _animator = newAnimator; // Reset animation if the animator has been changed (i.e. toggling between single image/slideshow) if (reInit) _animator.Initialize(); }