Class DJPEGImage

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

Class Hierarchy

    Object
      |
      +---DJPEGImage

Class Description

The DJPEGImage class implements methods for reading and writing JPEG images.

Example:
#include <stdio.h>
#include "ofc/DJPEGImage.h"
#include "ofc/DFile.h"

int main(int argc, char *argv[])
{
  DJPEGImage *image = [DJPEGImage new];
  DFile      *file  = [DFile new];

  char       name[] = "example.jpg";

  if ([file open :name :"rb"])
  {
    if ([DJPEGImage isImage :file])
    {
      if ([image open :file])
      {
        printf("\"%s\" is a JPEG 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 JPEG 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 (DJPEGImage.h)

Instance Variables

private void *_jinfo
the jpeg info
private void *_jerr
the jpeg error
private unsigned _height
the height of the image
private unsigned _width
the width of the image
private unsigned _bpp
the bytes per pixel
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