racket / racket/draw

Low-level `cairo_image_surface_create` error on failed `make-bitmap`

Open
#61 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

Hi,

On my Apple M1 Max running 14.3 Sonoma, an overly-large bitmap surfaces a fairly low-level error

#lang racket
(require racket/draw)

(make-bitmap 2147483648 1)
------------------------------------------------------
Welcome to DrRacket, version 9.1 [cs].
Language: racket, with test coverage [custom]; memory limit: 256 MB.
. . cairo_image_surface_create: given value does not fit primitive C type
  C type: _int32
  value: 2147483648
> 

I don't know what the better thing to do is, but this peeks out through the htdp lang image library, and I would think that there we'd want to have a nicer domain-level error message. For instance:

#lang htdp/isl+
(require 2htdp/image)

(save-image
 (rectangle 2147483648 1 "solid" "black")
 "huge.png")

maybe something like "image is too large to render"?

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 reproducing the make-bitmap example and the 2htdp/image save-image example on the reported oversized dimensions. Trace how the low-level cairo_image_surface_create error reaches these entry points, then define and test a clearer domain-level error for images that are too large to render.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.