/usr/include/colorblind.h is in libcolorblind-dev 0.0.1-1fakesync2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /*
* libcolorblind - Pixel Filter for colorblind accessibility
*
* This is in Public Domain
*
* This library provides an unified way to recalculate colors
* in order to present alternative views on images for colorblind
* people.
*
*/
#ifndef COLORBLIND_MAIN
#define COLORBLIND_MAIN
/*
* This is the list of filter types
*/
enum COLORBLIND_FILTER_TYPE {
colorblind_filter_t_no_filter,
colorblind_filter_t_selective_saturate_red,
colorblind_filter_t_selective_saturate_green,
colorblind_filter_t_selective_saturate_blue,
colorblind_filter_t_selective_dessaturate_red,
colorblind_filter_t_selective_dessaturate_green,
colorblind_filter_t_selective_dessaturate_blue,
colorblind_filter_t_hue_shift_positive,
colorblind_filter_t_hue_shift_negative,
colorblind_filter_t_selective_saturate,
colorblind_filter_t_selective_dessaturate,
colorblind_filter_t_monochrome_others};
/*
* This is how we deal with the pixels.
* It's supposed to be binary-compatible with
* XColor definition from Xlib.
* This struct is always used as a pointer so
* libcolorblind doesn't care about it's real
* size.
*/
typedef struct COLORBLIND_XCOLOR {
/*
* The pixel value is not used here.
* It's here just to be binary compatible
* with XColor
*/
unsigned long pixel;
/*
* These are the color values
*/
unsigned short red, green, blue;
} COLORBLIND_XCOLOR;
/*
* The COLORBLIND_RUNTIME typedef is the runtime object used when
* applying filters. You can have several instances of it and thus
* use diferent filters in different images at the same time.
*/
typedef struct COLORBLIND_RUNTIME {
/*
* Type of filter to apply
*/
enum COLORBLIND_FILTER_TYPE filter_type;
/*
* Base color for the filter
* probably choosed interactively by the user.
*/
COLORBLIND_XCOLOR* base_color;
/*
* Used for filters that accepts more than one
* base color. In this case base_color will be
* an array
*/
int base_color_count;
} COLORBLIND_RUNTIME;
/*
* Now the methods
*/
/*
* The method colorblind_create, for now, just allocs the COLORBLIND_RUNTIME
* and returns it to you. But please keep calling it as this method may be
* used in future versions for something more usefull.
*/
extern COLORBLIND_RUNTIME* colorblind_create();
/*
* The method colorblind_destroy, for now, just frees the COLORBLIND_RUNTIME.
* But please keep calling it as this method may be
* used in future versions for something more usefull.
*/
extern int colorblind_destroy(COLORBLIND_RUNTIME* cbr);
/*
* This method receives a COLORBLIND_XCOLOR*, filters it and saves the
* new value in it. Note that if you're passing the XColor struct,
* this function will not allocate a new color nor query the colormap
* to get the pixel value for the new color, and also it won't touch
* in the pixel value.
*
* But this method will return 0 if the color hasn't changed so
* you can avoid querying the colormap unless it's really needed.
*
* This mehod will return a positive integer if the color has been
* touched (you probably want to set pixel to NULL and allocate the
* new color before using).
*
* If any error occour a negative integer will be returned.
*/
extern int colorblind_filter(COLORBLIND_RUNTIME* cbr, COLORBLIND_XCOLOR* color);
/*
* This method sets the filter type.
* Returns 0 if you already have the necessary data needed by this filter.
*/
extern int colorblind_set_filter_type(COLORBLIND_RUNTIME* cbr, enum COLORBLIND_FILTER_TYPE);
/*
* This method sets the base_color.
*/
extern int colorblind_set_base_color(COLORBLIND_RUNTIME* cbr, COLORBLIND_XCOLOR* color);
/*
* This method sets the base color, but using several colors.
*/
extern int colorblind_set_base_colors(COLORBLIND_RUNTIME* cbr, COLORBLIND_XCOLOR* colors, int count);
/*
* Removes the base_color. You probably want to do that before freeing the color you were using.
*/
extern int colorblind_remove_base_color(COLORBLIND_RUNTIME* cbr);
#endif
|