Skip to content

Allow generic drawing effects #63

Open

Description

@danh32

More use-cases are popping up with specific effects in mind. I'd like to make Spark able to handle these specific effects for folks more easily than either adding special cases and attributes for them in SparkView itself, or having to request them to subclass SparkView and do manual drawing.

A pluggable solution with a way for folks to easily override just the drawing of the spark should be a great first step.

Activity

  1. cammace commented on Apr 25, 2018

    @cammace

    subclass SparkView and do manual drawing

    So if I understand correctly, similiar to how the Paint objects have getter, and more importantly, setters, you'd like the same accessibility for the Paths? I would think we'd want to keep these not mutable since everytime populatePath is called, the path is reset and drawn again using the data from the adapter.

    If you mean setting the Paint objects like mentioned in #59, setSparkFillPaint is already exposed to the dev?

  2. danh32 commented on Apr 25, 2018

    @danh32
    ContributorAuthor

    My super-rough idea so far is to have a class something like:

    interface SparkDraw {
      void draw(Canvas c, DrawArgs args);
    }
    
    class DrawArgs {
      public Path sparkPath;
      public Path sparkPaint;
      public float[] scaledPointsY;
      public float[] scaledPointsX;
      public float scrubY;
      public float scrubX;
      ...
    }
    

    Then users can override the draw there and mutate the paths/paints if they want crazier effects.

    This isn't super well thought out yet, though, definitely open to ideas here!

  3. cammace commented on Apr 25, 2018

    @cammace

    DrawArgs sounds like it would clean up the SparkView significantly with all the getters and setters, we could even possibly throw in a createFromAttributes method which further shrinks the view class. I did something similar recently here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions