You can open the raster image as a GDALDataset :
poDataset = (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );
Then get the raster band containing the color codes with :
GDALRasterBand *poBand;
where "i" represents the raster band id.
poBand = poDataset->GetRasterBand( i );
Then iterate over the raster band pixels and read each pixel color code value to count the number of pixels for a selected color code.
Knowing the area represented by a single pixel you should be able to calculate the area for all the pixels representing the selected color code.
To read values from a raster band you should use :
CPLErr GDALRasterBand::RasterIO ( GDALRWFlag eRWFlag,
int nXOff,
int nYOff,
int nXSize,
int nYSize,
void * pData,
int nBufXSize,
int nBufYSize,
GDALDataType eBufType,
int nPixelSpace,
int nLineSpace
)
For a full documentation about the GDAL LIBRARY : http://gdal.org/index.html
GDAL class list : http://gdal.org/annotated.html
Get some help with the GDAL API : http://gdal.org/gdal_tutorial.html
I hope this helps!