racket / racket/htdp

Support for transparent overlays

Open
#175 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

teachpack
Dominant language
Racket
Stars
112
Forks
73
Avg merge
9h 41m
Merged PRs (30d)
1

Description

Is it possible to add support for an overlay-like operation of "erasing" by overlaying a transparent image? For example, this would be useful for overlaying a doughnut shape over a colorful background while maintaining the background behind the center of the doughnut:

(overlay
 (circle 30 'solid 'green)
 (circle 50 'solid 'red)
 (above (rectangle 200 100 'solid 'green)
        (rectangle 200 100 'solid 'blue)))

but with a transparent rather than solid green background for the center of the doughnut shape, allowing the green-blue split to be visible. I can think of two ways to expand the API to support this functionality:

  • Add a new erase function
    (erase image scene) where scene is the background, and image is the area to be replaced by transparent pixels. The color of image could be ignored, or perhaps the function could require that the color of image is 'transparent
  • Add an 'overwrite mode for existing functions
    (circle 30 'overwrite 'transparent) This option may introduce lots of corner cases for existing functions, and the 'overwrite mode would be ignored in all cases except during an overlay.

Looking through the existing API, it seems that implementing this functionality could closely follow the existing overlay implementation, but I hope that others can suggest some additional feedback and propose better ways to proceed!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing overlay implementation and image API described in the issue. Decide whether transparent overlays should use a new erase function or an overwrite mode, then verify that a doughnut overlay preserves the background through its center.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.