-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcircle.cc
More file actions
26 lines (21 loc) · 720 Bytes
/
Copy pathcircle.cc
File metadata and controls
26 lines (21 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright...
#include "circle.h"
namespace pdfsketch {
void Circle::Serialize(pdfsketchproto::Graphic* out) const {
Graphic::Serialize(out);
out->set_type(pdfsketchproto::Graphic::CIRCLE);
}
void Circle::Draw(cairo_t* cr, bool selected) {
cairo_save(cr);
cairo_move_to(cr, frame_.Right(), (frame_.Top() + frame_.Bottom()) / 2.0);
cairo_translate(cr, frame_.Left(), frame_.Top());
cairo_scale(cr, frame_.size_.width_, frame_.size_.height_);
cairo_arc(cr, 0.5, 0.5, 0.5, 0, 2 * M_PI);
cairo_restore(cr);
fill_color_.CairoSetSourceRGBA(cr);
cairo_fill_preserve(cr);
stroke_color_.CairoSetSourceRGBA(cr);
cairo_set_line_width(cr, line_width_);
cairo_stroke(cr);
}
} // namespace pdfsketch