Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/home/landauf/painter/miniproject/image/imagergba.cpp File Reference

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <math.h>
#include "imagergba.h"
#include "clip.h"
#include <tiff.h>
#include <tiffio.h>

Go to the source code of this file.

Defines

#define HAVE_BIGENDIAN   (*(unsigned short *)"12" == 0x3132)
#define SWAP_UINT32(x)   (( ((unsigned long)(x) << 24) | ((((unsigned long)(x)) & 0x0000ff00UL) << 8) | ((((unsigned long)(x)) & 0x00ff0000UL) >> 8) | ( ((unsigned long)(x)) >> 24)))

Functions

ImageRGBAimageRgbaNew (int width, int height)
 Creates a new rgba image.

void imageRgbaFree (ImageRGBA *img)
 Deletes an rgba image.

ImageRGBAimageRgbaClone (const ImageRGBA *img)
 Creates a copy of an rgba image.

void imageRgbaCopy (const ImageRGBA *src, const ImageRGBA *dest)
 Writes an rgba image \src to an rgba image \dest. Both images must have the same extensions.

void imageRgbaClear (ImageRGBA *img)
 Clears an rgba image.

void imageRgbaSet (ImageRGBA *img, unsigned r, unsigned g, unsigned b, unsigned a)
 Sets all pixels in the image to a given value.

void imageRgbaSetArea (ImageRGBA *img, int x0, int y0, int x1, int y1, Rgba color)
ImageRGBAimageRgbaReadTIFF (const char *fname)
 Reads an rgba image from a TIFF file.

int imageRgbaWriteTIFF (const char *fname, const ImageRGBA *img)
 Writes an rgba image as a TIFF file.

void imageRgbaDrawLine (ImageRGBA *img, int x0, int y0, int x1, int y1, Rgba colorValue, int lx0, int ly0, int lx1, int ly1)
 Draws a line into a color image.

void imageRgbaInvertLine (ImageRGBA *img, int x0, int y0, int x1, int y1, int lx0, int ly0, int lx1, int ly1)
 Draws a line into a color image by inverting pixels.

void imageRgbaDrawHorizontalAreaLine (ImageRGBA *img, int x0, int x1, int y, int colorOffset)
void imageRgbaDrawVerticalAreaLine (ImageRGBA *img, int y0, int y1, int x, int colorOffset)
void imageRgbaDrawEllipse (ImageRGBA *img, int cx, int cy, int halfaxis_x, int halfaxis_y, Rgba colorValue, int lx0, int ly0, int lx1, int ly1)
 Draws an ellipse into a color image.

void imageRgbaInvertEllipse (ImageRGBA *img, int cx, int cy, int halfaxis_x, int halfaxis_y)
 Draws an ellipse into a color image by inverting pixels.

void imageRgbaDrawPoint (ImageRGBA *img, int x, int y, Rgba colorValue)
 Draws a single-pixel sized point into a color image.

void imageRgbaDrawInvertedPoint (ImageRGBA *img, int x, int y)
 Draws a single-pixel sized point into a color image by inverting the pixel.

Rgba imageRgbaInterpolate (ImageRGBA *img, float x, float y)
int imageRgbaInterpolateSubImage (ImageRGBA *img, float x, float y, int w, int h, int offset)
Rgba imageRgbaInterpolateColors (float x, float y, Rgba topleft, Rgba topright, Rgba bottomleft, Rgba bottomright)
Hsva RGBtoHSV (Rgba RGBColor)
Rgba HSVtoRGB (Hsva HSVColor)
void gaussian (ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, int mode, unsigned char calc)
void horizontal_blur (ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, int mode, unsigned char calc)
void vertical_blur (ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, int mode, unsigned char calc)
void motion_blur (ImageRGBA *img, ImageRGBA *temp2, int lowAreaX, int lowAreaY, int highAreaX, int highAreaY, float value1, float value2, int mode, unsigned char calc)
void holdHighest (int *stack, int numElements, int newElement)


Define Documentation

#define HAVE_BIGENDIAN   (*(unsigned short *)"12" == 0x3132)
 

Definition at line 21 of file imagergba.cpp.

#define SWAP_UINT32      (( ((unsigned long)(x) << 24) | ((((unsigned long)(x)) & 0x0000ff00UL) << 8) | ((((unsigned long)(x)) & 0x00ff0000UL) >> 8) | ( ((unsigned long)(x)) >> 24)))
 

Definition at line 23 of file imagergba.cpp.

Referenced by imageRgbaReadTIFF().


Function Documentation

void gaussian ImageRGBA   img,
ImageRGBA   temp2,
int    lowAreaX,
int    lowAreaY,
int    highAreaX,
int    highAreaY,
float    value1,
int    mode,
unsigned char    calc
 

Definition at line 910 of file imagergba.cpp.

References horizontal_blur(), and vertical_blur().

Referenced by chrome::LBAction(), relief::LBAction(), bw::LBAction(), cutout::LBAction(), strokes::LBAction(), sharpen::LBAction(), halfblur::LBAction(), whiteblur::LBAction(), and blackblur::LBAction().

void holdHighest int *    stack,
int    numElements,
int    newElement
 

Definition at line 1267 of file imagergba.cpp.

Referenced by cutout::LBAction().

void horizontal_blur ImageRGBA   img,
ImageRGBA   temp2,
int    lowAreaX,
int    lowAreaY,
int    highAreaX,
int    highAreaY,
float    value1,
int    mode,
unsigned char    calc
 

Definition at line 939 of file imagergba.cpp.

References Rgba::a, Rgba::b, ImageRGBA::data, Rgba::g, Rgba::r, and ImageRGBA::width.

Referenced by gaussian(), starlight::LBAction(), and blur::LBAction().

Rgba HSVtoRGB Hsva    HSVColor
 

Definition at line 852 of file imagergba.cpp.

References Rgba::a, Hsva::a, Rgba::b, Rgba::g, Hsva::h, Rgba::r, Hsva::s, and Hsva::v.

Referenced by hue::action(), colorize::action(), and effect::showMenu().

void imageRgbaClear ImageRGBA   img
 

Clears an rgba image.

All pixels in the image are set to white, and alpha=255. So, a call to imageRgbaClear(img) is identical to imageRgbaClear(img, 255, 255, 255, 255).

Parameters:
img  the image to be cleared

Definition at line 118 of file imagergba.cpp.

References ImageRGBA::bytesPerPixel, and imageRgbaSet().

ImageRGBA* imageRgbaClone const ImageRGBA   img
 

Creates a copy of an rgba image.

The copy has got the same extent and image data.

Parameters:
img  source image
Returns:
a pointer to the new ImageRGBA struct

Definition at line 81 of file imagergba.cpp.

References ImageRGBA::bytesPerPixel, ImageRGBA::data, ImageRGBA::height, imageRgbaNew(), and ImageRGBA::width.

Referenced by main().

void imageRgbaCopy const ImageRGBA   src,
const ImageRGBA   dest
 

Writes an rgba image \src to an rgba image \dest. Both images must have the same extensions.

src and dest have got the same extents.

Parameters:
src  source image
dest  source image

Definition at line 102 of file imagergba.cpp.

References ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by blackblur::blackblur(), blur::blur(), box::box(), brightness::brightness(), brush::brush(), bubble::bubble(), buttonize::buttonize(), bw::bw(), draw::changeMode(), channel::channel(), chrome::chrome(), colorize::colorize(), comb::comb(), contrast::contrast(), cutout::cutout(), dots::dots(), draw::draw(), edge::edge(), emboss::emboss(), glass::glass(), gray::gray(), halfblur::halfblur(), hue::hue(), draw::idleAction(), invert::invert(), keyboardCB(), twirl::keyLEFT(), twirl::keyRIGHT(), draw::LB(), chrome::LBAction(), relief::LBAction(), bw::LBAction(), cutout::LBAction(), strokes::LBAction(), telescope::LBAction(), blur::LBAction(), halfblur::LBAction(), lens::lens(), lines::lines(), mosaic::mosaic(), noise::noise(), posterize::posterize(), color::RBAction(), geometric::RBAction(), distort::RBAction(), matrices::RBAction(), artistic::RBAction(), scroll::RBAction(), draw::RBAction(), relief::relief(), resetImage(), rgbdots::rgbdots(), ripple::ripple(), saturation::saturation(), scroll::scroll(), separate::separate(), sharpen::sharpen(), shine::shine(), solarize::solarize(), spatter::spatter(), starlight::starlight(), strokes::strokes(), telescope::telescope(), twirl::twirl(), wave::wave(), and whiteblur::whiteblur().

