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 <QtCore/QFile> 00034 #include <QtGui/QImageIOPlugin> 00035 #include <QtGui/QColor> 00036 00040 typedef enum { 00041 NONE = 0, /* No picture */ 00042 ODD = 1, /* Odd scanlines */ 00043 EVEN = 2, /* Even scanlines */ 00044 BOTH = 3 /* Every scanline */ 00045 } PICFields; 00046 00050 typedef enum { 00051 UNCOMPRESSED = 0, /* Image is uncompressed */ 00052 RLE = 2 /* Run length compression */ 00053 } PICChannelType; 00054 00058 typedef enum { 00059 RED = 0x80, /* Red channel */ 00060 GREEN = 0x40, /* Green channel */ 00061 BLUE = 0x20, /* Blue channel */ 00062 ALPHA = 0x10 /* Alpha channel */ 00063 } PICChannelCode; 00064 00068 typedef struct { 00069 qint32 magic; /* PIC_MAGIC_NUMBER */ 00070 float version; /* Version of format */ 00071 char comment[80]; /* Prototype description */ 00072 char id[4]; /* "PICT" */ 00073 qint16 width; /* Image width, in pixels */ 00074 qint16 height; /* Image height, in pixels */ 00075 float ratio; /* Pixel aspect ratio */ 00076 qint16 fields; /* Picture field type */ 00077 qint16 pad; /* Unused */ 00078 } PICHeader; 00079 00083 typedef struct { 00084 char chained; /* 1 if another packet follows, else 0 */ 00085 char size; /* Bits per pixel by channel */ 00086 char type; /* RLE or uncompressed */ 00087 char channel; /* Channel code (which planes are affected by this channel) */ 00088 } PICChannel; 00089 00090 #define HEADER_SIZE sizeof(PICHeader) 00091 #define CHANNEL_SIZE sizeof(PICChannel) 00092 00093 00101 bool picReadHeader(QIODevice *dev, PICHeader *hdr, bool peek = false); 00102 00104 void pic_read(QIODevice *dev, QImage *img); 00105 00107 void pic_write(QIODevice *dev, const QImage *img); 00108 00109 00110 #endif//__PIC_RW_H__
KDE 4.7 API Reference