diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2007-09-28 15:31:46 +0000 |
|---|---|---|
| committer | tavmjong <tavmjong@users.sourceforge.net> | 2007-09-28 15:31:46 +0000 |
| commit | 01a2a8201f5e79ae92dbcd6bc590a4c576d81782 (patch) | |
| tree | 934a5ed327ae11090f9bacc15d64588b6c0fbca8 /src | |
| parent | Fixed color sliders and calculation (diff) | |
| download | inkscape-01a2a8201f5e79ae92dbcd6bc590a4c576d81782.tar.gz inkscape-01a2a8201f5e79ae92dbcd6bc590a4c576d81782.zip | |
Color Matrix Filter:
Matrix mode: set default to Identity matrix.
Matrix mode: multiply 5th column by 255.
Hue Rotation mode: convert degrees to radians for sin/cos.
(bzr r3811)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/nr-filter-colormatrix.cpp | 14 | ||||
| -rw-r--r-- | src/ui/dialog/filter-effects-dialog.cpp | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp index 74394bfc1..3ed193984 100644 --- a/src/display/nr-filter-colormatrix.cpp +++ b/src/display/nr-filter-colormatrix.cpp @@ -47,7 +47,7 @@ int FilterColorMatrix::render(FilterSlot &slot, Matrix const &trans) { switch(type){ case COLORMATRIX_MATRIX: if (values.size()!=20) { - g_warning("ColorMatrix: values parameter error. Wrong size."); + g_warning("ColorMatrix: values parameter error. Wrong size: %i.", values.size()); return -1; } for (x=x0;x<x1;x++){ @@ -57,10 +57,10 @@ int FilterColorMatrix::render(FilterSlot &slot, Matrix const &trans) { g = in_data[i+1]; b = in_data[i+2]; a = in_data[i+3]; - out_data[i] = CLAMP_D_TO_U8( r*values[0] + g*values[1] + b*values[2] + a*values[3] + values[4] ); - out_data[i+1] = CLAMP_D_TO_U8( r*values[5] + g*values[6] + b*values[7] + a*values[8] + values[9] ); - out_data[i+2] = CLAMP_D_TO_U8( r*values[10] + g*values[11] + b*values[12] + a*values[13] + values[14] ); - out_data[i+3] = CLAMP_D_TO_U8( r*values[15] + g*values[16] + b*values[17] + a*values[18] + values[19] ); + out_data[i] = CLAMP_D_TO_U8( r*values[0] + g*values[1] + b*values[2] + a*values[3] + 255*values[4] ); + out_data[i+1] = CLAMP_D_TO_U8( r*values[5] + g*values[6] + b*values[7] + a*values[8] + 255*values[9] ); + out_data[i+2] = CLAMP_D_TO_U8( r*values[10] + g*values[11] + b*values[12] + a*values[13] + 255*values[14] ); + out_data[i+3] = CLAMP_D_TO_U8( r*values[15] + g*values[16] + b*values[17] + a*values[18] + 255*values[19] ); } } break; @@ -80,8 +80,8 @@ int FilterColorMatrix::render(FilterSlot &slot, Matrix const &trans) { } break; case COLORMATRIX_HUEROTATE: - coshue = cos(value); - sinhue = sin(value); + coshue = cos(value * M_PI/180.0); + sinhue = sin(value * M_PI/180.0); a00 = 0.213 + coshue*( 0.787) + sinhue*(-0.213); a01 = 0.715 + coshue*(-0.715) + sinhue*(-0.715); a02 = 0.072 + coshue*(-0.072) + sinhue*( 0.928); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 4ea5faf13..dc6fc06bb 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -423,8 +423,9 @@ private: for(int r = 0; r < rows; ++r) { Gtk::TreeRow row = *(_model->append()); + // Default to identity matrix for(int c = 0; c < cols; ++c, ++ndx) - row[_columns.cols[c]] = ndx < (int)values->size() ? (*values)[ndx] : 0; + row[_columns.cols[c]] = ndx < (int)values->size() ? (*values)[ndx] : (r == c ? 1 : 0); } } } |
