public void LoadImage(string filepath, IGUIContext ctx, float opacity = 1f) { if (m_ImageFilePath != filepath) { m_ImageFilePath = filepath; if (Image != null) { Image.Dispose(); Image = null; } if (String.IsNullOrEmpty(filepath) || ctx == null) { return; } try { Image = TextureImage.FromFile(filepath, ctx); Image.Opacity = opacity; } catch (Exception ex) { ex.LogError(); } } }
public void LoadTextureImageFromFile(string filepath, IGUIContext ctx) { filepath = filepath.FixedExpandedPath(); if (m_ImageFilePath != filepath) { m_ImageFilePath = filepath; if (Image != null) { Image.Dispose(); Image = null; } if (String.IsNullOrEmpty(filepath) || ctx == null) { return; } try { Image = TextureImage.FromFile(filepath, ctx); } catch (Exception ex) { ex.LogError(); } } }
public bool AddImage(string key, string filePath) { try { TextureImage image = TextureImage.FromFile(filePath, Context, key, ImageSize); return(m_Images.TryAdd(key, image)); } catch (Exception ex) { ex.LogError(); return(false); } }
public void LoadImageAsync(string filePath, IGUIContext ctx) { if (IsDisposed || String.IsNullOrEmpty(filePath)) { return; } try { if (Image != null && ShouldDisposeImage) { Image.Dispose(); } Image = TextureImage.FromFile(filePath.FixedExpandedPath(), ctx); //Image.Opacity = 0.999f; } catch (Exception ex) { ex.LogError(); } finally { Update(true); m_InitialFilePath = null; } }
void LoadMissingImage() { try { if (!String.IsNullOrEmpty(MissingImagePath) && File.Exists(MissingImagePath)) { Task.Run(() => { TextureImage oldImage = MissingImage; try { MissingImage = TextureImage.FromFile(MissingImagePath, Context, null, ImageSize); } catch (Exception ex) { ex.LogError(); } finally { if (oldImage != null) { oldImage.Dispose(); } } }); } } catch (Exception ex) { ex.LogError(); } }