Original Post
I need some kind of formula to crop down a Texture2D. The textures are not loading as assets nor saved to jpeg or png at any point, they're created on the fly by the game.

to

Not all of the white needs to be removed, just minimized down until the black shape is touched by the edges.
I'm thinking it would look something like (but not necessarily exact)
Texture2D Crop(Color excess)
{
// Forumula for cropping
return resultingTexture;
}
I was thinking maybe something with a Color[] but I couldn't think of way to make that work.

to

Not all of the white needs to be removed, just minimized down until the black shape is touched by the edges.
I'm thinking it would look something like (but not necessarily exact)
Texture2D Crop(Color excess)
{
// Forumula for cropping
return resultingTexture;
}
I was thinking maybe something with a Color[] but I couldn't think of way to make that work.
