I'm using the SharpDX Toolkit, and I want to create a spritesheet programmatically, specifying all the pixel colors in code. The Toolkit's SpriteBatch.Draw method takes a Texture2D, so that's the class I need to end up with. I didn't see anything in the samples that does this -- the closest seems to be the MiniShape sample, but it's doing vector art and I want pixel art.
My textures are spritesheets made up of lots of individual animation-frame sprites, and will end up being around 5000x1000 pixels in size. So I won't want to do individual SetPixel calls (if any SharpDX classes even have anything resembling SetPixel); I'll want to pass a large array (of bytes? ints?) and construct the whole thing at once. I want to use some flavor of 32-bit RGBA.
My first question is, what's the best approach to take? There seem to be a lot of different classes in SharpDX that represent bitmaps, and there are some ways to convert from one to another (e.g. you can create a SharpDX.Toolkit.Graphics.Texture2D from a SharpDX.Toolkit.Graphics.Image, but I don't know how you get pixels into an Image so that doesn't help me much). What's going to be the best class to work with to build up a texture from individual pixels? I've got some small-scale working code using Texture2D.New and GetData/SetData, but I don't know whether that's going to be the best approach for performance, broad hardware support, etc.
My second question is, what pixel format should I choose? (Perhaps there's a class I could use that doesn't require me to pick a pixel format, but Texture2D.New does require a pixel format.) I don't know any of the reasons why I might choose R8G8B8A8 vs. B8G8R8A8. Is one more performant than the other? Are they both supported on all graphics cards?
And I know almost nothing about all the pixel subformats (UInt, UNorm, Typeless, etc.) beyond the sketchy descriptions on Microsoft's
DXGI_FORMAT page. I don't need the sRGB colorspace, and Typeless seems to be for very special purposes. I think I probably want UInt or UNorm since they're both plain old bytes, but it doesn't tell me which to choose. I found by experimenting that UNorm works but UInt ends up not rendering anything to the screen, but I again don't know whether UNorm is the best recommendation, whether it would work on all video cards, etc.
Anyone know more about this than me, or able to point me to some relevant resources (websites/books) that might help?