aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-13 22:29:21 +0200
committerMattias Andrée <maandree@kth.se>2016-07-13 22:29:21 +0200
commit0b1f6f665e9b53854b4fd42e69411e511f06d542 (patch)
tree955678da53f3aefad61172e12144b502ebae7f7c
parentAdd manpage (diff)
downloadcoopgammad-0b1f6f665e9b53854b4fd42e69411e511f06d542.tar.gz
coopgammad-0b1f6f665e9b53854b4fd42e69411e511f06d542.tar.bz2
coopgammad-0b1f6f665e9b53854b4fd42e69411e511f06d542.tar.xz
Implement use of libclut
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/output.c9
-rw-r--r--src/ramps.c26
2 files changed, 33 insertions, 2 deletions
diff --git a/src/output.c b/src/output.c
index f323ff0..a593c16 100644
--- a/src/output.c
+++ b/src/output.c
@@ -18,6 +18,8 @@
#include "output.h"
#include "util.h"
+#include <libclut.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -432,31 +434,36 @@ int make_plain_ramps(union gamma_ramps* ramps, struct output* output)
case 8:
if (libgamma_gamma_ramps8_initialise(&(ramps->u8)))
return -1;
+ libclut_start_over(&(ramps->u8), UINT8_MAX, uint8_t, 1, 1, 1);
break;
case 16:
if (libgamma_gamma_ramps16_initialise(&(ramps->u16)))
return -1;
+ libclut_start_over(&(ramps->u16), UINT16_MAX, uint16_t, 1, 1, 1);
break;
case 32:
if (libgamma_gamma_ramps32_initialise(&(ramps->u32)))
return -1;
+ libclut_start_over(&(ramps->u32), UINT32_MAX, uint32_t, 1, 1, 1);
break;
case 64:
if (libgamma_gamma_ramps64_initialise(&(ramps->u64)))
return -1;
+ libclut_start_over(&(ramps->u64), UINT64_MAX, uint64_t, 1, 1, 1);
break;
case -1:
if (libgamma_gamma_rampsf_initialise(&(ramps->f)))
return -1;
+ libclut_start_over(&(ramps->f), 1.0f, float, 1, 1, 1);
break;
case -2:
if (libgamma_gamma_rampsd_initialise(&(ramps->d)))
return -1;
+ libclut_start_over(&(ramps->d), (double)1, double, 1, 1, 1);
break;
default:
abort();
}
- /* TODO fill ramps (use libclut) */
return 0;
}
diff --git a/src/ramps.c b/src/ramps.c
index d8d4975..0ae6224 100644
--- a/src/ramps.c
+++ b/src/ramps.c
@@ -17,6 +17,8 @@
*/
#include "ramps.h"
+#include <libclut.h>
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -135,6 +137,28 @@ void apply(union gamma_ramps* dest, void* application, int depth, union gamma_ra
memcpy(dest->u8.blue, base->u8.blue, blue_width);
}
- /* TODO apply with libclut */
+ switch (depth)
+ {
+ case 8:
+ libclut_apply(&(dest->u8), UINT8_MAX, uint8_t, &(app.u8), UINT8_MAX, uint8_t, 1, 1, 1);
+ break;
+ case 16:
+ libclut_apply(&(dest->u16), UINT16_MAX, uint16_t, &(app.u16), UINT16_MAX, uint16_t, 1, 1, 1);
+ break;
+ case 32:
+ libclut_apply(&(dest->u32), UINT32_MAX, uint32_t, &(app.u32), UINT32_MAX, uint32_t, 1, 1, 1);
+ break;
+ case 64:
+ libclut_apply(&(dest->u64), UINT64_MAX, uint64_t, &(app.u64), UINT64_MAX, uint64_t, 1, 1, 1);
+ break;
+ case -1:
+ libclut_apply(&(dest->f), 1.0f, float, &(app.d), 1.0f, float, 1, 1, 1);
+ break;
+ case -2:
+ libclut_apply(&(dest->d), (double)1, double, &(app.f), (double)1, double, 1, 1, 1);
+ break;
+ default:
+ abort();
+ }
}