Skip to content

Commit

Permalink
Use nested namespace specifiers for skui::graphics.
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvb committed Oct 14, 2018
1 parent 9b9949a commit b6c7f7e
Show file tree
Hide file tree
Showing 48 changed files with 1,044 additions and 1,199 deletions.
13 changes: 5 additions & 8 deletions graphics/canvas.c++
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@
#include "graphics/shape/text.h++"
#include "graphics/shape/rectangle.h++"

namespace skui
namespace skui::graphics
{
namespace graphics
{
canvas::~canvas() = default;
canvas::~canvas() = default;

canvas::canvas(canvas_flags flags)
: flags{flags}
{}
}
canvas::canvas(canvas_flags flags)
: flags{flags}
{}
}
77 changes: 37 additions & 40 deletions graphics/canvas.h++
Original file line number Diff line number Diff line change
Expand Up @@ -39,54 +39,51 @@

#include <optional>

namespace skui
namespace skui::graphics
{
namespace graphics
{
class ellipse;
class path;
class rectangle;
class text;
class ellipse;
class path;
class rectangle;
class text;

enum class canvas_flag
{
none,
anti_alias
};
using canvas_flags = core::bitflag<canvas_flag>;
enum class canvas_flag
{
none,
anti_alias
};
using canvas_flags = core::bitflag<canvas_flag>;

class canvas
{
public:
virtual ~canvas() = 0;
class canvas
{
public:
virtual ~canvas() = 0;

// Primitives
virtual void draw(const style::fill& background,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const rectangle& rectangle,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const ellipse& ellipse,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const text& text,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const path& path,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
// Primitives
virtual void draw(const style::fill& background,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const rectangle& rectangle,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const ellipse& ellipse,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const text& text,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;
virtual void draw(const path& path,
const scalar_position& position,
const std::optional<scalar_bounding_box>& clipping_box = {}) = 0;

// text size needs knowledge of underlying graphics system exposed through canvas
virtual scalar_size measure_text(const text& text) const = 0;
// text size needs knowledge of underlying graphics system exposed through canvas
virtual scalar_size measure_text(const text& text) const = 0;

style::fill background = graphics::colors::white;
style::fill background = graphics::colors::white;

protected:
canvas(canvas_flags flags);
protected:
canvas(canvas_flags flags);

canvas_flags flags;
};
}
canvas_flags flags;
};
}

#endif
Loading

0 comments on commit b6c7f7e

Please sign in to comment.