In XNA 4.0, I want to load all my textures at runtime, which means I will not be able to take advantage of the content processor. (This is fine because it would allow people to change graphics and other elements without having to have XNA installed to compile them into .xnb)
Suppose that I can't (or don't want to) use premultiplied alpha on my images, and instead rely on the classic magic pink (255, 0, 255) method:
How can I turn it into a Texture2D
object and convert the pink to be transparent using GraphicsDevice
? It is trivial to iterate the data with GetData() and SetData(), but this uses the processor, rather than the graphics card.
if (myTexture.PackedValue == 0xFFFF00FF)
(BGRA) and replace it with Color.Transparent (or 0x00000000), but this approach relies on using the CPU, rather than the GPU. Where is the color map located, within the .png itself or the Texture2D object? \$\endgroup\$