Changeset 69365
- Timestamp:
- Sep 4, 2016, 9:54:56 AM (8 years ago)
- File:
-
- 1 edited
-
sandbox/alexandris/i.rgb.his/rgb2his.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sandbox/alexandris/i.rgb.his/rgb2his.c
r69364 r69365 20 20 #include <math.h> 21 21 22 /* 23 * (input/output) rowbuffer 24 * columns 25 * maximum level of range 2^bit_depth 26 */ 22 27 23 28 void rgb2his(DCELL *rowbuffer[3], int columns, double max_level) 29 24 30 { 25 31 int column; /* column indicator */ … … 36 42 for (column = 0; column < columns; column++) { 37 43 38 if (Rast_is_d_null_value(&rowbuffer[0][column]) ||39 Rast_is_d_null_value(&rowbuffer[1][column]) ||40 Rast_is_d_null_value(&rowbuffer[2][column])) {44 if (Rast_is_d_null_value(&rowbuffer[0][column]) || 45 Rast_is_d_null_value(&rowbuffer[1][column]) || 46 Rast_is_d_null_value(&rowbuffer[2][column])) { 41 47 Rast_set_d_null_value(&rowbuffer[0][column], 1); 42 48 Rast_set_d_null_value(&rowbuffer[1][column], 1); … … 84 90 85 91 /* undefined -- (how to) set to NULL? */ 86 hue = 0.0;92 hue = -1; 87 93 88 rowbuffer[0][column] = (FCELL)hue;89 rowbuffer[1][column] = (FCELL)saturation;90 rowbuffer[2][column] = (FCELL)lightness;91 94 } 92 95 … … 113 116 hue += 360.0; 114 117 115 /* HSL output values */ 118 } 119 120 /* HSL output values */ 121 if (hue == -1.0) { 122 Rast_set_d_null_value(&rowbuffer[0][column], 1); 123 } 124 else 125 { 116 126 rowbuffer[0][column] = (FCELL)hue; 117 rowbuffer[1][column] = (FCELL)saturation;118 rowbuffer[2][column] = (FCELL)lightness;119 127 } 128 129 rowbuffer[1][column] = (FCELL)saturation; 130 rowbuffer[2][column] = (FCELL)lightness; 120 131 121 132 G_debug(2, "Output rowbuffers 0, 1, 2: %f, %f, %f\n",
Note:
See TracChangeset
for help on using the changeset viewer.
