/// <summary> /// Draw the Image preview. /// </summary> public override void OnPreviewGUI(Rect drawArea, GUIStyle background) { DisplayUGUI rawImage = target as DisplayUGUI; Texture tex = rawImage.mainTexture; if (tex == null) return; // Create the texture rectangle that is centered inside rect. Rect outerRect = drawArea; Matrix4x4 m = GUI.matrix; // Flip the image vertically if (rawImage.HasValidTexture()) { if (rawImage._mediaPlayer.TextureProducer.RequiresVerticalFlip()) { GUIUtility.ScaleAroundPivot(new Vector2(1f, -1f), new Vector2(0, outerRect.y + (outerRect.height / 2))); } } EditorGUI.DrawTextureTransparent(outerRect, tex, ScaleMode.ScaleToFit);//, outer.width / outer.height); //SpriteDrawUtility.DrawSprite(tex, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor()); GUI.matrix = m; }
/// <summary> /// Info String drawn at the bottom of the Preview /// </summary> public override string GetInfoString() { DisplayUGUI rawImage = target as DisplayUGUI; 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() { DisplayUGUI rawImage = target as DisplayUGUI; return (rawImage != null && rawImage.HasValidTexture()); }
public override bool RequiresConstantRepaint() { DisplayUGUI displayComponent = target as DisplayUGUI; return(displayComponent != null && displayComponent.HasValidTexture()); }