Liking cljdoc? Tell your friends :D

clojure2d.protocols


ColorProtocljprotocol

Basic color operations

Basic color operations

alphaclj

(alpha c)

Returns alpha value.

Returns alpha value.

blueclj

(blue c)

Returns blue (third channel) value. See also [[ch2]].

Returns blue (third channel) value. See also [[ch2]].

greenclj

(green c)

Returns green (second channel) value. See also [[ch1]].

Returns green (second channel) value. See also [[ch1]].

lumaclj

(luma c)

Returns luma

Returns luma

redclj

(red c)

Returns red (first channel) value. See also [[ch0]].

Returns red (first channel) value. See also [[ch0]].

to-awt-colorclj

(to-awt-color c)

Convert any color representation to java.awt.Color.

Convert any color representation to `java.awt.Color`.

to-colorclj

(to-color c)

Convert any color representation to Vec4 vector.

Convert any color representation to `Vec4` vector.
sourceraw docstring

ImageProtocljprotocol

Image Protocol

Image Protocol

convolveclj

(convolve i t)

Convolve with Java ConvolveOp. See [[convolution-matrices]] for kernel names.

Convolve with Java ConvolveOp. See [[convolution-matrices]] for kernel names.

get-imageclj

(get-image i)

Return BufferedImage

Return BufferedImage

heightclj

(height i)

Height of the image.

Height of the image.

resizeclj

(resize i w h)

Resize image.

Resize image.

saveclj

(save i n)

Save image i to a file n.

Save image `i` to a file `n`.

subimageclj

(subimage i x y w h)

Return part of the image.

Return part of the image.

widthclj

(width i)

Width of the image.

Width of the image.
sourceraw docstring

KeyEventProtocljprotocol

Access to key event data

Access to key event data

key-charclj

(key-char e)

Key as char.

Key as char.

key-codeclj

(key-code e)

Keycode mapped to keyword. See java.awt.event.KeyEvent documentation. Eg. VK_LEFT is mapped to :left.

Keycode mapped to keyword. See `java.awt.event.KeyEvent` documentation. Eg. `VK_LEFT` is mapped to `:left`.

key-rawclj

(key-raw e)

Raw value for pressed key (as integer).

Raw value for pressed key (as integer).
sourceraw docstring

ModifiersProtocljprotocol

Get state of keyboard modifiers.

Get state of keyboard modifiers.

alt-down?clj

(alt-down? e)

ALT key state as boolean.

ALT key state as boolean.

alt-gr-down?clj

(alt-gr-down? e)

ALT-GR key state as boolean.

ALT-GR key state as boolean.

control-down?clj

(control-down? e)

CONTROL key state as boolean.

CONTROL key state as boolean.

meta-down?clj

(meta-down? e)

META key state as boolean.

META key state as boolean.

shift-down?clj

(shift-down? e)

SHIFT key state as boolean.

SHIFT key state as boolean.
sourceraw docstring

MouseButtonProtocljprotocol

Get pressed mouse button status.

Get pressed mouse button status.

mouse-buttonclj

(mouse-button m)

Get mouse pressed button status: :left :right :center or :none

Get mouse pressed button status: :left :right :center or :none
sourceraw docstring

MouseXYProtocljprotocol

Mouse position.

Mouse position.

mouse-posclj

(mouse-pos m)

Mouse position as [[Vec2]] type. [0,0] - top left, [-1,-1] outside window.

Mouse position as [[Vec2]] type. [0,0] - top left, [-1,-1] outside window.

mouse-xclj

(mouse-x m)

Mouse horizontal position within window. 0 - left side. -1 outside window.

Mouse horizontal position within window. 0 - left side. -1 outside window.

mouse-yclj

(mouse-y m)

Mouse vertical position. 0 - top, -1 outside window.

Mouse vertical position. 0 - top, -1 outside window.
sourceraw docstring

PixelsProtocljprotocol

Functions for accessing and setting channel values or colors. PixelsProto is used in following types:

  • Pixels - all functions
  • Image, Canvas, Window - Only [[get-value]] and [[get-color]] for given position and conversion to Pixels. Accessing color or channel value is slow.
  • Log density renderer - Only [[set-color!]], [[get-color]] and conversion to Pixels.
Functions for accessing and setting channel values or colors. PixelsProto is used in following types:

* `Pixels` - all functions
* `Image`, `Canvas`, `Window` - Only [[get-value]] and [[get-color]] for given position and conversion to Pixels. Accessing color or channel value is slow.
* `Log density renderer` - Only [[set-color!]], [[get-color]] and conversion to Pixels.  

get-channelclj

(get-channel pixels ch)

Return whole ints array with chosen channel

Return whole `ints` array with chosen channel

get-colorclj

(get-color pixels idx)
(get-color pixels x y)

Get color by index or position. In case of low density rendering returns current average color without alpha value.

Get color by index or position. In case of low density rendering returns current average color without alpha value.

get-valueclj

(get-value pixels ch idx)
(get-value pixels ch x y)

Get channel value by index or position.

Get channel value by index or position.

set-channel!clj

(set-channel! pixels ch v)

Set whole channel (as ints array)

Set whole channel (as `ints` array)

set-color!clj

(set-color! pixels idx v)
(set-color! pixels x y v)

Set color value by index or position.

Set color value by index or position.

set-value!clj

(set-value! pixels ch idx v)
(set-value! pixels ch x y v)

Set channel value by index or position

Set channel value by index or position

to-pixelsclj

(to-pixels pixels)
(to-pixels pixels cfg)
(to-pixels pixels x y w h)

Convert to Pixels. For low density rendering provide configuration. Works with Image/Canvas/Window and low density renderer.

Convert to Pixels. For low density rendering provide configuration. Works with Image/Canvas/Window and low density renderer.
sourceraw docstring

PressedProtocljprotocol

Key or mouse pressed status.

Key or mouse pressed status.

key-pressed?clj

(key-pressed? w)

Any key pressed? (boolean)

Any key pressed? (boolean)

mouse-pressed?clj

(mouse-pressed? w)

Any mouse button pressed? (boolean)

Any mouse button pressed? (boolean)
sourceraw docstring

RendererProtocljprotocol

add-pixel!clj

(add-pixel! r x y)
(add-pixel! r x y c)

get-pixelclj

(get-pixel r x y)
source

ShapeProtocljprotocol

bounding-boxclj

(bounding-box shape)

contains-point?clj

(contains-point? shape x y)

contains-rectangle?clj

(contains-rectangle? shape x y w h)

intersects-rectangle?clj

(intersects-rectangle? shape x y w h)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close