#include "XcbLayerInterface.h" #include "XcbTextInterface.h" #include "RectangleNode.h" #include "VisualLayer.h" #include uint32_t XcbLayerInterface::getColor(const Color* color) { return XcbLayerInterface::getColor(color->GetR(), color->GetG(), color->GetB()); } uint32_t XcbLayerInterface::getColor(int r, int g, int b) { return b + (g<<8) + (r<<16); } void XcbLayerInterface::modifyGcColor(xcb_connection_t* connection, xcb_gcontext_t gc, const Color* color) { uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES; uint32_t values[2] = {XcbLayerInterface::getColor(color), 0}; xcb_change_gc(connection, gc, mask, values); } void XcbLayerInterface::addLayer(xcb_connection_t* connection, xcb_screen_t* screen, xcb_window_t window, xcb_gcontext_t gc, VisualLayer* layer) { /* if(layer->hasText()) { XcbTextInterface::AddTextElement(connection, screen, window, layer->getText()); } else if(layer->hasShape()) { auto shape = layer->getShape(); if(shape->getType() == GeometryNode::Type::Rectangle) { const auto rectangle = dynamic_cast(shape); const auto loc = rectangle->getLocation(); const auto width = static_cast(rectangle->getWidth()); const auto height = static_cast(rectangle->getHeight()); xcb_rectangle_t rectangles[] = { { static_cast(loc.GetX()), static_cast(loc.GetY()), width, height} }; XcbLayerInterface::modifyGcColor(connection, gc, &rectangle->getFillColor()); xcb_poly_fill_rectangle(connection, window, gc, 1, rectangles); } } */ }