Commit a72d4cb4 by Jessica Hawkwell

Things compile now, mostly

1 parent a8cdaca5
[submodule "deps/resvg"]
path = deps/resvg
url = https://github.com/RazrFalcon/resvg.git
ignore = dirty
......@@ -22,3 +22,5 @@ if(NOT ${RESVG} OR NOT EXISTS ${RESVG})
install(FILES resvg/capi/include/resvg.h DESTINATION include)
install(FILES resvg/capi/target/release/libresvg.so DESTINATION lib)
endif()
message("ReSVG: " ${RESVG})
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>resvg.h (<b>Today 12:46:25 AM</b>)</html>
--- a/<html>resvg.h (<b>d3b63c8</b>)</html>
+++ b/<html><b>Current File</b></html>
@@ -8,7 +8,7 @@
#include <stdbool.h>
#ifdef RESVG_CAIRO_BACKEND
-#include <cairo.h>
+#include <cairo/cairo.h>
#endif
@@ -69,16 +69,6 @@
void resvg_init_log();
-void resvg_init_options(resvg_options *opt)
-{
- opt->path = NULL;
- opt->dpi = 96;
- opt->fit_to.type = RESVG_FIT_TO_ORIGINAL;
- opt->fit_to.value = 0;
- opt->draw_background = false;
- opt->keep_named_groups = false;
-}
-
/**
* @brief Creates <b>resvg_render_tree</b> from file.
*
......@@ -4,6 +4,8 @@ configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h)
find_package(X11)
find_library(BoehmGC gc-threaded)
find_library(Cairo cairo)
find_library(CairoMM cairomm)
add_library(${PROJECT_NAME} SHARED ntkMain.cpp
nitrogen/Object.cpp
......@@ -33,12 +35,11 @@ nitrogen/nwt/NWTEvent.cpp
nitrogen/nwt/NativeGraphics.cpp
nitrogen/nwt/Point.cpp
nitrogen/nwt/Rectangle.cpp
nitrogen/util/ComponentRenderer.cpp
)
message("BoehmGC " ${BoehmGC})
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC nde ${BoehmGC} ${RESVG})
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC nde ${BoehmGC} ${X11_LIBRARIES} ${BoehmGC} ${RESVG} ${Cairo})
target_include_directories (ntk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install(FILES ${PROJECT_NAME}.h DESTINATION include)
......
......@@ -50,7 +50,7 @@ namespace nitrogen {
parent = nullptr;
preferredSize = new Rectangle(0, 0);
renderer = new util::ComponentRenderer(new std::string("Component"), this);
renderer = new nitrogen::util::ComponentRenderer(new std::string("Component"), this);
}
Border* Component::getBorder() {
......
......@@ -51,16 +51,18 @@
#include <vector>
namespace nitrogen {
namespace util {
}
namespace nwt {
class Border;
//class ComponentRenderer;
//class nitrogen::util::ComponentRenderer;
class Graphics;
class NWTEvent;
class MouseEvent;
class MouseListener;
class Component : public Object {
friend class util::ComponentRenderer;
friend class nitrogen::util::ComponentRenderer;
friend class Container;
public:
virtual Border* getBorder();
......@@ -108,7 +110,7 @@ namespace nitrogen {
std::vector<MouseListener*>* ml_list;
Rectangle* preferredSize;
util::ComponentRenderer* renderer;
nitrogen::util::ComponentRenderer* renderer;
Component();
virtual void processEvent(NWTEvent *e);
......
......@@ -78,8 +78,6 @@ namespace nitrogen {
unsigned int width;
unsigned int height;
resvg_handle* svgh;
NativeGraphics();
virtual void pDrawLine(int, int, int, int);
virtual void pDrawPoint(int, int);
......
......@@ -43,7 +43,7 @@ namespace nitrogen {
}
ComponentRenderer::ComponentRenderer(std::string& componentName, nwt::Component* component) {
name = componentName;
name = &componentName;
comp = component;
init();
}
......@@ -71,14 +71,15 @@ namespace nitrogen {
w = comp->getParent()->renderer->getWindow();
}
window = XCreateSimpleWindow(nitrogen::disp, w, x, y, width, height, 0, nwt::Color::BLUE);
window = XCreateSimpleWindow(nitrogen::disp, *w, x, y, width, height, 0, 0, nwt::Color::BLUE->getARGB());
XWindowAttributes attrs;
XGetWindowAttributes(nitrogen::disp, window, &attrs);
XRenderPictFormat *pf = XRenderFindVisualFormat(nitrogen::disp, attrs.visual);
surface = cairo_xlib_surface_create_with_xrender_format(nitrogen::disp, window, attrs.screen, pf, width, height);
cairo = cairo_create(surface);
svg_handle = resvg_init();
/*svg_handle = */resvg_init();
}
std::string* ComponentRenderer::getName() {
......@@ -96,14 +97,14 @@ namespace nitrogen {
void ComponentRenderer::renderComponent() {
//void resvg_cairo_render_to_canvas(const resvg_render_tree* rtree, const resvg_options* opt, resvg_size size, cairo_t* cr)
resvg_options ro;
ro.dpi = 96;
ro.draw_background = false;
ro.fit_to = resvg_fit_to_type.RESVG_FIT_TO_ZOOM;
ro.fit_to.type = resvg_fit_to_type::RESVG_FIT_TO_ZOOM;
resvg_size rs;
rs.width = comp->getSize()->getWidth();
rs.height = comp->getSize()->getWidth();
resvg_cairo_render_to_canvas(svg_tree, ro, rs, surface);
resvg_cairo_render_to_canvas(svg_tree, &ro, rs, cairo);
}
}
}
......@@ -65,8 +65,9 @@ namespace nitrogen {
std::string* name;
Window window;
nwt::Component* comp;
cairo_t* cairo;
cairo_surface_t* surface;
resvg_handle* svg_handle;
//resvg_handle* svg_handle;
resvg_render_tree* svg_tree;
void init();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!