I am working on some code (not written by be, and too big to fundamentally change the structure of) where a pure virtual Image class is implemented. The user is expected to implement a function of their derived Image class with signature:
virtual Rgb* GetRgb();
Where the Rgb type is defined as:
struct Rgb
{
static const int NUM_CHANNELS = 3;
unsigned char channel[NUM_CHANNELS];
};
This Rgb type is never instantiated directly, it is simply used to determine the stride length of the pointer through the image data.
If I read a file and determine the pixels have more than 3 components, is there anyway I can change this Rgb type to now have the desired stride length, for example, unsigned char * 4
? Note: templates are not an option (design decision not made by me).
Any helpful hints?
Thanks,
David