51 lines
1.7 KiB
C++
51 lines
1.7 KiB
C++
#include "XcbLayerInterface.h"
|
|
|
|
#include "XcbTextInterface.h"
|
|
#include "RectangleNode.h"
|
|
#include "VisualLayer.h"
|
|
|
|
#include <memory>
|
|
|
|
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<RectangleNode*>(shape);
|
|
const auto loc = rectangle->getLocation();
|
|
const auto width = static_cast<uint16_t>(rectangle->getWidth());
|
|
const auto height = static_cast<uint16_t>(rectangle->getHeight());
|
|
xcb_rectangle_t rectangles[] = { { static_cast<int16_t>(loc.GetX()),
|
|
static_cast<int16_t>(loc.GetY()), width, height} };
|
|
XcbLayerInterface::modifyGcColor(connection, gc, &rectangle->getFillColor());
|
|
xcb_poly_fill_rectangle(connection, window, gc, 1, rectangles);
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|