6.11
1 Icons
1.1 What is an icon?
This section describes an ideal that DrRacket and its tools are steadily approaching.
As a first approximation, an icon is just a small bitmap%, usually with an alpha channel.
But an icon also communicates.
Its shape and color are a visual metaphor for an action or a message.
Icons should be easily recognizable, distinguishable, visually consistent, and metaphorically appropriate for the actions and messages they are used with.
It can be difficult to meet all four requirements at once (“distinguishable” and “visually consistent’ are often at odds), but good examples, good abstractions, and an existing icon library help considerably.
Example: The Macro Stepper icon is composed by appending a text icon and a step icon to get .
The syntax quote icon is the color that DrRacket colors syntax quotes by default.
The step icon is colored like DrRacket colors identifier syntax by default, and is shaped using metaphors used in debugger toolbars, TV remotes, and music players around the world.
It is composed of to connote starting and to connote immediately stopping.
It would not do to have just as the Macro Stepper icon: it would be too easily confused with the Debugger icon ,
especially for new users and people with certain forms of color-blindness, and thus fail to be distinguishable enough.
As another example, the Check Syntax icon connotes inspecting and passing.
Notice that the check mark is also the color of syntax.
1.2 About These Icons
The icons in this collection are designed to be composed to create new ones: they are simple, thematically consistent, and can be constructed in any size and color.
Further, slideshow’s
pict combiners offer a way to compose them almost arbitrarily.
For example, a media player application might create a large “step” button by superimposing a
record-icon and a
step-icon:
> (require pict images/icons/control images/icons/style) |
|
|
All the icons in this collection are first drawn using standard dc<%> drawing commands.
Then, to get lighting effects, they are turned into 3D objects and ray traced.
Many are afterward composed to create new icons; for example, the stop-signs-icon superimposes three stop-sign-icons, and the magnifying-glass-icon is composed of three others (frame, glass and handle).
The ray tracer helps keep icons visually consistent with each other and with physical objects in day-to-day life.
As an example of the latter, the record-icon, when rendered in clear glass, looks like the clear, round button on a Wii Remote.
See the plt-logo and planet-logo functions for more striking examples.
When the rendering API is stable enough to publish, it will allow anyone who can draw a shape to turn that shape into a visually consistent icon.
As with any sort of rendering (such as SVG rendering), ray tracing takes time.
For icons, this usually happens during tool or application start up.
You can reduce the portion of start-up time taken by rendering to almost nothing by using the images/compile-time library to embed bitmaps directly into compiled modules.
1.3 Icon Style
Use these constants and parameters to help keep icon sets visually consistent.
halt-icon-color : (or/c string? (is-a?/c color%))
|
= (make-object color% 255 32 24) |
Standard toolbar icon colors.
Use
run-icon-color in icons that connote executing programs or evaluation. Examples:
For new users and for accessibility reasons, do not try to differentiate icons for similar functions only by color.
The height of DrRacket’s standard icons.
The height of DrRacket toolbar icons.
Use (toolbar-icon-height) as the height argument for common icons that will be used in toolbars, status bars, and buttons.
(When making an icon for DrRacket’s main toolbar, try to keep it nearly square so that it will not take up too much horizontal space when the toolbar is docked vertically.
If you cannot, as with the Macro Stepper, send a thinner icon as the alternate-bitmap argument to a switchable-button%.)
The backing scale of DrRacket icons.
A backing scale of 2 means that the icon bitmap internally has two
pixels per drawing unit, so it renders well at double resolution,
such as Retina display mode for Mac OS.
Added in version 1.1 of package images-lib.
Materials for icons.
Plastic is opaque and reflects a little more than glass.
Rubber is also opaque, reflects more light than plastic, but diffuses less.
Glass is transparent but frosted, so it scatters refracted light.
It has the high refractive index of cubic zirconia, or fake diamond.
The “glassy look” cannot actually be achieved using glass.
Metal reflects the most, its specular highlight is nearly the same color as the material (in the others, the highlight is white),
and it diffuses much more ambient light than directional.
This is because while plastic and glass mostly reflect light directly, metal mostly absorbs light and re-emits it.
Examples:
The material used for rendering most icons and icon parts.
There are exceptions; for example, the
floppy-disk-icon always renders the sliding cover in metal.
(bitmap-render-icon bitmap [z-ratio material]) → (is-a?/c bitmap%)
|
bitmap : (is-a?/c bitmap%) |
z-ratio : (and rational? (>=/c 0)) = 5/8 |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
Makes a 3D object out of
bitmap and renders it as an icon.
The z-ratio argument only makes a difference when material is transparent, such as glass-icon-material.
It controls what fraction of bitmap’s height the icon is raised, which in turn affects the refracted shadow under the icon:
the higher the z-ratio, the lower the shadow.
Examples:
More complex shapes than “embossed and rounded” are possible with the full rendering API, which will be made public in a later release.
Still, most of the simple icons (such as those in images/icons/arrow and images/icons/control) can be rendered using only bitmap-render-icon.
For a given icon color, returns the proper outline
color%.
The outline width is usually (/ height 32) (in this case, 2), but not always.
(For example, recycle-icon is an exception, as are parts of floppy-disk-icon.)
1.4 Arrow Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(right-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(left-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(up-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(down-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Standard directional arrows.
(right-over-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(left-over-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(left-under-arrow-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Standard bent arrows.
1.5 Control Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(bar-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
This is not a “control” icon per se, but is used to make many others.
(play-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(back-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(fast-forward-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(rewind-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(stop-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(record-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(pause-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(step-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(step-back-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(continue-forward-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(search-forward-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(search-backward-icon | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
1.6 File Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(floppy-disk-icon | [ | #:color color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = "slategray" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(save-icon | [ | #:disk-color disk-color | | | | | | | #:arrow-color arrow-color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
disk-color : (or/c string? (is-a?/c color%)) = "gold" |
| arrow-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | syntax-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(load-icon | [ | #:disk-color disk-color | | | | | | | #:arrow-color arrow-color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
disk-color : (or/c string? (is-a?/c color%)) = "gold" |
| arrow-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | syntax-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(small-save-icon | [ | #:disk-color disk-color | | | | #:arrow-color arrow-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
disk-color : (or/c string? (is-a?/c color%)) = "gold" |
| arrow-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | syntax-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(small-load-icon | [ | #:disk-color disk-color | | | | #:arrow-color arrow-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
disk-color : (or/c string? (is-a?/c color%)) = "gold" |
| arrow-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | syntax-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
1.7 Symbol and Text Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(text-icon | | str | | | | | | [ | font | | | | | | | #:trim? trim? | | | | | | | #:color color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:outline outline | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
str : string? |
font : (is-a?/c font%) = (make-font) |
trim? : boolean? = #t |
color : (or/c string? (is-a?/c color%)) = "white" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
outline : (and/c rational? (>=/c 0)) = (/ height 32) |
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Renders a text string as an icon. For example,
> (text-icon "An Important Point!" | (make-font #:weight 'bold #:underlined? #t) | #:color "lightskyblue" #:height 44) |
|
|
The size of font is ignored. If trim? is #f, the drawn text is not cropped before rendering.
Otherwise, it is cropped to the smallest rectangle containing all the non-zero-alpha pixels.
Rendering very small glyphs shows the difference dramatically:
|
(list ) |
Because different platforms have different fonts, text-icon cannot guarantee the icons it returns have a consistent look or width across all platforms, or that any unicode characters in str will exist.
(recycle-icon | [ | #:color color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = "forestgreen" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Returns the universal recycling symbol, rendered as an icon.
(x-icon | [ | #:color color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:thickness thickness | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) = halt-icon-color |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
thickness : (and/c rational? (>=/c 0)) = 10 |
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Returns an “x” icon that is guaranteed to look the same on all platforms.
(Anything similar that would be constructed by
text-icon would differ at least slightly across platforms.)
Changed in version 1.1 of package images-lib: Added optional #:thickness argument.
(check-icon | [ | #:color color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) = run-icon-color |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(lambda-icon | [ | #:color color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
| color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(hash-quote-icon | [ | #:color color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = "mediumseagreen" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
1.8 Miscellaneous Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(regular-polygon-icon | | sides | | | [ | start] | | | | #:color color | | | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
sides : exact-positive-integer? |
start : real? = (- (/ pi sides) (* 1/2 pi)) |
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Renders the largest regular polygon with sides sides, with the first vertex at angle start, that can be centered in a height × height box.
The default start angle is chosen so that the polygon has a horizontal bottom edge.
(stop-sign-icon | [ | #:color color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = halt-icon-color |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(stop-signs-icon | [ | #:color color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = halt-icon-color |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(foot-icon | | #:color color | | | | | | [ | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(magnifying-glass-icon | [ | #:frame-color frame-color | | | | #:handle-color handle-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
| frame-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
handle-color : (or/c string? (is-a?/c color%)) = "brown" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(left-magnifying-glass-icon | [ | #:frame-color frame-color | | | | #:handle-color handle-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
| frame-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
handle-color : (or/c string? (is-a?/c color%)) = "brown" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(bomb-icon | [ | #:cap-color cap-color | | | | | | | #:bomb-color bomb-color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
| cap-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
| bomb-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | dark-metal-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(left-bomb-icon | [ | #:cap-color cap-color | | | | #:bomb-color bomb-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
| cap-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
| bomb-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | dark-metal-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(clock-icon | [ | hours | | | | | | | minutes | | | | | | | #:face-color face-color | | | | | | | #:hand-color hand-color | | | | | | | #:height height | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
hours : (integer-in 0 11) = 0 |
minutes : (real-in 0 60) = 47 |
| face-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
hand-color : (or/c string? (is-a?/c color%)) = "firebrick" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Examples:
> (clock-icon #:height 96) |
|
> (clock-icon 3 21 #:height 48 | #:face-color "lightblue" | #:hand-color "darkblue") |
|
|
(stopwatch-icon | [ | hours | | | | minutes | | | | #:face-color face-color | | | | #:hand-color hand-color | | | | #:height height | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
hours : (integer-in 0 11) = 0 |
minutes : (real-in 0 60) = 47 |
| face-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
hand-color : (or/c string? (is-a?/c color%)) = "firebrick" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(stethoscope-icon | [ | #:color color | | | | #:height height | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = "black" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
|
→ (is-a?/c bitmap%) |
color : (or/c string? (is-a?/c color%)) = "black" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(lock-icon | [ | open? | | | | | | | #:body-color body-color | | | | | | | #:shackle-color shackle-color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
open? : boolean? = #f |
body-color : (or/c string? (is-a?/c color%)) = "orange" |
| shackle-color | | : | | (or/c string? (is-a?/c color%)) | | | | = | | light-metal-icon-color |
|
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
(close-icon | [ | #:color color | | | | | | | #:height height | | | | | | | #:material material | | | | | | | #:backing-scale backing-scale]) | | → | | (is-a?/c bitmap%) |
|
color : (or/c string? (is-a?/c color%)) = "black" |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Added in version 1.1 of package images-lib.
1.9 Stickman Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(standing-stickman-icon | [ | #:body-color body-color | | | | #:arm-color arm-color | | | | #:head-color head-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
body-color : (or/c string? (is-a?/c color%)) = run-icon-color |
arm-color : (or/c string? (is-a?/c color%)) = "white" |
head-color : (or/c string? (is-a?/c color%)) = run-icon-color |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Returns the icon displayed in DrRacket’s lower-right corner when no program is running.
(running-stickman-icon | | t | | | [ | #:body-color body-color | | | | #:arm-color arm-color | | | | #:head-color head-color | | | | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
t : rational? |
body-color : (or/c string? (is-a?/c color%)) = run-icon-color |
arm-color : (or/c string? (is-a?/c color%)) = "white" |
head-color : (or/c string? (is-a?/c color%)) = run-icon-color |
height : (and/c rational? (>=/c 0)) = (default-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Returns a frame of the icon animated in DrRacket’s lower-right corner when a program is running.
The frame returned is for time t of a run cycle with a one-second period.
The following example samples the run cycle at 12 Hz, or every 1/12 second:
The stickman’s joint angles are defined by continuous periodic functions, so the run cycle can be sampled at any resolution, or at any real-valued time t.
The cycle is modeled after the run cycle of the player’s avatar in the Commodore 64 game Impossible Mission.
1.10 Tool Icons
Changed in version 1.1 of package images-lib: Added optional #:backing-scale arguments.
(check-syntax-icon | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
height : (and/c rational? (>=/c 0)) = (toolbar-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
|
→ (is-a?/c bitmap%) |
height : (and/c rational? (>=/c 0)) = (toolbar-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Example:
|
(list ) |
|
→ (is-a?/c bitmap%) |
height : (and/c rational? (>=/c 0)) = (toolbar-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
|
→ (is-a?/c bitmap%) |
height : (and/c rational? (>=/c 0)) = (toolbar-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Example:
|
(list ) |
(debugger-icon | [ | #:height height | | | | #:material material | | | | #:backing-scale backing-scale]) | |
|
→ (is-a?/c bitmap%) |
height : (and/c rational? (>=/c 0)) = (toolbar-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
|
→ (is-a?/c bitmap%) |
height : (and/c rational? (>=/c 0)) = (toolbar-icon-height) |
| material | | : | | deep-flomap-material-value? | | | | = | | (default-icon-material) |
|
| backing-scale | | : | | (and/c rational? (>/c 0.0)) | | | | = | | (default-icon-backing-scale) |
|
Example:
|
(list ) |