racket / racket/draw

`draw-bitmap` ignores smoothing when the bitmap has a backing scale greater than 1.0 (at least on macOS)

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
19
Forks
24
PR merge metrics
No merged PRs in 30d

Description

On my machine, macOS 10.13.6, the draw-bitmap method of bitmap-dc% appears to ignore the current smoothing setting if the bitmap to be drawn has a backing scale greater than 1.0. This program reproduces the problem:

#lang racket

(require racket/draw)

(define (make-point-bitmap backing-scale)
  (define bmp (make-bitmap 3 3 #:backing-scale backing-scale))
  (define dc (new bitmap-dc% [bitmap bmp]))
  (send dc set-smoothing 'unsmoothed)
  (send dc draw-point 1.5 1.5)
  bmp)

(define (blow-up bmp scale)
  (define bmp* (make-bitmap (* (send bmp get-width) scale)
                            (* (send bmp get-height) scale)))
  (define dc (new bitmap-dc% [bitmap bmp*]))
  (send dc set-smoothing 'unsmoothed)
  (send dc set-scale scale scale)
  (send dc draw-bitmap bmp 0 0)
  bmp*)

(send (blow-up (make-point-bitmap 1.0) 100) save-file "blown-up-1.png" 'png)
(send (blow-up (make-point-bitmap 2.0) 100) save-file "blown-up-2.png" 'png)

The program produces the following images as output:

blown-up-1
blown-up-2

I would expect them to be the same, but the second is antialiased while the first one isn’t.

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 running the provided Racket reproduction on macOS and comparing the two generated PNGs. Trace the draw-bitmap behavior for bitmap-dc%, set-smoothing, and backing-scale; done means the two outputs respect the same unsmoothed setting when their backing scales differ.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.