summaryrefslogtreecommitdiff
path: root/src/im_colorutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/im_colorutil.cpp')
-rw-r--r--src/im_colorutil.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/im_colorutil.cpp b/src/im_colorutil.cpp
new file mode 100644
index 0000000..9e96c65
--- /dev/null
+++ b/src/im_colorutil.cpp
@@ -0,0 +1,27 @@
+/** \file
+ * \brief Color Utilities
+ *
+ * See Copyright Notice in im_lib.h
+ * $Id: im_colorutil.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $
+ */
+
+
+#include <stdlib.h>
+#include <memory.h>
+#include <string.h>
+
+#include "im.h"
+#include "im_util.h"
+
+long imColorEncode(unsigned char Red, unsigned char Green, unsigned char Blue)
+{
+ return (((long)Red) << 16) | (((long)Green) << 8) | ((long)Blue);
+}
+
+void imColorDecode(unsigned char* Red, unsigned char* Green, unsigned char* Blue, long Color)
+{
+ if (Red) *Red = (imbyte)(Color >> 16);
+ if (Green) *Green = (imbyte)(Color >> 8);
+ if (Blue) *Blue = (imbyte)Color;
+}
+