typemytype / drawbot

http://www.drawbot.com
Other
393 stars 61 forks source link

ImageObject.dotScreen() not applying to shadow() #547

Closed chrisjansky closed 8 months ago

chrisjansky commented 8 months ago

Hello,

Combining ImageObject.dotScreen() with shadow() (code below) produces the following result:

foo = ImageObject()

with foo:
    size(800, 800)
    fill(0.5)
    shadow((0, 0), 50)
    rect(50, 50, 700, 700)

foo.dotScreen()

image(foo, (100, 100))
Screenshot 2023-11-21 at 9 15 51

Is there any way for the blurred shadow() to be affected by ImageObject.dotScreen()? I’ve tried combining ImageObject.dotScreen() with ImageObject.gaussianBlur(), but got the same result.

Basically I’m looking for something like this:

Screenshot 2023-11-21 at 9 29 14

Thanks!

typemytype commented 8 months ago

you need a solid background, no transparent colors:

foo = ImageObject()

with foo:
    size(800, 800)
    # draw white background rect
    fill(1)    
    rect(0, 0, 800, 800)
    fill(0.5)
    shadow((0, 0), 50, (0, 0, 0))
    rect(50, 50, 700, 700)

foo.dotScreen()

image(foo, (100, 100))
chrisjansky commented 8 months ago

@typemytype Yes, that works, thank you!