Back to index

scribus-ng  1.3.4.dfsg+svn20071115
sccolorshade.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           sccolorshade.cpp  -  description
00009                              -------------------
00010     begin                : Sun Sep 9 2001
00011     copyright            : (C) 2001 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #include "sccolorshade.h"
00025 #include "sccolorengine.h"
00026 
00027 ScColorShade::ScColorShade(void)
00028 {
00029        color.setColor( 0, 0, 0, 0 );
00030        shade = 100;
00031 }
00032 
00033 ScColorShade::ScColorShade( const QColor& c, int level )
00034 {
00035        color = ScColor(c.red(), c.green(), c.blue());
00036        shade = level;
00037 }
00038 
00039 ScColorShade::ScColorShade( const ScColor& c, int level )
00040 {
00041        color = c;
00042        shade = level;
00043 }
00044 
00045 ScColor ScColorShade::getShadedColor(void)
00046 {
00047        ScColor value;
00048        if( color.getColorModel() == colorModelRGB )
00049        {
00050               RGBColor rgb;
00051               ScColorEngine::getShadeColorRGB(color, NULL, rgb, shade);
00052               value.setColorRGB( rgb.r, rgb.g, rgb.b );
00053        }
00054        else
00055        {
00056               CMYKColor cmyk;
00057               ScColorEngine::getShadeColorCMYK(color, NULL, cmyk, shade);
00058               value.setColor( cmyk.c, cmyk.m, cmyk.y, cmyk.k );
00059        }
00060        return value;
00061 }