GridFlow 0.8.0 - Reference Manual: Flow Classes

       

Objects for making grids and breaking them down

  • [#import]
  • [#export]
  • [#export_list]
  • [#export_symbol]
  • [#pack]
  • [#color]
  • [#unpack]
  • [#centroid]
  • [#centroid2]
  • [#for]

Objects for Computing

  • [#]
  • [@complex_sq]
  • [#fold]
  • [#scan]
  • [#outer]
  • [#inner]
  • [@join]
  • [#finished]
  • [#cast]
  • [#ravel]
  • [#grade]
  • [#perspective]
  • [#transpose]
  • [#fade]
  • [#fade_lin]
  • [#reverse]

Objects for Coordinate Transforms

  • [#redim]
  • [#store]
  • [#scale_to]
  • [#scale_by]
  • [#downscale_by]
  • [#spread]
  • [#rotate]
  • [#remap_image]

Objects for Reporting

  • [#dim]
  • [#type]
  • [#print]
  • [rubyprint]
  • [printargs]
  • [display]

Objects for Color Conversion

  • [#apply_colormap_channelwise]
  • [#rgb_to_greyscale]
  • [#greyscale_to_rgb]
  • [#yuv_to_rgb]
  • [#rgb_to_yuv]

Objects for Miscellaneous Picture Processing

  • [#convolve]
  • [#contrast]
  • [#posterize]
  • [#solarize]
  • [#checkers]
  • [#layer]
  • [#draw_image]
  • [#draw_polygon]
  • [#text_to_image]
  • [#hueshift]

Other Objects

  • [rtmetro]
  • [bindpatcher]
  • [pingpong]
  • [#global]
  • [fps]
  • [unix_time]
  • [ls]
  • [exec]
  • [renamefile]
  • [plotter_control]
  • [rubyarray]

jMax emulation

  • [fork]
  • [jmax_udpsend]
  • [jmax_udpreceive]
  • [foreach]
  • [rubysprintf]
  • [listflatten]
  • [listmake]
  • [listlength]
  • [listelement]
  • [listsublist]
  • [listprepend]
  • [listappend]
  • [listreverse]
  • [oneshot]
  • [inv+]
  • [inv*]
  • [messageprepend]
  • [messageappend]
  • [shunt]
  • [demux]
  • [range]

PureData emulation

  • [pd_netsend]
  • [pd_netreceive]


Objects for making grids and breaking them down

  class #import

[#import]





This object allows you to produce grids from non-grid data, such as integers and lists of integers. This object also reframes/resyncs grids so that multiple grids may be joined together, or single grids may be split. That kind of operation is already done implicitly in many cases (e.g. sending an integer or list to a grid-receiving inlet), but using this object you have greater flexibility on the conversion.


attr shape (GridShape|symbol(per_message) shape)
attr cast (NumberType cast)
method init (shape, cast)

inlet 0 method int () begins a new grid if there is no current grid. puts that integer in the current grid. ends the grid if it is full. the constructed grid is not stored: it is streamed. the stream is buffered, so the output is in packets of about a thousand numbers.

inlet 0 method list () just like a sequence of ints sent one after another, except in a single message.

inlet 0 method symbol () considered as a list of ascii characters.

inlet 0 method reset () aborts the current grid if there is one.

inlet 0 method grid (grid(dims...) grid) this is the equivalent of filtering this grid through an [#export] object and sending the resulting integers to this [#import] object, except that it's over 10 times faster.

inlet 1 method per_message () old synonym for "shape per_message"

outlet 0 method grid (grid grid) the grid produced from incoming integers and/or grids.

  class #export

[#export]





this object is the opposite of #import.


method init () this object is not configurable because there isn't anything that could possibly be configured here.

inlet 0 method grid (grid(dims...) grid) transforms this grid into a sequence of integer messages.

outlet 0 method int () elements of the incoming grid.

  class #export_list

[#export_list]





this object is another opposite of [#import], which puts all of its values in a list.


method init ()

inlet 0 method grid (grid(dims...) grid) transforms this grid into a single message containing a list of integers.

outlet 0 method list () elements of the incoming grid.

  class #export_symbol

[#export_symbol]





this object is another opposite of #import, which constructs a symbol from its input. The values are expected to be valid ASCII codes, but no check will be performed for that, and additionally, no check will be made that the generated symbol only contains characters that can be put in a symbol.


method init ()

inlet 0 method grid (grid(dims...) grid) transforms this grid into a single message containing a list of integers.

outlet 0 method symbol () generated symbol

  class #pack

[#pack]





Similar to [#join], but takes individual integers, and builds a Dim(N) vector out of it.


attr trigger_by (TriggerBy trigger_by)
method init (integer inputs)

inlet * method int ()

outlet 0 method grid () combination of inputs given in all inlets. this is produced according to the value of the trigger attribute.

  class #color

[#color]





Triple slider for the selection of RGB values.


method init (float min, float max, 0,1 hidepreview)

inlet 0 method grid () Produces a Dim(3) grid of RGB values.

  class #unpack

[#unpack]






method init (integer outputs)

inlet 0 method grid(N) () the input vector is split in N parts containing one number each. numbers are sent left-to-right, that is, outlet 0 is triggered first, then outlet 1, etc.

outlet * method int ()

  class #centroid

[#centroid]






method init ()

inlet 0 method grid(rows,columns,1) () will compute the centroid of the given grid, which is a weighted average, namely, the average position weighted by the pixel values.

outlet 0 method grid(2) () result

  class #centroid2

[#centroid2]





a new experimental and faster version of #centroid.
method init ()

inlet 0 method grid(rows,columns,1) () will compute the centroid of the given grid, which is a weighted average, namely, the average position weighted by the pixel values.

outlet 0 method grid(2) () result

  class #for

[#for]





when given scalar bounds, works like a regular [for] object plugged to a [#import] tuned for a Dim(size) where size is the number of values produced by a bang to that [for].

when given vector bounds, will work like any number of [for] objects producing all possible combinations of their values in the proper order. This replaces the old [#identity_transform] object.


method init (integer from, integer to, integer step)

inlet 0 method grid (grid(index) grid) replaces the "from" value and produces output.

inlet 1 method grid (grid(index) grid) replaces the "to" value.

inlet 2 method grid (grid(index_steps) grid) replaces the "step" value.

outlet 0 method grid (grid(size) grid) where size is floor((to-from+1)/step) [for scalar bounds]

outlet 0 method grid (grid(*size,dimension) grid) where *size is floor((to-from+1)/step) [for vector bounds]

 

Objects for Computing

  class #

[#]






attr op (grid op)
attr right_hand (grid right_hand)

This object outputs a grid by computing "in parallel" a same operation on each left-hand element with its corresponding right-hand element.


method init (op, right_hand)

inlet 0 method grid (grid(dims...) grid) on each element of this grid, perform the operation together with the corresponding element of inlet 1. in the table of operators (at the top of this document) elements of inlet 0 are called "A" and elements of inlet 1 are called "B". the resulting grid is the same size as the one in inlet 0.

inlet 1 method grid (grid(dims...) grid) any grid, preferably shaped like the one that will be put in the left inlet, or like a subpart of it (anyway the contents will be redim'ed on-the-fly to fit the grid of inlet-0, but the stored grid will not be modified itself)

inlet 1 method int () stores a single int in the right inlet; the same int will be applied in all computations; this is like sending a Dim(1) or Dim() grid with that number in it.

outlet 0 method grid (grid grid)

  class @complex_sq

[@complex_sq]





this object computes the square of complex numbers. If seeing imaginary as Y and real as X, then this operation squares the distance of a point from origin and doubles the angle between it and the +X half-axis clockwise. (fun, eh?)

used on an indexmap, this makes each thing appear twice, each apparition spanning half of the original angle.


inlet 0 method grid (grid(dims... {imaginary real}) grid)

outlet 0 method grid (grid(dims... {imaginary real}) grid)

  class #fold

[#fold]





  • 1 : [#fold +] computes totals
  • 2 : [#fold inv+] is an alternated sum (+/-)
  • 3 : [#fold * 1] can compute the size of a grid using its dimension list
  • 4 : [#fold & 1] can mean "for all"
  • 5 : [#fold | 0] can mean "there exists (at least one)"
  • 6 : [#fold ^ 0] can mean "there exists an odd number of..."
  • 7 : [#fold ^ 1] can mean "there exists an even number of...".


method init (numop2 operator, grid seed, grid right_hand)

inlet 0 method grid (grid(dims..., last) grid) replaces every Dim(last) subgrid by the result of a cascade on that subgrid. Doing that with seed value 0 and operation + on grid "2 3 5 7" will compute ((((0+2)+3)+5)+7) find the total "17". produces a Dim(dims) grid.

  class #scan

[#scan]





[#scan +] computes subtotals; this can be used, for example, to convert a regular probability distribution into a cumulative one. (or in general, discrete integration)


method init (numop2 operator, grid seed)

inlet 0 method grid (grid(dims..., last) grid) replaces every Dim(last) subgrid by all the results of cascading the operator on that subgrid, producing a Dim(dims,last) grid. For example, with base value 0 and operation + on grid "2 3 5 7" will compute 0+2=2, 2+3=5, 5+5=10, 10+7=17, and give the subtotals "2 5 10 17".

  class #outer

[#outer]






method init (numop2 operator, grid value) the operator must be picked from the table of two-input operators. the grid is optional and corresponds to inlet 1.

inlet 0 method grid (grid(anyA...) grid)
produces a grid of size Dim(anyA..., anyB...), where numbers are the results of the operation on every element of A and every element of B. the resulting array can be very big. Don't try this on two pictures (the result will have 6 dimensions)
inlet 1 method grid (grid(anyB...) grid)
stores the specified grid, to be used when inlet 0 is activated.

When given a grid of Dim(3) and a grid of Dim(5) [#outer] will produce a grid of Dim(3,5) with the selected two-input operation applied on each of the possible pairs combinations between numbers from the left grid and the ones from the right. for example : (10,20,30) [#outer +] (1,2,3) will give : ((11,12,13),(21,22,23),(31,32,33))


  class #inner

[#inner]





think of this one as a special combination of [#outer], [#] and [#fold]. this is one of the most complex operations. It is very useful for performing linear transforms like rotations, scalings, shearings, and some kinds of color remappings. A linear transform is done by something called matrix multiplication, which happens to be [#inner * + 0]. [#inner] also does dot product and other funny operations.


method init (numop2 op_para, numop2 op_fold, integer base, grid right_hand) op_para and op_fold are two operators picked from the table of two-input operators. the base value has to be specified (has no default value yet).

inlet 0 method grid (grid(anyA..., lastA) grid) Splits the Dim(anyA...,lastA) left-hand grid into Dim(anyA...) pieces of Dim(lastA) size. Splits the Dim(firstB,anyB...) right-hand grid into Dim(anyB...) pieces of Dim(firstB) size. On every piece pair, does [#] using the specified op_para operation, followed by a [#fold] using the specified op_fold operator and base value. creates a Dim(anyA...,anyB...) grid by assembling all the results together. (note: lastA must be equal to firstB.)

inlet 1 method int () changes the base value to that.

inlet 2 method grid (grid(anyB..., lastB) grid) changes the right-hand side grid to that.

  class @join

[@join]






method init (which_dim) Which_dim is the number of the dimension by which the join will occur. For N-dimensional grids, the dimensions are numbered from 0 to N-1. In addition, negative numbers from -N to -1 may be used, to which N will be added.

inlet 0 method grid (grid grid) The left grid and right grid must have the same number of elements in all dimensions except the one specified. The result will have the same number of elements in all dimensions except the one specified, which will be the sum of the two corresponding one.

For example, joining a RGB picture Dim[y,x,3] and a greyscale picture Dim[y,x,1] on dimension 2 (or -1) could make a RGBA picture Dim[y,x,4] in which the greyscale image becomes the opacity channel.



inlet 1 method grid (grid grid)

  class #finished

[#finished]






inlet 0 method grid (grid grid) any grid
a bang is emitted every time a grid transmission ends.
  class #cast

[#cast]






method init (numbertype numbertype)

inlet 0 method grid (grid grid) any grid

outlet 0 method grid (grid grid) a grid of the same shape containing all the same values after type conversion. note that while casting to a smaller type, values that are overflowing will be truncated.

  class #ravel

[#ravel]






inlet 0 method grid (grid grid) any grid

outlet 0 method grid (grid grid) like [#redim] but always produce a 1-D grid with the same total number of elements.

  class #grade

[#grade]






inlet 0 method grid (grid grid) any grid

outlet 0 method grid (grid grid)

splits a Dim[A...,B] grid into Dim[B] vectors, producing new Dim[B] vectors that each contain numbers from 0 to B-1 indicating the ordering of the values. The result is a Dim[A...,B] grid.

for example, connecting a [#grade] to a [#outer ignore {0}] to a [#store] object, storing a single vector into [#store], and sending the same vector to [#grade], will sort the values of the vector. however for higher-dimensional grids, what should go between [#store] and [#grade] to achieve the same result would be more complex.

you may achieve different kinds of sorting by applying various filters before [#grade]. the possibilities are unlimited.

if you plug [#grade] directly into another [#grade], you will get the inverse arrangement, which allows to take the sorted values and make them unsorted in the original way. note that this is really not the same as just listing the values backwards.



  class #perspective

[#perspective]






method init (integer depth)

inlet 0 method grid (grid grid) any grid

outlet 0 method grid (grid grid)

transforms a Dim[A...,B] grid into a Dim[A...,B-1] grid. There is a projection plane perpendicular to the last axis and whose position is given by the "depth" parameter. Each vector's length is adjusted so that it lies onto that plane. Then the last dimension of each vector is dropped.

useful for converting from 3-D geometry to 2-D geometry. Also useful for converting homogeneous 3-D into regular 3-D, as homogeneous 3-D is really just regular 4-D...(!)



  class #transpose

[#transpose]






method init (integer dim1, integer dim2)

inlet 0 method grid (grid grid) swaps the two specified dimensions; dimension numbers are as in [#join].

  class #fade

[#fade]






method init (integer rate)

inlet 0 method grid (grid grid) produces on outlet 0 a linear recurrent fading according to the flow of incoming messages. For example, if rate=5, then 20% (one fifth) of each new message will be blended with 80% of the previous output.

  class #fade_lin

[#fade_lin]






method init (integer maxraise, integer maxdrop)

inlet 0 method grid (grid grid) produces on outlet 0 a piecewise-linear nonrecurrent fading according to the flow of incoming messages. For example, if maxraise=2 and maxdrop=4, then with each new message an output is produced that is at most 2 more or 4 less than the previous output.

  class #reverse

[#reverse]






method init (whichdim) Whichdim is the number of the dimension by which the reverse will occur. For N-dimensional grids, the dimensions are numbered from 0 to N-1. In addition, negative numbers from -N to -1 may be used, to which N will be added.

 

Objects for Coordinate Transforms

  class #redim

[#redim]






method init (dim_list dims) a list specifying a grid shape that the numbers will fit into. (same as with [#import])

inlet 0 method grid (grid(dims...) grid) the elements of this grid are serialized. if the resulting grid must be larger, the sequence is repeated as much as necessary. if the resulting grid must be smaller, the sequence is truncated. then the elements are deserialized to form the resulting grid.

inlet 1 method grid (grid(rank) grid) this grid is a dimension list that replaces the one specified in the constructor. (same as with [#import])

outlet 0 method grid (grid grid) redimensioned grid potentially containing repeating data.

example: with a 240 320 RGB image, [#redim 120 640 3] will visually separate the even lines (left) from the odd lines (right). contrary to this, [#redim 640 120 3] will split every line and put its left half on a even line and the right half on the following odd line. [#redim] 480 320 3 will repeat the input image twice in the output image. [#redim] 240 50 3 will only keep the 50 top lines.


  class #store

[#store]





A [#store] object can store exactly one grid, using the right inlet. You fetch it back, or selected subparts thereof, using the left inlet.


method init (grid contents)

inlet 0 method bang () the stored grid is fully sent to the outlet.

inlet 0 method grid (grid(dims..., indices) grid) in this grid, the last dimension refers to subparts of the stored grid. sending a Dim(200,200,2) on a [#store] that holds a Dim(240,320,3) will cause the [#store] to handle the incoming grid as a Dim(200,200) of Dim(2)'s, where each Dim(2) represents a position in a Dim(240,320) of Dim(3)'s. therefore the resulting grid will be a Dim(200,200) of Dim(3) which is a Dim(200,200,3). in practice this example would be used for generating a 200*200 RGB picture from a 200*200 XY map and a 240*320 RGB picture. this object can be logically used in the same way for many purposes including color palettes, tables of probabilities, tables of statistics, whole animations, etc.

inlet 1 method grid (grid(dims...) grid) replace the whole grid, or a subpart of it (see other options on inlet 1)

inlet 1 method reassign () (Future Use): makes it so that sending a grid to inlet 1 detaches the old buffer from [#store] and attaches a new one instead. This is the default.

inlet 1 method put_at (indices...) (Future Use): makes it so that sending a grid to inlet 1 writes into the existing buffer of [#store].

example: suppose you have [#store {10 240 320 3}]. then "put_at 3" will allow to write a Dim[240,320,3] grid in indices (3,y,x,c) where y,x,c are indices of the incoming grid; in other words, if that's a buffer of 10 RGB frames, you'd be replacing frame #3. Furthermore, it also allows you to write a Dim[n,240,320,3] grid at (3+f,y,x,c) where f,y,x,c are indices of the incoming grid, replacing frame #3, #4, ... up to #3+n-1. Here n is at most 7 because the last frame in the buffer is #9.

that way of working extends to other kinds of data you'd put in Grids, in any numbers of dimensions; because, as usual, [#store] wouldn't know the difference.


grids as stored, as indexed, or as assembled from multiple indexings.
  class #scale_to

[#scale_to]






method init (size)

inlet 0 method grid (grid grid) a 3-channel picture to be scaled.

inlet 1 method int () a {height width} pair.

outlet 0 method grid (grid grid) a scaled 3-channel picture.

  class #scale_by

[#scale_by]






method init (grid dim() or dim(2) factor) factor is optional (default is 2). if it's a single value, then that factor is to be used for both rows and columns.

inlet 0 method grid (grid(y x channels) grid) duplicates each pixel several times in width and several times in height, where the number of times is determined by the factor described above. twice those of the incoming grid. It is several times faster.

inlet 1 method grid (grid(1 or 2) grid) sets factor

outlet 0 method grid (grid((factor*y) (factor*x) channels) grid)

  class #downscale_by

[#downscale_by]






method init (+integer factor, optional symbol(smoothly) how) factor is optional (default is 2). if it's a single value, then that factor is to be used for both rows and columns.

inlet 0 method grid (grid(y x channels) grid) Scales down picture by specified amount. (See scale factor above)

inlet 1 method grid (grid(1 or 2) grid) sets scale factor

outlet 0 method grid (grid((factor/y) (factor/x) channels) grid)

  class #spread

[#spread]





typically you plug a [#for] into this object, and you plug this object into the left side of a [#store]. it will scatter pixels around, giving an "unpolished glass" effect.

if you put a picture in it, however, it will add noise. The resulting values may be out of range, so you may need to clip them using min/max.


method init (factor)

inlet 0 method grid (grid grid) a coordinate map.

inlet 1 method int () a spread factor.

outlet 0 method grid (grid grid) a coordinate map.

[#spread] scatters the pixels in an image. Not all original pixels will appear, and some may get duplicated (triplicated, etc) randomly. Some wrap-around effect will occur close to the edges.

Sending an integer to inlet 1 sets the amount of spreading in maximum number of pixels + 1. even values translate the whole image by half a pixel due to rounding.


  class #rotate

[#rotate]





performs rotations on indexmaps and polygons and such.


method init (0...35999 angle)

inlet 0 method grid (grid(anyA 2) grid)

inlet 1 method int () rotation angle; 0...36000

outlet 0 method grid (grid(anyA 2) grid)

  class #remap_image

[#remap_image]





if you chain indexmap (coordinate) transformations from outlet 1 to inlet 1, then sending an image in inlet 0 will emit its deformation out of outlet 0.


 

Objects for Reporting

  class #dim

[#dim]





Returns list of dimensions as a grid. Given a grid sized like Dim(240,320,4), [#dim] will return a grid like Dim(3), whose values are 240, 320, 4.


method init () no arguments.

inlet 0 method grid (grid(dims...) grid) ignores any data contained within. sends a grid dim(length of dims) containing dims.

outlet 0 method grid (grid(rank) grid) the list of dimensions of the incoming grid.

  class #type

[#type]





gives a symbol representing the numeric type of the grid received.


outlet 0 method <numeric type symbol> ()

  class #print

[#print]






method init ()

inlet 0 method grid (grid(dims...) grid) prints the dimensions of the grid. prints all the grid data if there are 2 dimensions or less.

  class rubyprint

[rubyprint]





This is only for testing the translation from PD to Ruby.
method init ()

inlet 0 method (any) () prints the message to the console.

  class printargs

[printargs]





This is only for testing the translation from PD to Ruby.
method init (any...) prints everything.

  class display

[display]





GUI object equivalent to [print] and [#print].
method (any) () Displays the received message in the box, resizing the box so that the message fits exactly.

 

Objects for Color Conversion

  class #apply_colormap_channelwise

[#apply_colormap_channelwise]





This object is useful for color correction. For each pixel it takes it apart, looks up each part separately in the colormap, and constructs a new pixel from that. You may also color-correct colormaps themselves.

Only works for things that have 3 channels.

Note: if you just need to apply a palette on an indexed-color picture, you don't need this. Just use #store instead.


inlet 0 method grid (grid(rows columns channels) grid) picture

inlet 1 method grid (grid(intensities channels) grid) colormap ("palette")

outlet 0 method grid (grid(rows columns channels) grid) picture

  class #rgb_to_greyscale

[#rgb_to_greyscale]






inlet 0 method grid (grid(rows columns {red green blue}) grid)

outlet 0 method grid (grid(rows columns {white}) grid)

  class #greyscale_to_rgb

[#greyscale_to_rgb]






inlet 0 method grid (grid(rows columns {white}) grid)

outlet 0 method grid (grid(rows columns {red green blue}) grid)

  class #yuv_to_rgb

[#yuv_to_rgb]





note: may change slightly to adapt to actual video standards.


inlet 0 method grid (grid(rows columns {y u v}) grid)

outlet 0 method grid (grid(rows columns {red green blue}) grid)

  class #rgb_to_yuv

[#rgb_to_yuv]





note: may change slightly to adapt to actual video standards.


inlet 0 method grid (grid(rows columns {red green blue}) grid)

outlet 0 method grid (grid(rows columns {y u v}) grid)

 

Objects for Miscellaneous Picture Processing

  class #convolve

[#convolve]





this is the object for blurring, sharpening, finding edges, embossing, cellular automata, and many other uses.


method init (numop2 op_para, numop2 op_fold, grid seed, grid right_hand)

inlet 0 method grid (grid(rows columns rest...) grid) splits the incoming grid into dim(rest...) parts. for each of those parts at (y,x), a rectangle of such parts, centered around (y,x), is combined with the convolution grid like a [#] of operation op_para. Then each such result is folded like [#fold] of operation op_fold and specified base. the results are assembled into a grid that is sent to the outlet. near the borders of the grid, coordinates wrap around. this means the whole grid has to be received before production of the next grid starts.

inlet 1 method grid (grid(rows2 columns2) grid) this is the convolution grid and it gets stored in the object. if rows2 and/or columns2 are odd numbers, then the centre of convolution is the middle of the convolution grid. if they are even numbers, then the chosen centre will be slightly more to the left and/or to the top, because the actual middle is between cells of the grid.

outlet 0 method grid (grid(rows columns rest...) grid)

  class #contrast

[#contrast]






method init (iwhiteness, contrast)

inlet 0 method grid (grid(rows columns channels) grid) produces a grid like the incoming grid but with different constrast.

[#contrast] adjusts the intensity in an image. resulting values outside 0-255 are automatically clipped.


inlet 1 method int () this is the secondary contrast (inverse whiteness). it makes the incoming black correspond to a certain fraction between output black and the master contrast value. no effect is 256. default value is 256.

inlet 2 method int () this is the master contrast. it makes the incoming white correspond to a certain fraction between output black and output white. no effect is 256. default value is 256.

outlet  method grid (grid(rows columns channels) grid)

  class #posterize

[#posterize]





[#posterize] reduces the number of possible intensities in an image; it rounds the color values.The effect is mostly apparent with a low number of levels.


method init (levels)

inlet 0 method grid (grid(rows columns channels) grid) produces a posterized picture from the input picture.

inlet 1 method int () this is the number of possible levels per channel. the levels are equally spaced, with the lowest at 0 and the highest at 255. the minimum number of levels is 2, and the default value is 2.

example: simulate the 216-color "web" palette using 6 levels. simulate a 15-bit display using 32 levels.


  class #solarize

[#solarize]





makes medium intensities brightest; formerly brightest colours become darkest; formerly darkest stays darkest. This filter is linear: it's like a 200% contrast except that overflows are mirrored instead of clipped or wrapped.


inlet 0 method grid (grid(rows columns channels) grid)

outlet 0 method grid (grid(rows columns channels) grid)

  class #checkers

[#checkers]






inlet 0 method grid (grid(y x {y x}) grid) result from a [#for {0 0} {height width} {1 1}]

outlet 0 method grid (grid(y x {r g b}) grid) checkered pattern of 50%/75% greys in 8x8 squares

  class #layer

[#layer]






inlet 0 method grid (grid(y x {r g b a}) grid) a picture that has an opacity channel. will be used as foreground.

inlet 1 method grid (grid(y x {r g b}) grid) a picture that has NO opacity channel. will be used as background.

outlet 0 method grid (grid(y x {r g b}) grid) a picture that has NO opacity channel. the opacity channel of the foreground is used as a weighting of how much of either picture is seen in the result.

  class #draw_image

[#draw_image]






method init (numop2 operator, grid(y,x,channels) picture, grid({y x}) position)

inlet 0 method grid (grid(y x channels) grid) picture onto which another picture will be superimposed.

inlet 0 method tile (0 or 1 flag) if enabled, inlet 1 picture will be repeated to cover the inlet 0 picture.

inlet 0 method alpha (0 or 1 flag) if enabled, inlet 1 picture will be combined with inlet 0 picture using the selected operator, and then blended with inlet 0 picture according to transparency of the inlet 1 picture, and then inserted in the result. if disabled, the blending doesn't occur, as the transparency level is considered to be "opaque". note that with alpha enabled, the last channel of inlet 1 picture is considered to represent transparency.

inlet 1 method grid (grid(y x channels) grid) picture that will be superimposed onto another picture.

inlet 2 method grid (grid({y x}) grid) position of the inlet 0 picture corresponding to top-left corner of inlet 1 picture.

outlet 0 method grid (grid(y x channels) grid) resulting picture.

  class #draw_polygon

[#draw_polygon]






method init (numop2 operator, grid(channels) color, grid(vertices,{y x}) vertices)

inlet 0 method grid (grid(y x channels) grid) picture on which the polygon will be superimposed.

inlet 1 method grid (grid(channels) grid) color of each pixel

inlet 2 method grid (grid(vertices {y x}) grid) vertices of the polygon.

outlet 0 method grid (grid(y x channels) grid) modified picture. note: starting with 0.7.2, drawing a 1-by-1 square really generates a 1-by-1 square, and so on. This is because the right-hand border of a polygon is excluded, whereas it was included before, leading to slightly-wider-than-expected polygons.

  class #text_to_image

[#text_to_image]





inlet 2 receives a font grid, for example, [#in grid file lucida-typewriter-12.grid.gz]

inlet 1 receives a 2 by 3 matrix representing the colours to use (e.g. (2 3 # 0 170 0 255 255 0) means yellow on green)

inlet 0 receives a bang, transforming the data into an image suitable for #draw_image.


  class #hueshift

[#hueshift]





inlet 1 receives an angle (0..36000)

inlet 0 receives a RGB picture that gets hueshifted by a rotation in the colorwheel by the specified angle; it gets sent to outlet 0.


 

Other Objects

  class rtmetro

[rtmetro]





This class has been removed (0.7.7).
  class bindpatcher

[bindpatcher]





sets the receive-symbol for the Pd patcher it is in.

has no inlets, no outlets.

EXPERIMENTAL.


method init (symbol symbol)

  class pingpong

[pingpong]





Transforms linear counting (0, 1, 2, 3, 4, ...) into a back-and-forth counting (0, 1, 2, 1, 0, ...) from 0 to a specified upper bound.
method init (int top)

inlet 1 method float (float top)

inlet 0 method float () a value to be transformed. If, for example, top=10, then values 0 thru 10 are left unchanged, values 11 thru 19 are mapped to 9 thru 1 respectively, and 20 thru 30 are mapped to 0 thru 10, and so on.

  class #global

[#global]





objects of this class do nothing by themselves and are just an access point to features that don't belong to any object in particular.


method profiler_reset () resets all the time counters.

method profiler_dump () displays the time counters in decreasing order, with the names of the classes those objects are in. this is an experimental feature. like most statistics, it could be vaguely relied upon if only you knew to which extent it is unreliable. more on this in a future section called "profiling".

  class fps

[fps]






method init (symbol(real|user|system|cpu) clocktype, symbol(detailed) detailed)

method init detailed ()

inlet 0 method bang () Times at which bangs are received are stored until a large enough sample of those is accumulated. Large enough is defined to be whenever the timespan exceeds one second. Then a report is made through the outlet.

inlet 0 method (else) () messages other than bangs are ignored.

outlet 0 method float () non-detailed mode only. this is the messages-per-second rating.

outlet 0 method list(float,6) () detailed mode only. this is: messages-per-second, followed by five values of milliseconds-per-message: minimum, median, maximum, average, standard deviation. (the average happens to be simply 1000 divided by the messages-per-second, but it is convenient to have it anyway)

  class unix_time

[unix_time]





This object returns the Unix timestamp. The first outlet does so with ASCII, the second in seconds and the third outlet outputs the fractions of seconds up to 1/100 000 th of a second which is useful for creating filenames.


inlet 0 method bang ()

outlet 0 method symbol ()
Outputs the time and date in ASCII format
outlet 1 method float ()
Outputs the Unix timestamp in seconds
outlet 2 method float ()
Outputs the fractions of a second up to 10 microseconds (?) (actual precision is platform-dependent afaik)
  class ls

[ls]





This object is similar to the Unix list command 'ls'. It returns the names of files in a given directory. May be used with [listlength] to retrieve the number of files. Hidden files are displayed.


inlet 0 method symbol ()

  class exec

[exec]





This object launches a Unix shell program or script.


inlet 0 method symbol ()

  class renamefile

[renamefile]





This object accepts a list of two elements as arguments. The current file name being the first and the second is the desired change in name.


inlet 0 method list ()

  class plotter_control

[plotter_control]





This object produces HPGL instructions in ASCII form that can be sent to the comport object in order to control an HPGL compatible plotter.


inlet 0 method symbol ()

outlet 0 method symbol ()
Outputs the HPGL commands in ASCII format
  class rubyarray

[rubyarray]





inlet 0 float : sends the specified array entry to outlet 0

inlet 1 list: writes that list as an array entry in position last specified by inlet 0.

inlet 0 save(symbol filename): writes the array contents to a file of the given filename as a CSV

inlet 0 save(symbol filename, symbol format): same thing but using a sprintf string such as %x,%f or whatever

inlet 0 load(symbol filename): replace all array contents by the contents of a CSV file


 

jMax emulation

those classes emulate jMax functionality, for use within PureData and Ruby.

  class fork

[fork]





Every incoming message is sent to inlet 1 and then sent to inlet 0 as well. Messages remain completely unaltered. Contrast with PureData's "t a a" objects, which have the same purpose but transform bangs into zeros and such.


inlet 0 method (any) ()

  class jmax_udpsend

[jmax_udpsend]





Sends messages (but not grids nor dspsignals) via UDP (which does not involve a connection, and may lose packets in case of network overload or noise or etc).

This works with jMax 2.5 and 4.1 but not 4.0.


method init (host host, integer port)

inlet 0 method <any> ()

  class jmax_udpreceive

[jmax_udpreceive]





Counterpart of jmax_udpsend

This works with jMax 2.5 and 4.1 but not 4.0.


method init (integer port)

outlet 0 method <any> ()

outlet 1 method list (protocol_name, sender_port, sender_host, sender_ip_address)

  class foreach

[foreach]






inlet 0 method list (...) Outputs N messages, one per list element, in order.

  class rubysprintf

[rubysprintf]






method init (symbol format)

inlet 0 method list () Outputs the format string with %-codes replaced by elements of the list formatted as the %-codes say. To get a list of those codes, consult a Ruby manual (Equivalently, Perl, Python, Tcl and C all have equivalents of this, and it's almost always called sprintf, or the % operator, or both)

  class listflatten

[listflatten]






inlet 0 method list (...)

  class listmake

[listmake]





Emulation of jMax's [list] (but there cannot be a class named [list] in Pd)
method init (list...)

inlet 0 method bang () send "list" to outlet 0

inlet 0 method list () as sending to inlet 1 and then banging; that is, passes thru and remembers.

  class listlength

[listlength]






inlet 0 method list () outputs the number of elements in the incoming list.

  class listelement

[listelement]






method init (int index)

inlet 0 method list (...) Outputs one element of the list, as selected by "index". Also accepts negative indices (e.g.: -1 means "last"), like Ruby, but unlike jMax.

  class listsublist

[listsublist]






method init (int index, int length)

inlet 0 method list (...) Outputs consecutive elements of the list, as selected by "index" and "length". Also accepts negative indices (e.g.: -1 means "last"), like Ruby, but unlike jMax.

  class listprepend

[listprepend]






method init (list...)

inlet 0 method list (...) Outputs the stored list followed by the incoming list, all in one message.

  class listappend

[listappend]






method init (list...)

inlet 0 method list (...) Outputs the incoming list followed by the stored list, all in one message.

  class listreverse

[listreverse]






inlet 0 method list (...) Outputs the incoming list, from last element to first element.

  class oneshot

[oneshot]





Like [spigot], but turns itself off after each message, so you have to turn it on again to making it pass another message.
  class inv+

[inv+]






method init (float b)

inlet 0 method float (float a) outputs b-a

  class inv*

[inv*]






method init (float b)

inlet 0 method float (float a) outputs b/a

  class messageprepend

[messageprepend]





(This is not in jMax, but is there to help port $* messageboxes)
method init (list...)

inlet 0 method <any> (...) Like [listprepend], but operates on whole messages, that is, including the selector.

  class messageappend

[messageappend]





(This is not in jMax, but is there to help port $* messageboxes)
method init (list...)

inlet 0 method <any> (...) Like [listappend], but operates on whole messages, that is, including the selector.

  class shunt

[shunt]





Compatible with jMax's [demux].
method init (n, i)

inlet 0 method <any> (...) Routes a message to the active outlet.

inlet 1 method int (int i) Selects which outlet is active.

  class demux

[demux]





please use shunt instead (name conflict with another Pd external)
  class range

[range]






method init (separators...)

inlet 0 method float () a value to be sent to one of the outlets. The first outlet is for values smaller than the first argument; else the second outlet is for values smaller than the second argument; and so on; and the last outlet is for values greater or equal to the last argument.

inlet 1..n method float () sets the corresponding separator in the separator list.

 

PureData emulation

  class pd_netsend

[pd_netsend]





same as jmax_udpsend but for PureData UDP connections.
  class pd_netreceive

[pd_netreceive]





same as jmax_udpreceive but for PureData UDP connections.
 

GridFlow 0.8.0 Documentation
Copyright © 2001,2002,2003,2004,2005 by Mathieu Bouchard matju@artengine.ca