void imageRgbaDrawEllipse ImageRGBA   img,
int    cx,
int    cy,
int    halfaxis_x,
int    halfaxis_y,
Rgba    colorValue,
int    lx0 = 0,
int    ly0 = 0,
int    lx1 = -1,
int    ly1 = -1
 

Draws an ellipse into a color image.

The ellipse is drawn with pixels of color colorValue around the center point (cx, cy) with half-axes in x- and y-direction (halfaxis_x, halfaxis_y).

Definition at line 489 of file imagergba.cpp.

References ImageRGBA::height, imageRgbaDrawPoint(), and ImageRGBA::width.

Referenced by glass::drawLightningMenu(), and draw::idleAction().

void imageRgbaDrawHorizontalAreaLine ImageRGBA   img,
int    x0,
int    x1,
int    y,
int    colorOffset
 

Definition at line 446 of file imagergba.cpp.

References Rgba::a, Rgba::b, ImageRGBA::data, Rgba::g, Rgba::r, and ImageRGBA::width.

Referenced by effect::showArea().

void imageRgbaDrawInvertedPoint ImageRGBA   img,
int    x,
int    y
[inline]
 

Draws a single-pixel sized point into a color image by inverting the pixel.

The point is drawn at position (x, y).

Definition at line 633 of file imagergba.cpp.

References ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by draw::idleAction(), and imageRgbaInvertEllipse().

void imageRgbaDrawLine ImageRGBA   img,
int    x0,
int    y0,
int    x1,
int    y1,
Rgba    colorValue,
int    lx0 = 0,
int    ly0 = 0,
int    lx1 = -1,
int    ly1 = -1
 

Draws a line into a color image.

The line is drawn with pixels of color colorValue from the point (x0, y0) to (x1, y1).

Definition at line 292 of file imagergba.cpp.

References clip(), ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by glass::drawLightningMenu(), draw::idleAction(), and strokes::LBAction().

void imageRgbaDrawPoint ImageRGBA   img,
int    x,
int    y,
Rgba    colorValue
[inline]
 

Draws a single-pixel sized point into a color image.

The point is drawn with a color colorValue at position (x, y).

Definition at line 623 of file imagergba.cpp.

References ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by imageRgbaDrawEllipse().

void imageRgbaDrawVerticalAreaLine ImageRGBA   img,
int    y0,
int    y1,
int    x,
int    colorOffset
 

Definition at line 466 of file imagergba.cpp.

References Rgba::a, Rgba::b, ImageRGBA::data, Rgba::g, Rgba::r, and ImageRGBA::width.

Referenced by effect::showArea().

void imageRgbaFree ImageRGBA   img
 

Deletes an rgba image.

The memory used by the image is freed. All pointers to the image become invalid. After use, the created image must be deleted by imageRgbaFree().

Parameters:
img  the image to be deleted

Definition at line 66 of file imagergba.cpp.

References ImageRGBA::bytesPerPixel, and ImageRGBA::data.

Referenced by imageRgbaReadTIFF(), and main().

Rgba imageRgbaInterpolate ImageRGBA   img,
float    x,
float    y
 

Definition at line 647 of file imagergba.cpp.

References Rgba::a, Rgba::b, ImageRGBA::data, Rgba::g, ImageRGBA::height, Rgba::r, and ImageRGBA::width.

Referenced by telescope::idleAction(), ripple::idleAction(), bubble::idleAction(), lens::idleAction(), twirl::idleAction(), and wave::idleAction().

Rgba imageRgbaInterpolateColors float    x,
float    y,
Rgba    topleft,
Rgba    topright,
Rgba    bottomleft,
Rgba    bottomright
 

Definition at line 766 of file imagergba.cpp.

References Rgba::a, Rgba::b, Rgba::g, and Rgba::r.

Referenced by dots::LBAction().

int imageRgbaInterpolateSubImage ImageRGBA   img,
float    x,
float    y,
int    w,
int    h,
int    offset
 

Definition at line 706 of file imagergba.cpp.

References ImageRGBA::data, and Rgba::r.

Referenced by glass::LBAction().

void imageRgbaInvertEllipse ImageRGBA   img,
int    cx,
int    cy,
int    a,
int    b
 

Draws an ellipse into a color image by inverting pixels.

The ellipse is drawn around the center point (c0, c1) to (x1, y1).

Definition at line 563 of file imagergba.cpp.

