Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

util_color.cpp File Reference

#include "util_color.h"
#include <QBitmap>
#include <QDateTime>
#include <QPainter>
#include <QCheckBox>
#include <QPixmap>
#include "scconfig.h"
#include "scribusdoc.h"
#include "scpixmapcache.h"
#include "commonstrings.h"
#include "util_icon.h"
#include "util.h"
#include "sccolorengine.h"
#include <jpeglib.h>
#include <jerror.h>

Include dependency graph for util_color.cpp:

Go to the source code of this file.

Defines

#define XMD_H

Functions

void handleOldColorShade (ScribusDoc *doc, QString &colName, int &shade)
 Associate a color shade to a document color according to pre-1.3.4cvs rgb shade calculation method, creating new document color if necessary.
QColor getOldColorShade (const QColor &color, int shade)
 Compute color shade of a rgb color using pre-1.3.4 method.
QColor getOldColorShade (uchar red, uchar green, uchar blue, int shade)
 Compute color shade of a rgb color using pre-1.3.4 method.
QImage ProofImage (QImage *Image, ScribusDoc *doc)
QColor SetColor (ScribusDoc *currentDoc, QString color, int shad)
QPixmap * getSmallPixmap (QColor rgb)
 Create a cool all-infos pixmaps for the specified color.
QPixmap * getWidePixmap (QColor rgb)
static quint64 code64 (const ScColor &col)
QPixmap * getFancyPixmap (const ScColor &col, ScribusDoc *doc)
void paintAlert (QPixmap &toPaint, QPixmap &target, int x, int y, bool useMask)
 Put toPaint pixmap into target at the x, y place. There is handled the alpha channel/transparency too. In the beginning is the target pixmap filled with all_transparent mask. In the case of the painting of tiPaint into x, y place, there is this pixmap enabled in alpha mask too.
unsigned char INT_MULT (unsigned char a, unsigned char b)
 Convert a color in RGB space to HSV space (Hue, Saturation, Value).
void RGBTOHSV (uchar &red, uchar &green, uchar &blue)
 Convert a color in HSV space to RGB space.
void HSVTORGB (uchar &hue, uchar &saturation, uchar &value)
 Convert a color in RGB space to HLS space (Hue, Lightness, Saturation).
void RGBTOHLS (uchar &red, uchar &green, uchar &blue)
double HLSVALUE (double n1, double n2, double hue)
 Implement the HLS "double hex-cone".
void HLSTORGB (uchar &hue, uchar &lightness, uchar &saturation)
 Convert a color in HLS space to RGB space.
double getCurveYValue (FPointArray &curve, double x, bool linear)
double Lum (uchar red, uchar green, uchar blue)
double LumD (double red, double green, double blue)
void setLum (uchar &red, uchar &green, uchar &blue, double lum)
void clipColor (double &red, double &green, double &blue)
QString colorSpaceText (int cs)
 return the translated colorspace name


Define Documentation

#define XMD_H

Definition at line 43 of file util_color.cpp.


Function Documentation

void clipColor ( double &  red,
double &  green,
double &  blue 
)

Definition at line 567 of file util_color.cpp.

References LumD().

Referenced by setLum().

static quint64 code64 ( const ScColor col  )  [static]

QString colorSpaceText ( int  cs  ) 

double getCurveYValue ( FPointArray curve,
double  x,
bool  linear 
)

QPixmap* getFancyPixmap ( const ScColor col,
ScribusDoc doc 
)

QColor getOldColorShade ( uchar  red,
uchar  green,
uchar  blue,
int  shade 
)

Compute color shade of a rgb color using pre-1.3.4 method.

Parameters:
red the red component.
green the green component.
blue the blue component.
shade shade value.

Definition at line 104 of file util_color.cpp.

QColor getOldColorShade ( const QColor &  color,
int  shade 
)

Compute color shade of a rgb color using pre-1.3.4 method.

Parameters:
color the base color
shade shade value.

Definition at line 97 of file util_color.cpp.

References getOldColorShade().

Referenced by getOldColorShade(), and handleOldColorShade().

QPixmap* getSmallPixmap ( QColor  rgb  ) 

Create a cool all-infos pixmaps for the specified color.

QPixmaps are really slow with Qt/Mac 3.3.4. Really, *really*, slow. So we better cache them.

Definition at line 162 of file util_color.cpp.

References p.

Referenced by getFancyPixmap().

QPixmap* getWidePixmap ( QColor  rgb  ) 

void handleOldColorShade ( ScribusDoc doc,
QString &  colName,
int &  shade 
)

Associate a color shade to a document color according to pre-1.3.4cvs rgb shade calculation method, creating new document color if necessary.

Parameters:
doc the scribus document
colName the color name (modified in place)
shade the color level (modified in place)

