Skip to content

Commit

Permalink
Added BoxPainter class (was missing for FillComponent legends)
Browse files Browse the repository at this point in the history
  • Loading branch information
heliosdrm committed Jan 24, 2015
1 parent 705449e commit 679fba0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/paint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,19 @@ function paint(self::PolygonPainter, context::PaintContext)
polygon(context.device, self.points)
end

immutable BoxPainter <: AbstractPainter
p::Point
q::Point
end

function boundingbox(self::BoxPainter, context::PaintContext)
return BoundingBox(self.p, self.q)
end

function paint(self::BoxPainter, context::PaintContext)
rectangle(context.device, BoundingBox(self.p, self.q))
end

immutable ImagePainter <: AbstractPainter
img
bbox
Expand Down
5 changes: 5 additions & 0 deletions src/renderer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ function polygon(self::CairoRenderer, points::Vector)
fill(self.ctx)
end

function rectangle(self::CairoRenderer, bbox::BoundingBox)
rectangle(self.ctx, bbox)
fill(self.ctx)
end

function layout_text(self::CairoRenderer, str::String)
set_latex(self.ctx, str, get(self,:fontsize))
end
Expand Down

0 comments on commit 679fba0

Please sign in to comment.