Geometrize 1.0
C++ library for geometrizing images into geometric primitives
imagerunner.h
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <memory>
5#include <vector>
6
7#include "../core.h"
8#include "../model.h"
9#include "../shaperesult.h"
10
11namespace geometrize
12{
13class Bitmap;
14class ImageRunnerOptions;
15class Shape;
16}
17
18namespace geometrize
19{
20
26{
27public:
32 ImageRunner(const geometrize::Bitmap& targetBitmap);
33
40 ImageRunner(const geometrize::Bitmap& targetBitmap, const geometrize::Bitmap& initialBitmap);
43 ImageRunner(const ImageRunner&) = delete;
44
53 std::vector<geometrize::ShapeResult> step(const geometrize::ImageRunnerOptions& options,
54 std::function<std::shared_ptr<geometrize::Shape>()> shapeCreator = nullptr,
55 geometrize::core::EnergyFunction energyFunction = nullptr,
56 geometrize::ShapeAcceptancePreconditionFunction addShapePrecondition = nullptr);
57
63
69
74 const geometrize::Bitmap& getCurrent() const;
75
80 const geometrize::Bitmap& getTarget() const;
81
87
88private:
89 class ImageRunnerImpl;
90 std::unique_ptr<ImageRunner::ImageRunnerImpl> d;
91};
92
93}
The Bitmap class is a helper class for working with bitmap data.
Definition: bitmap.h:16
Definition: imagerunner.cpp:20
The ImageRunner class is a helper class for creating a set of primitives from a source image.
Definition: imagerunner.h:26
ImageRunner(const geometrize::Bitmap &targetBitmap)
ImageRunner Creates an new image runner with the given target bitmap. Uses the average color of the t...
Definition: imagerunner.cpp:73
geometrize::Bitmap & getCurrent()
getCurrent Gets the current bitmap with the primitives drawn on it.
Definition: imagerunner.cpp:92
~ImageRunner()
Definition: imagerunner.cpp:81
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:90
ImageRunner & operator=(const ImageRunner &)=delete
ImageRunner(const ImageRunner &)=delete
geometrize::Bitmap & getTarget()
getTarget Gets the target bitmap.
Definition: imagerunner.cpp:97
geometrize::Model & getModel()
getModel Gets the underlying model.
Definition: imagerunner.cpp:112
std::vector< geometrize::ShapeResult > step(const geometrize::ImageRunnerOptions &options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator=nullptr, geometrize::core::EnergyFunction energyFunction=nullptr, geometrize::ShapeAcceptancePreconditionFunction addShapePrecondition=nullptr)
step Updates the internal model once.
Definition: imagerunner.cpp:84
The ImageRunnerOptions class encapsulates preferences/options that the image runner uses.
Definition: imagerunneroptions.h:28
The Model class is the model for the core optimization/fitting algorithm.
Definition: model.h:48
std::function< double(const std::vector< geometrize::Scanline > &lines, const std::uint32_t alpha, const geometrize::Bitmap &target, const geometrize::Bitmap &current, geometrize::Bitmap &buffer, double score)> EnergyFunction
EnergyFunction Type alias for a function that calculates a measure of the improvement adding the scan...
Definition: core.h:44
Definition: bitmap.cpp:8
std::function< bool(double lastScore, double newScore, const geometrize::Shape &shape, const std::vector< geometrize::Scanline > &lines, const geometrize::rgba &color, const geometrize::Bitmap &before, const geometrize::Bitmap &after, const geometrize::Bitmap &target)> ShapeAcceptancePreconditionFunction
ShapeAcceptancePreconditionFunction Type alias for a function that is used to decide whether or not t...
Definition: model.h:41