Currently, "Painter" doesn't have any member values. I want to give something to him
Case 1:
Make every Draw functions to static, and Painter itself just contained some property map.
and Draw function use that properties.
This case, we don't need to make some values for Painter .
struct Painter
{
using PropertyMap = std::map<PropertyType, PropertyValue>;
PropertyMap mProperties;
// draw utils
void Draw(Image img, ~~~) { Draw(~~, mProperties); }
// static draw utils
static void Draw(Image img, ~~~ , const PropertyMap& properties = PropertyMap());
}
Case 2:
Make some BasePainterInterface and class Painter : public BasePainterInterface.
This case, we can generate custom painters easy.
struct BasePainterInterface {
void Draw(Image img, ~~~) = 0;
}
struct MaskingPainterInterface {
void Draw(Image img, Image masking, ~~~) = 0;
}
struct VectorImagePainterInterface {
void Draw(VectorImage img, ~~~) = 0;
}
struct Painter : public BasePainterInterface, public MaskingPainterInterface {
void Draw(~~) override;
}
struct VectorPainter : public BasePainterInterface, public VectorImagePainterInterface {
void Draw(~~) override;
}
Currently, "Painter" doesn't have any member values. I want to give something to him
Case 1:
Make every
Drawfunctions tostatic, andPainteritself just contained some property map.and
Drawfunction use that properties.This case, we don't need to make some values for
Painter.Case 2:
Make some
BasePainterInterfaceandclass Painter : public BasePainterInterface.This case, we can generate custom painters easy.