Skip to content

Commit

Permalink
Merge branch 'release-0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
aferrero2707 committed May 25, 2015
2 parents 8df29b3 + e73bf99 commit ed18ed7
Show file tree
Hide file tree
Showing 27 changed files with 942 additions and 214 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
=========================================
Version 0.1.1

- Added file name widget to RAW loader dialog. This allows
to edit multiple RAW files simultaneously in the same image.

- Added digital watermarking tool based on G'MIC "watermark_fourier" filter.

- Modified Hue/saturation and brightess/contrast tools to work correctly also in Lab colorspace.
- Fixed computation of saturation adjustment. Now the saturation slider produces exactly the same
output as the equivalent tool in GIMP (except that computations are in 32-bits floating point
precision and are applied non-destructively). Internally, the hue/saturation tool now works
in the HSL colorspace like GIMP (instead of the HSV colorspace used before).

- Moved "RAW developer" tool into "Load" tab and removed "raw" tab.
- Moved "Color profle conversion" tool into "Color" tab and removed "conv" tab.

- Quality of Jpeg output set to "100".

=========================================
Version 0.1.0

Expand Down
3 changes: 1 addition & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
0.1.0

0.1.1
48 changes: 48 additions & 0 deletions src/base/color.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
*/

/*
Copyright (C) 2014 Ferrero Andrea
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
These files are distributed with PhotoFlow - http://aferrero2707.github.io/PhotoFlow/
*/


#include "color.hh"


float PF::hsl_value( float n1, float n2, float hue)
{
float val;

if( hue > 6.0 ) hue -= 6.0f;
else if( hue < 0 ) hue += 6.0f;

if( hue < 1.0 ) val = n1 + (n2-n1)*hue;
else if( hue < 3.0 ) val = n2;
else if( hue < 4.0 ) val = n1 + (n2-n1)*(4.0f-hue);
else val = n1;

return val;
}

69 changes: 69 additions & 0 deletions src/base/color.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace PF
out = static_cast<T>( (in*FormatInfo<T>::RANGE)-FormatInfo<T>::MIN );
}


//
template<class T>
void rgb2hsv(const T& r, const T& g, const T& b, float& h, float& s, float& v)
Expand Down Expand Up @@ -204,6 +205,9 @@ namespace PF
R += Min;
G += Min;
B += Min;
if(R>1) R=1; else if(R<0) R=0;
if(G>1) G=1; else if(G<0) G=0;
if(B>1) B=1; else if(B<0) B=0;
from_float(R, r);
from_float(G, g);
from_float(B, b);
Expand All @@ -212,6 +216,71 @@ namespace PF



//
template<class T>
void rgb2hsl(const T& r, const T& g, const T& b, float& h, float& s, float& l)
{
float fr, fg, fb; to_float( r, fr ); to_float( g, fg ); to_float( b, fb );
float min = MIN3(fr, fg, fb);
float max = MAX3(fr, fg, fb);
float sum = max+min;
float delta = max-min;

l = sum/2.0f;

s = h = 0;

if( delta == 0 ) return;

if( l <= 0.5 )
s = (max-min)/sum;
else
s = (max-min)/(2.0f-max-min);

if( fr == max ) h = (fg-fb)/delta;
else if( fg == max ) h = (fb-fr)/delta + 2.0f;
else if( fb == max ) h = (fr-fg)/delta + 4.0f;
h *= 60;
if( h < 0 ) h += 360;
}



float hsl_value( float n1, float n2, float hue);

//
template<class T>
void hsl2rgb( const float& h, const float& s, const float& l, T& r, T& g, T& b )
{
int i;
float H = h/60.0f;

if( s == 0 ) {
// achromatic (grey)
from_float( l, r );
g = b = r;
return;
}

float m1, m2;
if( l <= 0.5 )
m2 = l * (s + 1);
else
m2 = l + s - l * s;

m1 = l * 2.0f - m2;

float fr = hsl_value( m1, m2, H + 2.0f );
float fg = hsl_value( m1, m2, H );
float fb = hsl_value( m1, m2, H - 2.0f );

from_float( fr, r );
from_float( fg, g );
from_float( fb, b );
}



// Computes the luminance value of a given RGB triplet
template<class T>
T luminance(const T& r, const T& g, const T& b)
Expand Down
Loading

0 comments on commit ed18ed7

Please sign in to comment.