예제 #1
0
        private static void DrawPreview(SpriteCropper cropper)
        {
            var sprite = cropper.sprite;
            var height = EditorGUIUtility.currentViewWidth / sprite.texture.width * sprite.texture.height;
            var rect   = EditorGUILayout.GetControlRect(false, height);

            EditorGUI.DrawTextureTransparent(rect, sprite.texture);
            var cropRectInt = cropper.cropRect;
            var cropRect    = new Rect(
                (float)cropRectInt.x / sprite.texture.width,
                (float)cropRectInt.y / sprite.texture.height,
                (float)cropRectInt.width / sprite.texture.width,
                (float)cropRectInt.height / sprite.texture.height
                );

            EditorUtils.DrawPreviewCropFrame(rect, cropRect, Color.red);
        }
예제 #2
0
 private void DrawPreviewSnapshotFrame(ImageEntry entry, Rect rect)
 {
     EditorUtils.DrawPreviewCropFrame(rect, new Rect(entry.snapshotOffset, entry.snapshotScale),
                                      previewSnapshotFrameColor, previewSnapshotFrameLineWidth);
 }