You can open the raster image as a GDALDataset :<BR>
<code>poDataset = (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );</code><BR>

Then get the raster band containing the color codes with :<BR>
<code>GDALRasterBand  *poBand;<BR>
poBand = poDataset->GetRasterBand( i );</code> where "i" represents the raster band id. <BR>

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.<BR>
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 :<BR>
<code>
CPLErr GDALRasterBand::RasterIO	( GDALRWFlag eRWFlag,<BR>
int 	nXOff,<BR>
int 	nYOff,<BR>
int 	nXSize,<BR>
int 	nYSize,<BR>
void * 	pData,<BR>
int 	nBufXSize,<BR>
int 	nBufYSize,<BR>
GDALDataType 	eBufType,<BR>
int 	nPixelSpace,<BR>
int 	nLineSpace	<BR> 
)			
</code><BR>
For a full documentation about the GDAL LIBRARY : http://gdal.org/index.html <BR>
GDAL class list : http://gdal.org/annotated.html <BR>
Get some help with the GDAL API : http://gdal.org/gdal_tutorial.html