Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hqr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
solverstack
hqr
Commits
38d4552b
Commit
38d4552b
authored
7 years ago
by
BOUCHERIE Raphael
Browse files
Options
Downloads
Patches
Plain Diff
added global array for color, corrected spelling mistake, removed useless library
parent
89a71d18
No related branches found
No related tags found
1 merge request
!4
Treewalk
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/libdraw.h
+7
-2
7 additions, 2 deletions
include/libdraw.h
src/treedraw.c
+11
-33
11 additions, 33 deletions
src/treedraw.c
testings/testing_treedraw.c
+1
-1
1 addition, 1 deletion
testings/testing_treedraw.c
with
19 additions
and
36 deletions
include/libdraw.h
+
7
−
2
View file @
38d4552b
...
...
@@ -9,12 +9,11 @@
*
* @version 1.0.0
* @author Raphael Boucherie
* @author Mat
t
hieu Faverge
* @author Mathieu Faverge
* @date 2017-04-04
*
**/
#include
<stdio.h>
#ifndef _LIBDRAW_H_
#define _LIBDRAW_H_
...
...
@@ -22,6 +21,12 @@
BEGIN_C_DECLS
/*
* Clobal array for color
*/
extern
char
*
color
[
4
];
/*
* function for treedraw
*/
...
...
This diff is collapsed.
Click to expand it.
src/treedraw.c
+
11
−
33
View file @
38d4552b
...
...
@@ -18,14 +18,20 @@
#include
<stdio.h>
#include
"libdraw.h"
/*
* Global array for color
*/
char
*
color
[
4
]
=
{
"red"
,
"blue"
,
"green"
,
"purple"
};
/*
* functions writing in the svg file
*/
void
libhqr_writeheader
(
FILE
*
tree
){
if
(
fprintf
(
tree
,
"<?xml version=
\"
1.0
\"
standalone=
\"
no
\"
?>
\n
"
)
<
0
)
return
;
if
(
fprintf
(
tree
,
"<!DOCTYPE svg PUBLIC
\"
-//W3C//DTD SVG 1.1//EN
\"
\n
\"
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd
\"
>
\n
"
)
<
0
)
return
;
if
(
fprintf
(
tree
,
"<svg width=
\"
2000
\"
height=
\"
2000
\"
version=
\"
1.1
\"
\n
xmlns=
\"
http://www.w3.org/2000/svg
\"
>
\n
"
)
<
0
)
return
;
if
(
fprintf
(
tree
,
"<?xml version=
\"
1.0
\"
standalone=
\"
no
\"
?>
\n
"
"<!DOCTYPE svg PUBLIC
\"
-//W3C//DTD SVG 1.1//EN
\"
\n
\"
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd
\"
>
\n
"
"<svg width=
\"
2000
\"
height=
\"
2000
\"
version=
\"
1.1
\"
\n
xmlns=
\"
http://www.w3.org/2000/svg
\"
>
\n
"
)
<
0
)
return
;
}
/*
...
...
@@ -38,41 +44,13 @@ void libhqr_writeheader(FILE *tree){
*/
void
libhqr_drawTT
(
int
x
,
int
y
,
int
w
,
int
h
,
int
k
,
FILE
*
tree
){
switch
(
k
%
4
){
case
0
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
red
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
case
1
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
blue
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
case
2
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
green
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
case
3
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
black
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
default:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
%s
\"
/>
\n
"
,
x
,
y
,
w
,
h
,
color
[
k
%
4
])
<
0
)
return
;
}
}
void
libhqr_drawTS
(
int
x
,
int
y
,
int
w
,
int
h
,
int
k
,
FILE
*
tree
){
switch
(
k
%
4
){
case
0
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
red
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
case
1
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
blue
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
case
2
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
green
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
case
3
:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
black
\"
/>
\n
"
,
x
,
y
,
w
,
h
)
<
0
)
return
;
break
;
default:
if
(
fprintf
(
tree
,
"<rect x=
\"
%d
\"
y=
\"
%d
\"
width=
\"
%d
\"
height=
\"
%d
\"
fill=
\"
%s
\"
/>
\n
"
,
x
,
y
,
w
,
h
,
color
[
k
%
4
])
<
0
)
return
;
}
int
x2
=
x
+
(
w
/
4
);
int
y2
=
y
+
(
h
/
4
);
int
w2
=
(
w
/
2
);
...
...
This diff is collapsed.
Click to expand it.
testings/testing_treedraw.c
+
1
−
1
View file @
38d4552b
...
...
@@ -33,7 +33,7 @@ main(int argc, char ** argv)
for
(
j
=
1
;
j
<
9
;
j
++
){
x
=
100
*
i
;
y
=
100
*
j
;
libhqr_drawTS
(
x
,
y
,
WIDTH
,
HEIGHT
,
1
,
tree
);
libhqr_drawTS
(
x
,
y
,
WIDTH
,
HEIGHT
,
3
,
tree
);
}
}
libhqr_writeend
(
tree
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment