KImgIO
pic_rw.h
Go to the documentation of this file.
00001 00021 /* This code is based on the GIMP-PIC plugin by Halfdan Ingvarsson, 00022 * and relicensed from GPL to LGPL to accomodate the KDE licensing policy 00023 * with his permission. 00024 * These is the original copyright: 00025 * Copyright (C) 1998 Halfdan Ingvarsson 00026 */ 00027 00028 #ifndef __PIC_RW_H__ 00029 #define __PIC_RW_H__ 00030 00031 #define PIC_MAGIC_NUMBER 0x5380f634 00032 00033 #include <kdebug.h> 00034 #include <QtCore/QFile> 00035 #include <QtGui/QImageIOPlugin> 00036 #include <QtGui/QColor> 00037 00041 typedef enum { 00042 NONE = 0, /* No picture */ 00043 ODD = 1, /* Odd scanlines */ 00044 EVEN = 2, /* Even scanlines */ 00045 BOTH = 3 /* Every scanline */ 00046 } PICFields; 00047 00051 typedef enum { 00052 UNCOMPRESSED = 0, /* Image is uncompressed */ 00053 RLE = 2 /* Run length compression */ 00054 } PICChannelType; 00055 00059 typedef enum { 00060 RED = 0x80, /* Red channel */ 00061 GREEN = 0x40, /* Green channel */ 00062 BLUE = 0x20, /* Blue channel */ 00063 ALPHA = 0x10 /* Alpha channel */ 00064 } PICChannelCode; 00065 00069 typedef struct { 00070 qint32 magic; /* PIC_MAGIC_NUMBER */ 00071 float version; /* Version of format */ 00072 char comment[80]; /* Prototype description */ 00073 char id[4]; /* "PICT" */ 00074 qint16 width; /* Image width, in pixels */ 00075 qint16 height; /* Image height, in pixels */ 00076 float ratio; /* Pixel aspect ratio */ 00077 qint16 fields; /* Picture field type */ 00078 qint16 pad; /* Unused */ 00079 } PICHeader; 00080 00084 typedef struct { 00085 char chained; /* 1 if another packet follows, else 0 */ 00086 char size; /* Bits per pixel by channel */ 00087 char type; /* RLE or uncompressed */ 00088 char channel; /* Channel code (which planes are affected by this channel) */ 00089 } PICChannel; 00090 00091 #define HEADER_SIZE sizeof(PICHeader) 00092 #define CHANNEL_SIZE sizeof(PICChannel) 00093 00094 00102 bool picReadHeader(QIODevice *dev, PICHeader *hdr, bool peek = false); 00103 00105 void pic_read(QIODevice *dev, QImage *img); 00106 00108 void pic_write(QIODevice *dev, const QImage *img); 00109 00110 00111 #endif//__PIC_RW_H__
KDE 4.6 API Reference