29 Unsafe Libraries

▼ |  | The Racket Drawing Toolkit

1 | Overview
2 | bitmap%
3 | bitmap-dc%
4 | brush%
5 | brush-list%
6 | color%
7 | color-database<%>
8 | dc<%>
9 | dc-path%
10 | font%
11 | font-list%
12 | font-name-directory<%>
13 | gl-config%
14 | gl-context<%>
15 | linear-gradient%
16 | pdf-dc%
17 | pen%
18 | pen-list%
19 | point%
20 | post-script-dc%
21 | ps-setup%
22 | radial-gradient%
23 | record-dc%
24 | region%
25 | svg-dc%
26 | Drawing Functions
27 | Drawing Contracts
28 | Signature and Unit
29 | Unsafe Libraries
30 | Drawing Conveniences
31 | Platform Dependencies
| Bibliography
| Index

► | 29 | Unsafe Libraries

29.1 | Handle Brushes
29.2 | Cairo Library

On this page:

29.1`` Handle Brushes
make-handle-brush
29.2`` Cairo Library
cairo-lib

top contents ← prev up next →

### 29`` Unsafe Libraries🔗ℹ

The racket/draw library is currently implemented using Cairo and Pango. The get-handle in bitmap% method exposes the underlying Cairo surface for a bitmap% object, while make-handle-brush supports the creation of a brush from an existing Cairo surface. The representation of handles for these methods, however, is subject to change if the racket/draw library is implemented differently in the future.

#### 29.1`` Handle Brushes🔗ℹ

(require racket/draw/unsafe/brush) | package: draw-lib

> > procedure
> > (make-handle-brush |  | handle |  |  |  |
> > |  | width |  |  |  |
> > |  | height |  |  |  |
> > |  | transformation |  |  |  |
> > | [ | #:copy? copy?]) |  | → |  | (is-a?/c brush%)
> handle : cpointer?
> width : exact-nonnegative-integer?
> height : exact-nonnegative-integer?
> | transformation |  | : |  |
> (or/c #f (vector/c (vector/c real? real? real?
> real? real? real?)
> real? real? real? real? real?))
> copy? : any/c = #t

Creates a brush given a handle that (currently) is a cairo_surface_t. If copy? is true, then the surface is copied, so that it can be freed or modified after the brush is created; if copy? is #f, the surface must remain available and unchanged as long as the brush can be used.

The width and height arguments specify the surface bounds for use when the surface must be copied—even when copy? is #f. The surface may need to be converted to a stipple bitmap, for example, when drawing to a monochrome target.

The given surface is treated much like a stipple bitmap: it is implicitly repeated, and the given transformation (if any) determines the surface’s alignment relative to the target drawing context.

When the brush is used with a record-dc% object, and if that object’s get-recorded-datum method is called, then the surface is effectively converted to a stipple bitmap for the result datum.

#### 29.2`` Cairo Library🔗ℹ

(require racket/draw/unsafe/cairo-lib) | package: draw-lib

> value cairo-lib : (or/c ffi-lib? #f)

A reference to the Cairo library for use with functions such as get-ffi-obj, or #f if Cairo is unavailable.
top contents ← prev up next →