projects
/
libdcp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
badcfc4
)
Add Colour::to_rgb_string.
author
Carl Hetherington
<cth@carlh.net>
Tue, 8 Nov 2016 13:22:45 +0000
(13:22 +0000)
committer
Carl Hetherington
<cth@carlh.net>
Tue, 8 Nov 2016 13:22:45 +0000
(13:22 +0000)
src/types.cc
patch
|
blob
|
history
src/types.h
patch
|
blob
|
history
diff --git
a/src/types.cc
b/src/types.cc
index 812e0f8986275182695e216085ba771d0f531fda..0347d02f15cc7f68df9f67f4cf282682f1f3cebf 100644
(file)
--- a/
src/types.cc
+++ b/
src/types.cc
@@
-126,6
+126,17
@@
Colour::to_argb_string () const
return buffer;
}
return buffer;
}
+/** @return An RGB string of the form RRGGBB, where e.g. RR is a two-character
+ * hex value.
+ */
+string
+Colour::to_rgb_string () const
+{
+ char buffer[7];
+ snprintf (buffer, sizeof(buffer), "%02X%02X%02X", r, g, b);
+ return buffer;
+}
+
/** operator== for Colours.
* @param a First colour to compare.
* @param b Second colour to compare.
/** operator== for Colours.
* @param a First colour to compare.
* @param b Second colour to compare.
diff --git
a/src/types.h
b/src/types.h
index dd2e10a6f4cc29d44d4421d166af2cd0d404dc56..e8761c816e08c2df25ca6c2ffdafe76c422ad602 100644
(file)
--- a/
src/types.h
+++ b/
src/types.h
@@
-246,6
+246,7
@@
public:
int g; ///< green component, from 0 to 255
int b; ///< blue component, from 0 to 255
int g; ///< green component, from 0 to 255
int b; ///< blue component, from 0 to 255
+ std::string to_rgb_string () const;
std::string to_argb_string () const;
};
std::string to_argb_string () const;
};