Skip to content

How to use "Painter" Struct? #24

Description

@hinohie

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions