예제 #1
0
        /// <summary>
        /// Draw the Image preview.
        /// </summary>

        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            IMCImage image = target as IMCImage;

            if (image == null)
            {
                return;
            }

            Sprite sf = image.sprite;

            if (sf == null)
            {
                return;
            }

            SpriteDrawUtility.DrawSprite(sf, rect, image.canvasRenderer.GetColor());
        }
예제 #2
0
        /// <summary>
        /// Draw the Image preview.
        /// </summary>

        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            IMCRawImage rawImage = target as IMCRawImage;
            Texture     tex      = rawImage.mainTexture;

            if (tex == null)
            {
                return;
            }

            Rect outer = rawImage.uvRect;

            outer.xMin *= rawImage.rectTransform.rect.width;
            outer.xMax *= rawImage.rectTransform.rect.width;
            outer.yMin *= rawImage.rectTransform.rect.height;
            outer.yMax *= rawImage.rectTransform.rect.height;

            SpriteDrawUtility.DrawSprite(tex, rect, outer, rawImage.uvRect, rawImage.canvasRenderer.GetColor());
        }