#ifndef GRAFIX_HH #define GRAFIX_HH #include #include "vector.hh" class Grafix { Display *_display; Pixmap _drawable; Screen *_screen; Colormap _colormap; int _depth; struct GCCache { XGCValues _xgcv; unsigned long _mask; XColor _foreground; bool acceptable(const GCCache &); bool combine(const GCCache &); }; static Vector all_cached_gcs; static Vector all_instances; Vector _gcs; Vector _gc_foregrounds; Vector _pixels; void alloc_color(XColor *); void update_gc(int, unsigned long, GCCache *); static int make_cached_gc(unsigned long, XGCValues *, XColor *); public: Grafix(Display *, Window); ~Grafix(); Display *display() const { return _display; } int depth() const { return _depth; } GC xgc(int i) const { return _gcs[i]; } static int line_gc(int r, int g, int b); static bool gc_foreground(int, int &r, int &g, int &b); }; #endif