Definition at line 58 of file util_color.cpp.

References colorModelRGB, ScColor::fromQColor(), ScColor::getColorModel(), getOldColorShade(), ScColor::getRGB(), CommonStrings::None, and ScribusDoc::PageColors.

Referenced by Scribus13Format::GetItemText(), Scribus12Format::GetItemText(), Scribus12Format::GetStyle(), Scribus13Format::loadFile(), Scribus12Format::loadFile(), Scribus13Format::loadPage(), Scribus12Format::loadPage(), Scribus13Format::PasteItem(), and Scribus13Format::readParagraphStyle().

void HLSTORGB ( uchar hue,
uchar lightness,
uchar saturation 
)

Convert a color in HLS space to RGB space.

Parameters:
hue the hue component (modified in place).
lightness the lightness component (modified in place).
saturation the saturation component (modified in place).

Definition at line 456 of file util_color.cpp.

References HLSVALUE().

Referenced by ScImgDataLoader_TIFF::blendOntoTarget(), ScPainter::endLayer(), ScImgDataLoader_TIFF::loadLayerChannels(), and ScImgDataLoader_PSD::loadLayerChannels().

double HLSVALUE ( double  n1,
double  n2,
double  hue 
)

Implement the HLS "double hex-cone".

Parameters:
n1 lightness fraction (?)
n2 saturation fraction (?)
hue hue "angle".
Returns:
HLS value.

Definition at line 441 of file util_color.cpp.

Referenced by HLSTORGB().

void HSVTORGB ( uchar hue,
uchar saturation,
uchar value 
)

Convert a color in RGB space to HLS space (Hue, Lightness, Saturation).

Parameters:
red the red component (modified in place).
green the green component (modified in place).
blue the blue component (modified in place).

Definition at line 342 of file util_color.cpp.

References int(), and p.

Referenced by ScImgDataLoader_TIFF::blendOntoTarget(), ScImgDataLoader_TIFF::loadLayerChannels(), ScImgDataLoader_PSD::loadLayerChannels(), and ScImgDataLoader_PSD::LoadPSDResources().

unsigned char INT_MULT ( unsigned char  a,
unsigned char  b 
)

Convert a color in RGB space to HSV space (Hue, Saturation, Value).

Parameters:
red the red component (modified in place).
green the green component (modified in place).
blue the blue component (modified in place).

Definition at line 290 of file util_color.cpp.

Referenced by ScImgDataLoader_TIFF::blendOntoTarget(), ScPainter::endLayer(), ScImgDataLoader_TIFF::loadLayerChannels(), and ScImgDataLoader_PSD::loadLayerChannels().

double Lum ( uchar  red,
uchar  green,
uchar  blue 
)

Definition at line 541 of file util_color.cpp.

Referenced by ScPainter::endLayer(), and setLum().

double LumD ( double  red,
double  green,
double  blue 
)

Definition at line 546 of file util_color.cpp.

Referenced by clipColor().

void paintAlert ( QPixmap &  toPaint,
QPixmap &  target,
int  x = 0,
int  y = 0,
bool  useMask = true 
)

Put toPaint pixmap into target at the x, y place. There is handled the alpha channel/transparency too. In the beginning is the target pixmap filled with all_transparent mask. In the case of the painting of tiPaint into x, y place, there is this pixmap enabled in alpha mask too.

Parameters:
toPaint a pixmap to be painted into target
target a base pixmap. Some kind of painter.
x coordinate
y coordinate

Definition at line 264 of file util_color.cpp.

References p.

Referenced by CMYKChoose::CMYKChoose(), getFancyPixmap(), ColorFancyItemDelegate::redraw(), CMYKChoose::SelFromSwatch(), CMYKChoose::SelModel(), CMYKChoose::setColor(), and CMYKChoose::setColor2().

QImage ProofImage ( QImage *  Image,
ScribusDoc doc 
)

void RGBTOHLS ( uchar red,
uchar green,
uchar blue 
)

void RGBTOHSV ( uchar red,
uchar green,
uchar blue 
)

Convert a color in HSV space to RGB space.

Parameters:
hue the hue component (modified in place).
saturation the saturation component (modified in place).
value the value component (modified in place).

Definition at line 296 of file util_color.cpp.

Referenced by ScImgDataLoader_TIFF::blendOntoTarget(), ScImgDataLoader_TIFF::loadLayerChannels(), and ScImgDataLoader_PSD::loadLayerChannels().

QColor SetColor ( ScribusDoc currentDoc,
QString  color,
int  shad 
)

void setLum ( uchar red,
uchar green,
uchar blue,
double  lum 
)

Definition at line 551 of file util_color.cpp.

References clipColor(), and Lum().

Referenced by ScPainter::endLayer().

Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.