Geometrize 1.0
C++ library for geometrizing images into geometric primitives
shape.h
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <memory>
5#include <vector>
6
7#include "../rasterizer/scanline.h"
8#include "shapetypes.h"
9
10namespace geometrize
11{
12
17class Shape
18{
19public:
20 Shape() = default;
21 virtual ~Shape() = default;
22 Shape& operator=(const geometrize::Shape& other) = default;
23 Shape(const geometrize::Shape& other) = default;
24
25 std::function<void(geometrize::Shape&)> setup;
26 std::function<void(geometrize::Shape&)> mutate;
27 std::function<std::vector<geometrize::Scanline>(const geometrize::Shape&)> rasterize;
28
33 virtual std::shared_ptr<geometrize::Shape> clone() const
34 {
35 throw "Unimplemented"; // NOTE not pure virtual because it breaks simple upcast in Chaiscript (and can't see how else to do it)
36 }
37
43 {
44 throw "Unimplemented";
45 }
46};
47
48}
Definition: shape.h:18
Shape & operator=(const geometrize::Shape &other)=default
std::function< std::vector< geometrize::Scanline >(const geometrize::Shape &)> rasterize
Definition: shape.h:27
std::function< void(geometrize::Shape &)> setup
Definition: shape.h:25
std::function< void(geometrize::Shape &)> mutate
Definition: shape.h:26
Shape(const geometrize::Shape &other)=default
virtual geometrize::ShapeTypes getType() const
getType Gets the ShapeType of the shape.
Definition: shape.h:42
virtual std::shared_ptr< geometrize::Shape > clone() const
clone Clones the shape, a virtual copy constructor.
Definition: shape.h:33
virtual ~Shape()=default
Definition: bitmap.cpp:8
ShapeTypes
The ShapeTypes enum specifies the types of shapes that can be used. These can be combined to produce ...
Definition: shapetypes.h:17