The algorithm uses the alpha in the original image to calculate the index it shouldn’t make a difference if you keep it as is. Other then that i don’t like the way it makes the grayscale image not shade black to black. But you don’t use the alpha to read the index in the resulting 3rd image, instead the r g or b elements hold the index.
do you think just serializing the object to a binary format would work cross platform?
I don’t really want to have to use the content pipeline.
Serializing the object would have to occur prior to runtime saved added to your project then, deserializing can occur whenever. Pure c# code works anywere, however image loading is platform specific.
However because you are using a image and those are encoded png and jpeg are encoded file types you wouldn’t serialize that or would you want to.
You can’t actually serialize them without loading them to a color array.
In that case you have the same problems if you want to use them dynamically it would be pointless to serialize them. Even if you did it would have to be done in the same manner as just calling FromStream.
Anyways you need to use set and get data in either case to convert them to grayscale then to the indexed pal if they are to be loaded dynamically.
If not convert them first then just add them to the pipeline or to your project in the indexed forms.
The rest of the class or game data can be serialized and deserialized but you wouldn’t need to dynamically load that you would do that at compile time and just add them to your project directly and set in the properties to copy if newer for the file type or do it all thru the pipeline.
The pipeline is there to help make a very complicated set of tasks with many different things you probably never considered a lot easier especially if you are new. The pipeline tool makes most of them really easy.
Dynamic loading of textures is one exception unless you write a content importer reader. Which is all about reading and writing serialized data that can also be compressed to a xnb.
But the alternatives are far less easy in that case anyways.
You really should read some of those links at least the second one.
Except
There are other circumstances, however, when it helps to understand how the Content Pipeline works.
A third party may provide custom XNA Game Studio Content Pipeline components that support additional art assets and formats.
You may need to write your own custom XNA Game Studio Content Pipeline components to support a new type of art asset or format from a DCC.
You may wish to write your own custom XNA Game Studio Content Pipeline components to derive special-purpose content from another piece of content at the time the game is built.
Content Pipeline Components
The processes that comprise the XNA Game Studio Content Pipeline fall into two types, depending on when they execute: build-time components and run-time components.
.
Securing assets against modification is a whole other topic beyond the scope of this post and you might be hard pressed to get a answer to that depending on your level of expectations and willingness to do some heavy lifting.