| 1 | package Graph::Easy::Introspect::Renderer ; | ||
| 2 | |||
| 3 | use strict ; | ||
| 4 | use warnings ; | ||
| 5 | |||
| 6 | our $VERSION = '0.01' ; | ||
| 7 | |||
| 8 | # ------------------------------------------------------------------------------ | ||
| 9 | |||
| 10 | sub new | ||
| 11 | { | ||
| 12 | my ($class) = @_ ; | ||
| 13 | |||
| 14 | return bless {}, $class ; | ||
| 15 | } | ||
| 16 | |||
| 17 | # ------------------------------------------------------------------------------ | ||
| 18 | |||
| 19 | sub draw_box | ||
| 20 | { | ||
| 21 | my ($self, $x, $y, $w, $h, $text) = @_ ; | ||
| 22 | |||
| 23 | printf STDERR "draw_box x=%-3d y=%-3d w=%-3d h=%-3d text=%s\n", | ||
| 24 | $x, $y, $w, $h, $text // '' ; | ||
| 25 | } | ||
| 26 | |||
| 27 | # ------------------------------------------------------------------------------ | ||
| 28 | |||
| 29 | sub draw_rounded_box | ||
| 30 | { | ||
| 31 | my ($self, $x, $y, $w, $h, $text) = @_ ; | ||
| 32 | |||
| 33 | printf STDERR "draw_rounded_box x=%-3d y=%-3d w=%-3d h=%-3d text=%s\n", | ||
| 34 | $x, $y, $w, $h, $text // '' ; | ||
| 35 | } | ||
| 36 | |||
| 37 | # ------------------------------------------------------------------------------ | ||
| 38 | |||
| 39 | sub draw_diamond | ||
| 40 | { | ||
| 41 | my ($self, $x, $y, $w, $h, $text) = @_ ; | ||
| 42 | |||
| 43 | printf STDERR "draw_diamond x=%-3d y=%-3d w=%-3d h=%-3d text=%s\n", | ||
| 44 | $x, $y, $w, $h, $text // '' ; | ||
| 45 | } | ||
| 46 | |||
| 47 | # ------------------------------------------------------------------------------ | ||
| 48 | |||
| 49 | sub draw_circle | ||
| 50 | { | ||
| 51 | my ($self, $x, $y, $w, $h, $text) = @_ ; | ||
| 52 | |||
| 53 | printf STDERR "draw_circle x=%-3d y=%-3d w=%-3d h=%-3d text=%s\n", | ||
| 54 | $x, $y, $w, $h, $text // '' ; | ||
| 55 | } | ||
| 56 | |||
| 57 | # ------------------------------------------------------------------------------ | ||
| 58 | |||
| 59 | sub draw_point | ||
| 60 | { | ||
| 61 | my ($self, $x, $y) = @_ ; | ||
| 62 | |||
| 63 | printf STDERR "draw_point x=%-3d y=%-3d\n", $x, $y ; | ||
| 64 | } | ||
| 65 | |||
| 66 | # ------------------------------------------------------------------------------ | ||
| 67 | |||
| 68 | sub draw_invisible | ||
| 69 | { | ||
| 70 | my ($self, $x, $y, $w, $h) = @_ ; | ||
| 71 | |||
| 72 | printf STDERR "draw_invisible x=%-3d y=%-3d w=%-3d h=%-3d\n", $x, $y, $w, $h ; | ||
| 73 | } | ||
| 74 | |||
| 75 | # ------------------------------------------------------------------------------ | ||
| 76 | |||
| 77 | sub draw_arrow | ||
| 78 | { | ||
| 79 | my ($self, $start_style, $end_style, $points) = @_ ; | ||
| 80 | |||
| 81 | my $pts = join ' -> ', map { "($_->{char_x},$_->{char_y})" } @$points ; | ||
| 82 | |||
| 83 | printf STDERR "draw_arrow start=%-6s end=%-6s %s\n", | ||
| 84 | $start_style, $end_style, $pts ; | ||
| 85 | } | ||
| 86 | |||
| 87 | # ------------------------------------------------------------------------------ | ||
| 88 | |||
| 89 | sub draw_self_loop | ||
| 90 | { | ||
| 91 | my ($self, $x, $y, $w, $h, $side) = @_ ; | ||
| 92 | |||
| 93 | printf STDERR "draw_self_loop x=%-3d y=%-3d w=%-3d h=%-3d side=%s\n", | ||
| 94 | $x, $y, $w, $h, $side // 'unknown' ; | ||
| 95 | } | ||
| 96 | |||
| 97 | # ------------------------------------------------------------------------------ | ||
| 98 | |||
| 99 | sub draw_edge_label | ||
| 100 | { | ||
| 101 | my ($self, $x, $y, $text) = @_ ; | ||
| 102 | |||
| 103 | printf STDERR "draw_edge_label x=%-3d y=%-3d text=%s\n", $x, $y, $text // '' ; | ||
| 104 | } | ||
| 105 | |||
| 106 | # ------------------------------------------------------------------------------ | ||
| 107 | |||
| 108 | sub draw_group | ||
| 109 | { | ||
| 110 | my ($self, $x, $y, $w, $h, $text) = @_ ; | ||
| 111 | |||
| 112 | printf STDERR "draw_group x=%-3d y=%-3d w=%-3d h=%-3d text=%s\n", | ||
| 113 | $x, $y, $w, $h, $text // '' ; | ||
| 114 | } | ||
| 115 | |||
| 116 | # ------------------------------------------------------------------------------ | ||
| 117 | |||
| 118 | sub draw_graph_label | ||
| 119 | { | ||
| 120 | my ($self, $x, $y, $total_w, $text) = @_ ; | ||
| 121 | |||
| 122 | printf STDERR "draw_graph_label x=%-3d y=%-3d total_w=%-3d text=%s\n", | ||
| 123 | $x, $y, $total_w, $text // '' ; | ||
| 124 | } | ||
| 125 | |||
| 126 | 1 ; | ||
| 127 | |||
| 128 | __END__ |