Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection window refactoring #13

Merged
merged 8 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Src/NFTWallet/Assets/Code/NFTWallet/UIHelpers/TextureUtils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using UnityEngine;

public static class TextureUtils
{
public static Texture2D ResizeTexture(this Texture2D source, int newWidth, int newHeight)
{
source.filterMode = FilterMode.Point;
RenderTexture rt = RenderTexture.GetTemporary(newWidth, newHeight);
rt.filterMode = FilterMode.Point;
RenderTexture.active = rt;
Graphics.Blit(source, rt);
Texture2D newTexture = new Texture2D(newWidth, newHeight);
newTexture.ReadPixels(new Rect(0, 0, newWidth, newHeight), 0, 0);
newTexture.Apply();
RenderTexture.active = null;
RenderTexture.ReleaseTemporary(rt);
return newTexture;
}
}
11 changes: 11 additions & 0 deletions Src/NFTWallet/Assets/Code/NFTWallet/UIHelpers/TextureUtils.cs.meta

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

Loading