Partially erasing brush marks

S: Mac
PsychoPy version: v2020.2.4
What are you trying to achieve: I am looking to implement a simple free drawing task in which participants can draw and selectively erase part of their drawing on the screen. The brush component works really nicely for the drawing, and changing the Line color to the background works for erasing. The issue is that there seems to be a maximum allowable line width, which makes erasing the intended part of the drawing time consuming.
Is there a workaround to allow erasing a larger portion of the drawing at once?

Thanks for your help!

Thanks for the nice video example. Looking through the code, the maximum line width mentioned in that hint doesn’t actually seem to be enforced anywhere. Can you let us know what the effect is of setting that parameter to be 10 vs 20, for example (might be best if you set the colour to something visible)?

Thanks–attached is a test run with the line width by 1 (1 to “15”). It looks like it maxes out around 6 or 7?

Excellent example again. Looking at the source code for PsychoPy, I can’t see any limits being set (contrary to that hint which indicates a maximum line width of ten). This makes me think that the issue may be at the level of OpenGL, where there are values for things like GL_ALIASED_LINE_WIDTH_RANGE. Even reading those values is well beyond my area of knowledge, though.

@jon, do you have any light to shed on how much control we have over the line widths of ShapeStims?

I’m afraid that’s currently handled entirely by the basic settings of OpenGL Line objects. I believe the point at which that maxes out is probably up to the graphics card driver (not something specified in the GL spec as such so not fixed)

Thank you both for your responses!

So if it is a limitation of OpenGL, would it make sense to try coding something using a rectangle ShapeStim instead of a line? i.e., draw a new shape at the current mouse position every frame?

1 Like

Or, ultimately we could use the concept of a brush shape that can be made (like in photoshop) and then gets placed repeatedly along a path. That would be more like the element array stim.

Quick update on this–I tried adapting the code to run on pavlovia and the line widths do scale as expected :slight_smile:

The only issue is since the brush component is not yet supported online I needed to directly edit the .js file to pass the lineWidth and lineColor arguments through getbrush to switch between drawing and erasing.

Hi Deborah,
Would you be able to share the javascript code you used for your brush? I cannot get mine to work online without closing the shape, despite setting closeShape : false!
Many thanks!

Hey both… I am getting the same issue with closed Brush online, I’d be delighted if you couls share any quick fix?

Hi, check out this post:
Brush tool closes automatically in psychojs/online, despite closeShape : false - #10 by jameslc

1 Like

Many thanks!