Skip to content

Commit

Permalink
add rounded corners in svg
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonMiraj committed Jul 7, 2024
1 parent b67daba commit 67085f7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/backends/fig_shapes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module fig_shapes
type, extends(shape) :: rectangle
type(point) :: upper_left
real (kind=8):: width, height
real (kind=8):: rx=0, ry=0
end type rectangle

type, extends(shape) :: triangle
Expand Down
6 changes: 6 additions & 0 deletions src/backends/vector/svg_shapes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ subroutine write_circle(sh,sz,unit_num)
// attribute('r', trim(adjustl(real_to_str(sh%r))), '') &
// attribute('fill', trim(adjustl(rgb_to_string(sh%fill_color))), '') &
// attribute('stroke', trim(adjustl(rgb_to_string(sh%stroke_color))), '')&
// attribute('stroke-width', trim(adjustl(real_to_str(sh%stroke_width))), '')&
// '/>'
end subroutine write_circle

Expand All @@ -35,6 +36,7 @@ subroutine write_ellipse(sh,sz,unit_num)
// attribute('ry', trim(adjustl(real_to_str(sh%ry))), '') &
// attribute('fill', trim(adjustl(rgb_to_string(sh%fill_color))), '') &
// attribute('stroke', trim(adjustl(rgb_to_string(sh%stroke_color))), '')&
// attribute('stroke-width', trim(adjustl(real_to_str(sh%stroke_width))), '')&
// '/>'
end subroutine write_ellipse

Expand All @@ -52,8 +54,11 @@ subroutine write_rectangle(sh,sz,unit_num)
// attribute('y', trim(adjustl(real_to_str(p%y))), '') &
// attribute('width', trim(adjustl(real_to_str(sh%width))), '') &
// attribute('height', trim(adjustl(real_to_str(sh%height))), '') &
// attribute('rx', trim(adjustl(real_to_str(sh%rx))), '') &
// attribute('ry', trim(adjustl(real_to_str(sh%ry))), '') &
// attribute('fill', trim(adjustl(rgb_to_string(sh%fill_color))), '') &
// attribute('stroke', trim(adjustl(rgb_to_string(sh%stroke_color))), '')&
// attribute('stroke-width', trim(adjustl(real_to_str(sh%stroke_width))), '')&
// '/>'
end subroutine write_rectangle

Expand Down Expand Up @@ -96,6 +101,7 @@ subroutine write_triangle(sh,sz,unit_num)
// trim(adjustl(real_to_str(p3%y))),'') // ' ' &
// attribute('fill', trim(adjustl(rgb_to_string(sh%fill_color))),'') &
// attribute('stroke', trim(adjustl(rgb_to_string(sh%stroke_color))), '')&
// attribute('stroke-width', trim(adjustl(real_to_str(sh%stroke_width))), '')&
// '/>'
end subroutine write_triangle

Expand Down
8 changes: 7 additions & 1 deletion test/drawing_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ program drawing_test_all
r%height = 50.0
r%fill_color = FIG_COLOR_BLUE
r%fill_color%a = 100
r%stroke_width = 10
r%stroke_color = FIG_COLOR_GOLD
call canva%add_shape(r)

! Rectangle 2
Expand All @@ -65,6 +67,11 @@ program drawing_test_all
r%height = 50.0
r%fill_color = FIG_COLOR_RED
r%fill_color%a = 100
r%rx=5
r%ry=5
r%stroke_width = 6
r%stroke_color = FIG_COLOR_SEAGREEN
r%stroke_color%a=150
call canva%add_shape(r)

! Line
Expand All @@ -78,7 +85,6 @@ program drawing_test_all
l%stroke_width = 2
l%stroke_color = FIG_COLOR_RED
l%stroke_color%a=100

call canva%add_shape(l)


Expand Down

0 comments on commit 67085f7

Please sign in to comment.