summaryrefslogtreecommitdiff
path: root/otk_c/color.h
blob: 91b83e01bda186f2998fdc07f168eef19a870f0d (plain)
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
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __color_h
#define __color_h

#include <X11/Xlib.h>
#include <Python.h>


typedef struct OtkColor {
  int red, green, blue;
  int screen;
  Bool allocated;
  unsigned long pixel;
  PyObject *colorname; // PyStringObject
  Colormap colormap;
} OtkColor;

OtkColor *OtkColor_New(int screen);
OtkColor *OtkColor_FromRGB(int r, int g, int b, int screen);
OtkColor *OtkColor_FromName(const char *name, int screen);

void OtkColor_Destroy(OtkColor *self);

void OtkColor_SetRGB(OtkColor *self, int r, int g, int b);
void OtkColor_SetScreen(OtkColor *self, int screen);
Bool OtkColor_IsValid(OtkColor *self);
unsigned long OtkColor_Pixel(OtkColor *self);

void OtkColor_InitializeCache();
void OtkColor_DestroyCache();
void OtkColor_CleanupColorCache();

#endif // __color_h