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

KImgIO

  • sources
  • kde-4.12
  • kdelibs
  • kimgio
Macros | 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.

Macros

#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)
 

Macro Definition 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)
inlinestatic

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 
)
inlinestatic

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 
)
inlinestatic

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.lop.nosp@m.ez@b.nosp@m.ren.e.nosp@m.s

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.

This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:50 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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