• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KImgIO

  • kimgio
pcx.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2002-2003 Nadeem Hasan <nhasan@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the Lesser GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8*/
9
10#ifndef PCX_H
11#define PCX_H
12
13
14#include <kdemacros.h>
15#include <QtGui/QImageIOPlugin>
16#include <QtCore/QDataStream>
17#include <QtGui/QColor>
18
19class PCXHandler : public QImageIOHandler
20{
21public:
22 PCXHandler();
23
24 bool canRead() const;
25 bool read(QImage *image);
26 bool write(const QImage &image);
27
28 QByteArray name() const;
29
30 static bool canRead(QIODevice *device);
31};
32
33class RGB
34{
35 public:
36 quint8 r;
37 quint8 g;
38 quint8 b;
39
40 static RGB from( const QRgb &color)
41 {
42 RGB c;
43 c.r = qRed( color );
44 c.g = qGreen( color );
45 c.b = qBlue( color );
46 return c;
47 }
48
49} KDE_PACKED;
50
51class Palette
52{
53 public:
54 void setColor( int i, const QRgb color )
55 {
56 RGB &c = rgb[ i ];
57 c.r = qRed( color );
58 c.g = qGreen( color );
59 c.b = qBlue( color );
60 }
61
62 QRgb color( int i ) const
63 {
64 return qRgb( rgb[ i ].r, rgb[ i ].g, rgb[ i ].b );
65 }
66
67 class RGB rgb[ 16 ];
68} KDE_PACKED;
69
70class PCXHEADER
71{
72 public:
73 PCXHEADER();
74
75 inline int width() const { return ( XMax-XMin ) + 1; }
76 inline int height() const { return ( YMax-YMin ) + 1; }
77 inline bool isCompressed() const { return ( Encoding==1 ); }
78
79 quint8 Manufacturer; // Constant Flag, 10 = ZSoft .pcx
80 quint8 Version; // Version information·
81 // 0 = Version 2.5 of PC Paintbrush·
82 // 2 = Version 2.8 w/palette information·
83 // 3 = Version 2.8 w/o palette information·
84 // 4 = PC Paintbrush for Windows(Plus for
85 // Windows uses Ver 5)·
86 // 5 = Version 3.0 and > of PC Paintbrush
87 // and PC Paintbrush +, includes
88 // Publisher's Paintbrush . Includes
89 // 24-bit .PCX files·
90 quint8 Encoding; // 1 = .PCX run length encoding
91 quint8 Bpp; // Number of bits to represent a pixel
92 // (per Plane) - 1, 2, 4, or 8·
93 quint16 XMin;
94 quint16 YMin;
95 quint16 XMax;
96 quint16 YMax;
97 quint16 HDpi;
98 quint16 YDpi;
99 Palette ColorMap;
100 quint8 Reserved; // Should be set to 0.
101 quint8 NPlanes; // Number of color planes
102 quint16 BytesPerLine; // Number of bytes to allocate for a scanline
103 // plane. MUST be an EVEN number. Do NOT
104 // calculate from Xmax-Xmin.·
105 quint16 PaletteInfo; // How to interpret palette- 1 = Color/BW,
106 // 2 = Grayscale ( ignored in PB IV/ IV + )·
107 quint16 HScreenSize; // Horizontal screen size in pixels. New field
108 // found only in PB IV/IV Plus
109 quint16 VScreenSize; // Vertical screen size in pixels. New field
110 // found only in PB IV/IV Plus
111} KDE_PACKED;
112
113#endif // PCX_H
114
115/* vim: et sw=2 ts=2
116*/
PCXHEADER
Definition: pcx.h:71
PCXHEADER::YDpi
quint16 YDpi
Definition: pcx.h:98
PCXHEADER::width
int width() const
Definition: pcx.h:75
PCXHEADER::BytesPerLine
quint16 BytesPerLine
Definition: pcx.h:102
PCXHEADER::XMax
quint16 XMax
Definition: pcx.h:95
PCXHEADER::YMin
quint16 YMin
Definition: pcx.h:94
PCXHEADER::VScreenSize
quint16 VScreenSize
Definition: pcx.h:109
PCXHEADER::Encoding
quint8 Encoding
Definition: pcx.h:90
PCXHEADER::NPlanes
quint8 NPlanes
Definition: pcx.h:101
PCXHEADER::PCXHEADER
PCXHEADER()
Definition: pcx.cpp:114
PCXHEADER::PaletteInfo
quint16 PaletteInfo
Definition: pcx.h:105
PCXHEADER::HScreenSize
quint16 HScreenSize
Definition: pcx.h:107
PCXHEADER::XMin
quint16 XMin
Definition: pcx.h:93
PCXHEADER::YMax
quint16 YMax
Definition: pcx.h:96
PCXHEADER::Manufacturer
quint8 Manufacturer
Definition: pcx.h:79
PCXHEADER::HDpi
quint16 HDpi
Definition: pcx.h:97
PCXHEADER::Reserved
quint8 Reserved
Definition: pcx.h:100
PCXHEADER::Bpp
quint8 Bpp
Definition: pcx.h:91
PCXHEADER::Version
quint8 Version
Definition: pcx.h:80
PCXHEADER::isCompressed
bool isCompressed() const
Definition: pcx.h:77
PCXHEADER::ColorMap
Palette ColorMap
Definition: pcx.h:99
PCXHEADER::height
int height() const
Definition: pcx.h:76
PCXHandler
Definition: pcx.h:20
PCXHandler::write
bool write(const QImage &image)
Definition: pcx.cpp:515
PCXHandler::canRead
bool canRead() const
Definition: pcx.cpp:438
PCXHandler::PCXHandler
PCXHandler()
Definition: pcx.cpp:434
PCXHandler::read
bool read(QImage *image)
Definition: pcx.cpp:448
PCXHandler::name
QByteArray name() const
Definition: pcx.cpp:565
Palette
Definition: pcx.h:52
Palette::rgb
class RGB rgb[16]
Definition: pcx.h:67
Palette::color
QRgb color(int i) const
Definition: pcx.h:62
Palette::setColor
void setColor(int i, const QRgb color)
Definition: pcx.h:54
QImageIOHandler
RGB
Definition: pcx.h:34
RGB::from
static RGB from(const QRgb &color)
Definition: pcx.h:40
RGB::r
quint8 r
Definition: pcx.h:36
RGB::g
quint8 g
Definition: pcx.h:37
RGB::b
quint8 b
Definition: pcx.h:38
KDE_PACKED
class RGB KDE_PACKED
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KImgIO

Skip menu "KImgIO"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal