Skip to content

ImagesAsSlots.md

Noah Gibbs edited this page Nov 21, 2023 · 1 revision

Images as Slots

Quoting the Shoes manual:

Another option is to combine all those ovals into a single image.

 Shoes.app do
   fill black(0.1)
   image 300, 300 do
     100.times do |i|
       oval i, i, i * 2
     end
   end
 end

There we go!  The ovals are all combined into a single 300 x 300 pixel image.
In this case, storing that image in memory might be much bigger than having
one-hundred ovals around.  But when you're dealing with thousands of shapes,
the image block can be cheaper.

Much like how Shoes does masking and (union) shapes, this would want us to render a bunch of random stuff into an image and then keep the image around. That assumes some level of drawing into a buffer or possibly render-and-screenshotting.

Old issue about the same thing