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

KImgIO

Defines | Functions

pic_read.cpp File Reference

#include "pic_rw.h"
#include <netinet/in.h>
#include <iostream>
#include <qimage.h>
#include <algorithm>
Include dependency graph for pic_read.cpp:

Go to the source code of this file.

Defines

#define CHANNEL_BYTE(ch, mask)   (( ch & mask) ? 1 : 0)
#define FAIL()

Functions

static int channels2bpp (char channels)
static int decodeRLE (QIODevice *dev, void *row, unsigned max, unsigned bpp, unsigned channels)
static unsigned getNumChannels (PICChannel *channels)
bool hasAlpha (PICChannel *channels)
static void makeComponentMap (unsigned channel, unsigned char *cmap)
static void pic2RGBA (unsigned char *src_pixel, unsigned char *target_pixel, unsigned char *cmap, unsigned components)
void pic_read (QIODevice *dev, QImage *result)
bool picReadHeader (QIODevice *dev, PICHeader *hdr, bool peek)
static bool readChannels (QIODevice *dev, PICChannel *channels, int &bpp)
static bool readRow (QIODevice *dev, unsigned *row, unsigned width, PICChannel *channels)

Define Documentation

#define CHANNEL_BYTE (   ch,
  mask 
)    (( ch & mask) ? 1 : 0)

Definition at line 61 of file pic_read.cpp.

#define FAIL ( )
Value:
{ \
    std::cout << "ERROR Reading PIC!" << std::endl; \
    return; \
}

Definition at line 245 of file pic_read.cpp.


Function Documentation

static int channels2bpp ( char  channels) [static]

Gets the channels definition and returns the number of bytes per pixel.

Parameters:
channelsThe channels bitfield
Returns:
The number of bytes per pixel

Definition at line 68 of file pic_read.cpp.

static int decodeRLE ( QIODevice *  dev,
void *  row,
unsigned  max,
unsigned  bpp,
unsigned  channels 
) [static]

Decodes a Run-lenght encoded chunk.

Parameters:
devThe device to read from
rowThe row pointer to write to
maxThe maximum length to write
channelsThe channels header
Returns:
The number of generated pixels

No repetitions

Definition at line 152 of file pic_read.cpp.

static unsigned getNumChannels ( PICChannel *  channels) [inline, static]

Counts the number of channels in the PICChannel header.

Parameters:
channelsThe header
Returns:
The number of used channels

Definition at line 132 of file pic_read.cpp.

bool hasAlpha ( PICChannel *  channels)

Definition at line 250 of file pic_read.cpp.

static void makeComponentMap ( unsigned  channel,
unsigned char *  cmap 
) [inline, static]

Makes a component map based on the channels info.

Parameters:
channelsThe channel information
cmapThe component map to be built

Definition at line 101 of file pic_read.cpp.

static void pic2RGBA ( unsigned char *  src_pixel,
unsigned char *  target_pixel,
unsigned char *  cmap,
unsigned  components 
) [inline, static]

Converts a PIC pixel to 32bits RGBA.

Parameters:
src_pixelThe source PIC pixel as readed from file
target_pixelThe target buffer where to write the pixel info
cmapThe component map that maps each component in PIC format to RGBA format
componentsThe number of components in the source pixel

Definition at line 121 of file pic_read.cpp.

void pic_read ( QIODevice *  dev,
QImage *  result 
)

KDE image reading function.

Pic read handler for Qt / KDE.

Must have this exact name in order to work

Definition at line 264 of file pic_read.cpp.

bool picReadHeader ( QIODevice *  dev,
PICHeader *  hdr,
bool  peek 
)

PIC_RW - Qt PIC Support Copyright (C) 2007 Ruben Lopez <r.lopez@bren.es>

Reads the PIC header and checks that it is OK.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ---------------------------------------------------------------------------- Reads the PIC header and checks that it is OK

Parameters:
devThe QT device to read from
hdrA pointer to the PIC header
peekKeep bytes in the device
Returns:
true on success

Definition at line 41 of file pic_read.cpp.

static bool readChannels ( QIODevice *  dev,
PICChannel *  channels,
int &  bpp 
) [static]

Reads the channels info.

Parameters:
devThe QT device to read from
channelsA pointer to 8 channels
Returns:
true on success

Definition at line 81 of file pic_read.cpp.

static bool readRow ( QIODevice *  dev,
unsigned *  row,
unsigned  width,
PICChannel *  channels 
) [static]

Reads a row from the file.

Parameters:
devThe device to read from
rowThe row pointer to write to
widthThe image width
bppThe bytes per pixel
channelsThe channels header info

Definition at line 215 of file pic_read.cpp.

KImgIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal