/// <summary> /// Draw the Image preview. /// </summary> public override void OnPreviewGUI(Rect drawArea, GUIStyle background) { AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; Texture tex = rawImage.mainTexture; if (tex == null) { return; } // Create the texture rectangle that is centered inside rect. Rect outerRect = drawArea; EditorGUI.DrawTextureTransparent(outerRect, tex, ScaleMode.ScaleToFit); //, outer.width / outer.height); //SpriteDrawUtility.DrawSprite(tex, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor()); }
/// <summary> /// Info String drawn at the bottom of the Preview /// </summary> public override string GetInfoString() { AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; string text = string.Empty; if (rawImage.HasValidTexture()) { text += string.Format("Video Size: {0}x{1}\n", Mathf.RoundToInt(Mathf.Abs(rawImage.mainTexture.width)), Mathf.RoundToInt(Mathf.Abs(rawImage.mainTexture.height))); } // Image size Text text += string.Format("Display Size: {0}x{1}", Mathf.RoundToInt(Mathf.Abs(rawImage.rectTransform.rect.width)), Mathf.RoundToInt(Mathf.Abs(rawImage.rectTransform.rect.height))); return(text); }
public override bool RequiresConstantRepaint() { AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; return(rawImage != null && rawImage.HasValidTexture()); }
/// <summary> /// Allow the texture to be previewed. /// </summary> public override bool HasPreviewGUI() { AVProLiveCameraUGUIComponent rawImage = target as AVProLiveCameraUGUIComponent; return(rawImage != null); }