Skip to content

Commit

Permalink
feat: move ImageTransformationOptions to Packages (#1327)
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler authored Feb 17, 2025
1 parent 2d734fb commit 04b46f4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,12 @@ protected static TextureFormat TextureFormatFor(Texture texture)
{
return GraphicsFormatUtility.GetTextureFormat(texture.graphicsFormat);
}

public Experimental.ImageTransformationOptions GetTransformationOptions(bool expectedToBeMirrored = false)
{
var shouldFlipHorizontally = (isFrontFacing || expectedToBeMirrored) ^ isHorizontallyFlipped;
var shouldFlipVertically = isVerticallyFlipped;
return Experimental.ImageTransformationOptions.Build(shouldFlipHorizontally, shouldFlipVertically, rotation);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) 2023 homuler
// Copyright (c) 2021 homuler
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

namespace Mediapipe.Unity.Sample
namespace Mediapipe.Unity.Experimental
{
public readonly struct ImageTransformationOptions
{
Expand All @@ -28,14 +28,4 @@ public static ImageTransformationOptions Build(bool shouldFlipHorizontally, bool
return new ImageTransformationOptions(flipHorizontally, flipVertically, rotation);
}
}

public static class ImageSourceExtension
{
public static ImageTransformationOptions GetTransformationOptions(this ImageSource imageSource, bool expectedToBeMirrored = false)
{
var shouldFlipHorizontally = (imageSource.isFrontFacing || expectedToBeMirrored) ^ imageSource.isHorizontallyFlipped;
var shouldFlipVertically = imageSource.isVerticallyFlipped;
return ImageTransformationOptions.Build(shouldFlipHorizontally, shouldFlipVertically, imageSource.rotation);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

using NUnit.Framework;

namespace Mediapipe.Unity.Sample.Tests
namespace Mediapipe.Unity.Experimental.Tests
{
public class ImageTransformationOptionsTest
{
Expand Down

0 comments on commit 04b46f4

Please sign in to comment.