Class DPNGImage

Inherits from:
Object
Conforms to:
DImage
Declared in:
DPNGImage.h

Class Hierarchy

    Object
      |
      +---DPNGImage

Class Description

The DPNGImage class implements methods for reading and writing PNG images.

Example:
#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;
}
Last modified:
23-Aug-2008 (DPNGImage.h)

Instance Variables

private void *_png
the png pointer
private void *_info
the png info pointer
private unsigned _height
the height of the image
private unsigned _width
the width of the image
private unsigned _bpp
the bytes per pixel
private unsigned _images
the number of images in the image
private int _bbc
the bits per color
private int _colorType
the color type
private int _interlaceType
the interlace type
private BOOL _reading
reading or writing an image ?
private BOOL _error
is an error active ?

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0