private IEnumerator setGlyphImage(Glyph glyph) { if (!ApplicationFileManager.IsGlyphDownloaded(glyph)) { ServerCall call = new ServerCall(ServerInteract.DownloadGlyphFromFirebase(glyph)); yield return(StartCoroutine(call.call())); } Texture2D texture = ApplicationFileManager.LoadTextureFromPNGFile(ApplicationFileManager.GetLocalDownloadPath(glyph)); glyphImage.texture = texture; imageSet = true; imageTransform.sizeDelta = new Vector2(texture.width, texture.height); if (placeHolderHeight != 0.0f) { float imageScale = (placeHolderHeight - IMAGE_PADDING * 2.0f) / texture.height; imageTransform.localScale = new Vector3(imageScale, imageScale, imageScale); imageResized = true; } yield return("Done"); }
private void renderPNGGlyph(Glyph glyph) { string localPath = ApplicationFileManager.GetLocalDownloadPath(glyph); Debug.Log("Render: Loading " + localPath); Texture2D tex = ApplicationFileManager.LoadTextureFromPNGFile(localPath); if (tex == null) { Debug.LogError("Render: Couldn't find downloaded file"); } else { Debug.Log("Render: File loaded, setting image"); setGlyphContentDisplayImage(tex); } }
private void loadSnapshot() { Texture2D snapshot = ApplicationFileManager.LoadTextureFromPNGFile(ApplicationFileManager.TAKE_PICTURE_FILE_PATH); if (snapshot != null) { canvasTexture.addSnapshot(snapshot); File.Delete(ApplicationFileManager.TAKE_PICTURE_FILE_PATH); } else { snapshot = ApplicationFileManager.LoadTextureFromPNGFile(ApplicationFileManager.ADD_GLYPH_FILE_PATH); if (snapshot == null) { return; } canvasTexture.addSnapshot(snapshot); } }