I'd like to create a a new stateless widget class that is defined by 2 images(top, bottom) and a line(defined by a function, e.g. (x){x+500}
, a width(can be 0, if it shouldn't be drawn), and a color) separating the two images.
For each pixel:
- If the y position of a pixel is greater than the result of
f(x) + width/2
a pixel of bottom shall be drawn - If it's smaller than
f(x) - width / 2
a pixel of top shall be drawn - Else a pixel of the given line color shall be drawn
Below see an example of what mywidget({'top': A, 'bottom': B, 'f': (x){return sin(x)+500;}, 'width': 1, 'color': Color(0xFFFFFFFF)});
could look like:
(0,0)
+------+
| |
| A |
| __ |
|/ \__|
| |
| B |
+------+(e.g. 1920,1080)
Is there a line widget where the shape is defined by a (mathematic) function?
Is this the only way to do it? Or is there a container widget that already allows this? I have looked at the Stack widget but that's not quite solving the problem, as I'd need a structure to decide which pixel is rendered as described above. The function to decide which should happen should be supplyable by the user.