Convert visual layers to scene nodes.

This commit is contained in:
James Grogan 2022-11-16 15:06:08 +00:00
parent 798cb365d7
commit 3e53bd9e00
64 changed files with 863 additions and 551 deletions

View file

@ -12,7 +12,6 @@
#include "XcbScreen.h"
#include "Color.h"
#include "UiEvent.h"
#include "VisualLayer.h"
#include "XcbKeyboard.h"
#include "XcbWindow.h"
#include "XcbEventInterface.h"

View file

@ -1,41 +0,0 @@
#include "XcbLayerInterface.h"
#include "XcbTextInterface.h"
#include "RectangleNode.h"
#include "VisualLayer.h"
#include <memory>
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] = {color.getAsUInt32(), 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);
}
}
*/
}

View file

@ -1,15 +0,0 @@
#pragma once
#include <xcb/xcb.h>
class Color;
class VisualLayer;
class XcbLayerInterface
{
public:
static void modifyGcColor(xcb_connection_t* connection, xcb_gcontext_t gc, const Color& color);
static void addLayer(xcb_connection_t* connection, xcb_screen_t* screen, xcb_window_t window, xcb_gcontext_t gc, VisualLayer* layer);
};

View file

@ -1,6 +1,5 @@
#include "XcbTextInterface.h"
#include "VisualLayer.h"
#include "Color.h"
#include <string.h>
@ -35,9 +34,8 @@ void XcbTextInterface::AddTextElement(xcb_connection_t* connection,
/* draw the text */
const auto content = textElement->getContent();
Pixel loc = textElement->getLocation();
xcb_image_text_8(connection, content.length(), window, gc,
loc.GetX(), loc.GetY(), content.c_str());
//Pixel loc = textElement->getLocation();
// xcb_image_text_8(connection, content.length(), window, gc, loc.GetX(), loc.GetY(), content.c_str());
/* free the gc */
xcb_free_gc(connection, gc);

View file

@ -1,7 +1,6 @@
#include "XcbWindow.h"
#include "Window.h"
#include "XcbLayerInterface.h"
#include "XcbScreen.h"
#include "XcbImage.h"
#include "Screen.h"