Add Colour::to_rgb_string.
[libdcp.git] / src / types.cc
index 812e0f8986275182695e216085ba771d0f531fda..0347d02f15cc7f68df9f67f4cf282682f1f3cebf 100644 (file)
@@ -126,6 +126,17 @@ Colour::to_argb_string () const
        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.