Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jessica Hawkwell
/
nitrogen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a72d4cb4
authored
Mar 25, 2018
by
Jessica Hawkwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Things compile now, mostly
1 parent
a8cdaca5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
20 deletions
.gitmodules
deps/CMakeLists.txt
deps/patches/resvg-FreeBSD.diff
src/libntk/CMakeLists.txt
src/libntk/nitrogen/nwt/Component.cpp
src/libntk/nitrogen/nwt/Component.h
src/libntk/nitrogen/nwt/NativeGraphics.h
src/libntk/nitrogen/util/ComponentRenderer.cpp
src/libntk/nitrogen/util/ComponentRenderer.h
.gitmodules
View file @
a72d4cb
[submodule "deps/resvg"]
path = deps/resvg
url = https://github.com/RazrFalcon/resvg.git
ignore = dirty
deps/CMakeLists.txt
View file @
a72d4cb
...
...
@@ -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
}
)
deps/patches/resvg-FreeBSD.diff
View file @
a72d4cb
# 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.
*
src/libntk/CMakeLists.txt
View file @
a72d4cb
...
...
@@ -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
)
...
...
src/libntk/nitrogen/nwt/Component.cpp
View file @
a72d4cb
...
...
@@ -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
()
{
...
...
src/libntk/nitrogen/nwt/Component.h
View file @
a72d4cb
...
...
@@ -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
);
...
...
src/libntk/nitrogen/nwt/NativeGraphics.h
View file @
a72d4cb
...
...
@@ -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
);
...
...
src/libntk/nitrogen/util/ComponentRenderer.cpp
View file @
a72d4cb
...
...
@@ -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
);
}
}
}
src/libntk/nitrogen/util/ComponentRenderer.h
View file @
a72d4cb
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment