{colorfast}
exports three C functions for use in other
packages.
To use these functions:
DESCRIPTION
LinkingTo: colorfast
Depends: colorfast (>= 1.0.1)
#include <colorfast.h>
void col_to_rgb(const char *col, uint8_t ptr[4]);
uint32_t col_to_int(const char *col);
void int_to_col(uint32_t icol, char buf[10]);
void col_to_rgb(const char *col, uint8_t ptr[4])
const char *col
is a pointer to a null-terminated C
string containing either a hex color, or the name of a standard R color:
E.g. "#1287Af"
, "hotpink"
uint8_t ptr[4]
holds the values returned from the
function i.e. RGBA color component valuesThe R call col_to_rgb('red')
, can be called via the C
api as:
void col_to_int(const char *col)
const char *col
is a pointer to a null-terminated C
string containing either a hex color, or the name of a standard R color:
E.g. "#1287Af"
, "hotpink"
void int_to_col(uint32_t icol, char buf[10])
uint32_t icol
unsigned integer holding the 4 RGBA color
valueschar buf[10]
a character buffer into which the hex
color will be written e.g. #1154EE00