Is it possible to display bitmap in a loop?
Nobody has claimed this yet.
- Dominant language
- Racket
- Stars
- 19
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
I am drawing bitmaps to the output like so
#lang racket
(require racket/draw)
(define imageWidth 64)
(define imageHeight 64)
(define target (make-bitmap imageWidth imageHeight))
(define dc (new bitmap-dc% [bitmap target]))
(define (set-frame dc color)
(send dc set-pen "black" 2 'solid)
(send dc set-brush color 'solid)
)
(define (display-frame dc)
(send dc draw-rectangle 0 0 imageWidth imageHeight)
target
)
(set-frame dc (make-color 255 255 255))
(display-frame dc)
(set-frame dc (make-color 255 0 0))
(display-frame dc)
(set-frame dc (make-color 0 255 0))
(display-frame dc)
(set-frame dc (make-color 0 0 255))
(display-frame dc)

However if I try to loop and send the bitmap to the output like so I don't see anything
#lang racket
(require racket/draw)
(define imageWidth 64)
(define imageHeight 64)
(define target (make-bitmap imageWidth imageHeight))
(define dc (new bitmap-dc% [bitmap target]))
(define (set-frame dc color)
(send dc set-pen "black" 2 'solid)
(send dc set-brush color 'solid)
)
(define (display-frame dc)
(send dc draw-rectangle 0 0 imageWidth imageHeight)
target
)
(for ([x (in-range 4)])
(set-frame dc (make-color 255 0 0))
(display-frame dc)
)

I am not sure why its not working, but I am sure I am just making some noobie mistake.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two Racket examples from the issue using racket/draw, comparing the top-level bitmap expressions with the for loop. Determine whether the loop's bitmap output is expected to be displayed and identify what behavior should be documented or corrected; done means the loop behavior is explained and the reported example works or has a clear resolution.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100