References imageRgbaDrawInvertedPoint().

Referenced by draw::idleAction(), telescope::idleAction(), and telescope::LBAction().

void imageRgbaInvertLine ImageRGBA   img,
int    x0,
int    y0,
int    x1,
int    y1,
int    lx0 = 0,
int    ly0 = 0,
int    lx1 = -1,
int    ly1 = -1
 

Draws a line into a color image by inverting pixels.

The line is drawn from the point (x0, y0) to (x1, y1).

Definition at line 365 of file imagergba.cpp.

References clip(), ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by draw::idleAction().

ImageRGBA* imageRgbaNew int    width,
int    height
 

Creates a new rgba image.

After use, the image must be deleted by imageRgbaFree().

Parameters:
width  width of the new image in pixels
height  height of the new image in pixels
Returns:
a pointer to the new ImageRGBA struct

Definition at line 43 of file imagergba.cpp.

References ImageRGBA::bytesPerPixel, ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by imageRgbaClone(), imageRgbaReadTIFF(), and main().

ImageRGBA* imageRgbaReadTIFF const char *    fname
 

Reads an rgba image from a TIFF file.

The image is read from a file named fname. If the file doesn't exist, or the file is no valid TIFF file, NULL is returned.

Parameters:
fname  filename
Returns:
the read image; NULL on error

Definition at line 158 of file imagergba.cpp.

References ImageRGBA::data, ImageRGBA::height, imageRgbaFree(), imageRgbaNew(), SWAP_UINT32, and ImageRGBA::width.

Referenced by main().

void imageRgbaSet ImageRGBA   img,
unsigned    r,
unsigned    g,
unsigned    b,
unsigned    a
 

Sets all pixels in the image to a given value.

All pixels in the image are set to (r, g, b, a).

Parameters:
img  the destination image

Definition at line 130 of file imagergba.cpp.

References ImageRGBA::bytesPerPixel, ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by imageRgbaClear(), main(), and effect::showHud().

void imageRgbaSetArea ImageRGBA   img,
int    x0,
int    y0,
int    x1,
int    y1,
Rgba    color
 

Definition at line 145 of file imagergba.cpp.

References ImageRGBA::data, and ImageRGBA::width.

Referenced by starlight::LBAction(), shine::LBAction(), strokes::LBAction(), dots::LBAction(), rgbdots::LBAction(), and blur::LBAction().

int imageRgbaWriteTIFF const char *    fname,
const ImageRGBA   img
 

Writes an rgba image as a TIFF file.

The image is written to a file named fname. If the file doesn't exist, a new one is created. Otherwise, the existing file is overwritten. If an error occurs, an error value !=0 is returned.

Parameters:
fname  filename
Returns:
0 on success

Definition at line 234 of file imagergba.cpp.

References ImageRGBA::bytesPerPixel, ImageRGBA::data, ImageRGBA::height, and ImageRGBA::width.

Referenced by batch(), keyboardCB(), and effect::useMenu().

void motion_blur ImageRGBA   img,
ImageRGBA   temp2,
int    lowAreaX,
int    lowAreaY,
int    highAreaX,
int    highAreaY,
float    value1,
float    value2,
int    mode,
unsigned char    calc
 

Definition at line 1149 of file imagergba.cpp.

References Rgba::a, Rgba::b, ImageRGBA::data, Rgba::g, M_PI, Rgba::r, and ImageRGBA::width.

Referenced by starlight::LBAction(), and blur::LBAction().

Hsva RGBtoHSV Rgba    RGBColor
 

Definition at line 806 of file imagergba.cpp.

References Hsva::a, Rgba::a, Rgba::b, Rgba::g, Hsva::h, Rgba::r, Hsva::s, and Hsva::v.

Referenced by hue::action(), and colorize::action().

void vertical_blur ImageRGBA   img,
ImageRGBA   temp2,
int    lowAreaX,
int    lowAreaY,
int    highAreaX,
int    highAreaY,
float    value1,
int    mode,
unsigned char    calc
 

Definition at line 1044 of file imagergba.cpp.

References Rgba::a, Rgba::b, ImageRGBA::data, Rgba::g, Rgba::r, and ImageRGBA::width.

Referenced by gaussian(), starlight::LBAction(), and blur::LBAction().


Generated on Mon Jan 30 09:13:03 2006 for Painter Framework by doxygen1.2.18