NutTextureExtensions¶
Overview¶
- ApplyFilterMode (No documentation yet)
- ApplyWrapModes (No documentation yet)
- CopyTo
- CreateDuplicate (No documentation yet)
- CreateDuplicateWithNewTexture (No documentation yet)
- CreateDuplicateWithOldTexture (No documentation yet)
- GetNormalizedPivot (No documentation yet)
- GetTextureArea (No documentation yet)
- MakeBlackAndWhite
- LerpRandomPixels
- LerpPixels
METHODS¶
CopyTo¶
Texture2D CopyTo(this Texture2D origin, Texture2D destination)
Copies all data from the former texture to the target one. Returns the target texture.
1 2 3 4 5 6 7 8 9 10 11 12 13 | using NutTools;
using UnityEngine;
public class MyClass : MonoBehaviour
{
public Texture2D origin;
void MyMethod()
{
Texture2D destination = new Texture2D(origin.width, origin.height);
origin.CopyTo(destination);
}
}
|
MakeBlackAndWhite¶
Texture2D MakeBlackAndWhite(BrightnessMode brightnessMode = BrightnessMode.AverageBrightness)
Colors the given texture with the brightness value of each pixel, resulting in a black and white image.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | using NutTools;
using UnityEngine;
public class MyClass : MonoBehaviour
{
public Texture2D origin;
void MyMethod()
{
Texture2D destination = new Texture2D(origin.width, origin.height);
origin.CopyTo(destination);
.MakeBlackAndWhite();
}
}
|
LerpRandomPixels¶
LerpRandomNumberOfRandomPixelsByNPercent(this Texture2D texture, Color targetColor)
Linearly interpolates a random number of random pixels towards the target color by a random percentage. Iteration count and the amount each pixel will be shifted are both random.
LerpRandomNumberOfRandomPixels(this Texture2D texture, Color targetColor, float t)
Linearly interpolates a random number of random pixels towards the target color by “t”. Iteration count is random.
LerpRandomPixels(this Texture2D texture, Color targetColor, float t, int iterations)
Shifts random pixels towards the target color by “t”. Iterations tells how many pixels will be altered. Altered pixels may be altered again.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | using NutTools;
using UnityEngine;
public class MyClass : MonoBehaviour
{
public Texture2D origin;
void MyMethod()
{
Texture2D destination = new Texture2D(origin.width, origin.height);
origin.CopyTo(destination);
.LerpRandomPixels(Color.white, .5f, 10000);
}
}
|
LerpColors¶
LerpColors(this Texture2D texture, Color targetColor, float t)
Linearly interpolates the texture’s colors to the “targetColor” by “t”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | using NutTools;
using UnityEngine;
public class MyClass : MonoBehaviour
{
public Texture2D origin;
void MyMethod()
{
Texture2D destination = new Texture2D(origin.width, origin.height);
origin.CopyTo(destination);
.LerpColors(Color.white, .5f, 10000);
}
}
|
GET HELP¶
Join this Discord server to get help from the community, suggest new features, and vote on future updates!
See also
- Array and List Extensions
- GameObject and Component Extensions
- ParticleSystem Extensions
- Physics Extensions
- Value Extensions