~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to core/libs/dimg/filters/levels/imagelevels.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Date        : 2004-07-29
7
7
 * Description : image levels manipulation methods.
8
8
 *
9
 
 * Copyright (C) 2004-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
 
 *
11
 
 * Some code parts are inspired from gimp 2.0
12
 
 * app/base/levels.c, gimplut.c, and app/base/gimpleveltool.c
13
 
 * source files.
14
 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
9
 * Copyright (C) 2004-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
15
10
 *
16
11
 * This program is free software; you can redistribute it
17
12
 * and/or modify it under the terms of the GNU General
61
56
namespace Digikam
62
57
{
63
58
 
64
 
class ImageLevels::ImageLevelsPriv
 
59
class ImageLevels::Private
65
60
{
66
61
 
67
62
public:
93
88
 
94
89
public:
95
90
 
96
 
    ImageLevelsPriv()
 
91
    Private()
97
92
    {
98
93
        levels = 0;
99
94
        lut    = 0;
111
106
};
112
107
 
113
108
ImageLevels::ImageLevels(bool sixteenBit)
114
 
    : d(new ImageLevelsPriv)
 
109
    : d(new Private)
115
110
{
116
 
    d->lut        = new ImageLevelsPriv::_Lut;
117
 
    d->levels     = new ImageLevelsPriv::_Levels;
118
 
    d->sixteenBit = sixteenBit;
 
111
    d->lut            = new Private::_Lut;
 
112
    d->levels         = new Private::_Levels;
 
113
    d->sixteenBit     = sixteenBit;
119
114
 
120
 
    memset(d->levels, 0, sizeof(struct ImageLevelsPriv::_Levels));
 
115
    memset(d->levels, 0, sizeof(struct Private::_Levels));
121
116
    d->lut->luts      = NULL;
122
117
    d->lut->nchannels = 0;
123
118
 
182
177
    d->dirty = false;
183
178
}
184
179
 
185
 
void ImageLevels::levelsAuto(ImageHistogram* hist)
 
180
void ImageLevels::levelsAuto(ImageHistogram* const hist)
186
181
{
187
182
    if (!d->levels || !hist)
188
183
    {
201
196
    d->dirty = true;
202
197
}
203
198
 
204
 
void ImageLevels::levelsChannelAuto(ImageHistogram* hist, int channel)
 
199
void ImageLevels::levelsChannelAuto(ImageHistogram* const hist, int channel)
205
200
{
206
201
    int    i;
207
202
    double count, new_count, percentage, next_percentage;
501
496
    }
502
497
}
503
498
 
504
 
void ImageLevels::levelsLutProcess(uchar* srcPR, uchar* destPR, int w, int h)
 
499
void ImageLevels::levelsLutProcess(uchar* const srcPR, uchar* const destPR, int w, int h)
505
500
{
506
501
    unsigned short* lut0 = NULL, *lut1 = NULL, *lut2 = NULL, *lut3 = NULL;
507
502
 
777
772
    for (i = 0 ; i < 5 ; ++i)
778
773
    {
779
774
        setLevelGammaValue(i, gamma[i]);
780
 
        setLevelLowInputValue(i, d->sixteenBit ? low_input[i] * 255 : low_input[i]);
781
 
        setLevelHighInputValue(i, d->sixteenBit ? high_input[i] * 255 : high_input[i]);
782
 
        setLevelLowOutputValue(i, d->sixteenBit ? low_output[i] * 255 : low_output[i]);
 
775
        setLevelLowInputValue(i,   d->sixteenBit ? low_input[i]   * 255 : low_input[i]);
 
776
        setLevelHighInputValue(i,  d->sixteenBit ? high_input[i]  * 255 : high_input[i]);
 
777
        setLevelLowOutputValue(i,  d->sixteenBit ? low_output[i]  * 255 : low_output[i]);
783
778
        setLevelHighOutputValue(i, d->sixteenBit ? high_output[i] * 255 : high_output[i]);
784
779
    }
785
780
 
809
804
        sprintf(buf, "%f", getLevelGammaValue(i));
810
805
 
811
806
        fprintf(file, "%d %d %d %d %s\n",
812
 
                d->sixteenBit ? getLevelLowInputValue(i) / 255  : getLevelLowInputValue(i),
 
807
                d->sixteenBit ? getLevelLowInputValue(i)  / 255 : getLevelLowInputValue(i),
813
808
                d->sixteenBit ? getLevelHighInputValue(i) / 255 : getLevelHighInputValue(i),
814
809
                d->sixteenBit ? getLevelLowOutputValue(i) / 255 : getLevelLowOutputValue(i),
815
810
                d->sixteenBit ? getLevelHighInputValue(i) / 255 : getLevelHighInputValue(i),