Object
|
+---DPNGImage
The DPNGImage class implements methods for reading and writing PNG images.
#include <stdio.h>
#include "ofc/DPNGImage.h"
#include "ofc/DFile.h"
int main(int argc, char *argv[])
{
DPNGImage *image = [DPNGImage new];
DFile *file = [DFile new];
char name[] = "ofc.png";
if ([file open :name :"rb"])
{
if ([DPNGImage isImage :file])
{
if ([image open :file])
{
printf("\"%s\" is a PNG image with width:%d height:%d BytesPerPixel:%d Images:%d\n",
name, [image width], [image height], [image bytesPerPixel], [image images]);
[image close];
}
else
printf("Could not open image \"%s\".\n", name);
}
else
printf("\"%s\" is not a PNG image.\n", name);
[file close];
}
else
printf("Could not find \"%s\":%d\n", name, [file error]);
[image free]; // Cleanup
[file free];
return 0;
}