GridFlow 0.7.1 - reference index | |||
Objects for Input/OutputPicture/Movie FormatsAcquisition DevicesWindow Output | |||
Objects for Input/Output | |||
class @in | |||
method init (format, format_specific_part...) If no arguments given, creates an input object for an unspecified format. You then need to use the open command to link a format handler to it. If arguments given, the open command is immediately called with those arguments. Remember that most formats produce Dim[rows,columns,3] grids with 0-255 values. (Most.) inlet 0 method open (format, format_specific_part...) This is the command that gives a particular resource to a @out object. This is done through a "format" (there is a list of formats in this manual). The other arguments depend on the chosen format. The format may be a file format or a protocol or a hardware device, etc. inlet 0 method close () close may be necessary if you operate on "/dev/video", which can only be read by one at a time. otherwise it's usually not necessary. inlet 0 method int (frame_number) selects one picture from a multi-picture format and then does the same as a bang. inlet 0 method set (frame_number) selects one picture from a multi-picture format, to be displayed by the next bang. inlet 0 method bang () sends a grid through the outlet. the grid may be the result of reading from a file, acquiring from a device, capturing from the screen etc. this is format-specific. most formats produce dim(rows columns {red green blue}). In formats that read from a file, reading another picture will continue if there are several pictures in the same file, but if the end of file is reached instead, it will rewind and send the first picture again. see section "External Picture Formats". inlet 0 method option (symbol selector, stuff...) for format-specific options. (usually in devices that masquerade as formats). see section "External Picture Formats". inlet 0 method option rewind () rewinds to beginning of file if applicable. inlet 0 method option loop (bool flag) controls the automatic looping of movies. inlet 1 method int () frame number of frame just sent, for formats that have frame numbers. inlet 1 method bang () tried to read a frame that does not exist (signals end of file) | |||
class @out | |||
method init (format, format_specific_part...) If no arguments given, creates an output object for an unspecified format. You then need to use the open command to link a format handler to it. If arguments given, the open command is immediately called with those arguments. Remember that most formats expect dim(rows,columns,3) grids with 0-255 values. (Most.) method init (integer rows, integer columns) This alternate way to create an @out automatically calls "open x11 here" and "option out_size rows columns". inlet 0 method open (format, format_specific_part...) This is the command that gives a particular resource to a @out object. This is done through a "format" (there is a list of formats in this manual). The other arguments depend on the chosen format. The format may be a file format or a protocol or a hardware device, etc. inlet 0 grid this is format-specific. most formats expect dim(rows columns {red green blue}). In formats that write to a file, sending a 2nd picture overwrites the first. see section "External Picture Formats". inlet 0 method close () closes the file. usually not necessary. inlet 0 method option (symbol selector, stuff...) for format-specific options. (usually in devices that masquerade as formats). see section "External Picture Formats". inlet 0 method option timelog (0,1 status) when status=1, current time (unix clock) and time since last frame-end are printed in the console. when status=0, it is off. default is 0. inlet 0 method option rewind () rewinds to beginning of file if applicable. will overwrite the previous data. outlet 0 method bang () sent when a complete grid has been received. |
|||
Picture/Movie Formats | |||
class format ppm @in/@out | |||
Subformat P6 only. Max-number can only be 255 (24-bit RGB). method open ppm file (symbol filename) opens the specified file, taken from the current directory or one of the jMax-specified data directories. method open ppm gzfile (symbol filename) same but for .ppm.gz files grid dim(rows columns 3) values 0-255 | |||
class format targa @in/@out | |||
Support for RGB-24 (3 channels) and RGBA-32 (4 channels) method open targa file (symbol filename) opens the specified file, taken from the current directory or one of the jMax-specified data directories. method open targa gzfile (symbol filename) same but for .tga.gz files grid dim(rows columns 3) values 0-255 | |||
class format jpeg @in/@out | |||
Support for RGB non-progressive method open jpeg file (symbol filename) opens the specified file, taken from the current directory or one of the jMax-specified data directories. grid dim(rows columns 3) values 0-255 | |||
class format quicktime @in/@out | |||
support for .mov files. this format supports frame-seek and frame-tell. method open quicktime file (symbol filename) method option codec (symbol codec) allowed values: raw, jpeg, png, mjpa, yuv2, yuv4. Must be set before the first frame is written. only applies to @out. Choosing a codec is important because codecs influence greatly the speed of encoding, the size of the written file, and its fidelity. | |||
class format mpeg @in | |||
support for .mpeg files this format supports frame-seek and frame-tell. Two different libraries are available for dealing with MPEG files. Those have different details, capabilities and quirks. In any case, GridFlow does not support importing audio from those files. If you use the HeroineWarrior library, you may open several mpeg files at once, but not with the GregWard library. Libraries may scream error messages in a rude way. By opposition to PPM and TARGA, this format driver only allows a single MPEG stream per file (you cannot "cat" several MPEG files together). Supports Rewind and Frame Select. method open mpeg file (symbol filename) opens the specified file, taken from the current directory or one of the jMax-specified data directories. | |||
class format grid @in/@out | |||
This is GridFlow's special file format. This is the only I/O format that can hold anything that the [@store] object can. This is the picture format that would support TCP connections if that feature actually worked. More on this later. method open grid file (symbol filename) opens the specified file, taken from the current directory or one of the jMax-specified data directories. method open grid gzfile (symbol filename) same but for .ppm.gz files method open grid tcp (symbol hostname, integer port) dials an specified hostname/port on the InterNet or compatible network. the TCP protocol is used. method open grid tcpserver (integer port) waits for a call (and answers) for this port on the local machine via InterNet or compatible network. Answers the call. method option type int32 () output will be as 32 bit signed integers. method option type uint8 () output will be as 8 bit unsigned integers. method option headerful () cancels option headerless (and back to reading .grid) method option headerless (dimensions...) instead of reading .grid files with header, will read raw data, faking a .grid header to itself. It will use the hereby specified dimension list, as well as two other settings: option type and option endian. When writing "raw" data, a file may be considered a long string of
base 256 digits (called bytes), but different computers have different
conventions for dealing with them: |
|||
Acquisition Devices | |||
class format videodev @in | |||
method open (device, 'noinit' noinit) Noinit makes this format handler gentle with bad-tempered drivers (such as the qce-ga webcam driver). method open noinit (device) Video4Linux-1 devices, RGB-24 only. Variable picture size. should work for bttv based cards and the dc1/dc10plus from Miro. If you suffer from color inversion, you may feed the list "3 3 # 0 0 1 0 1 0 1 0 0" to the right side of a [@inner2 * + 0]. Use that @inner2 object as a RGB-BGR converter. color adjustments: other options: |
|||
Window Output | |||
class format x11 @in/@out | |||
supports 15,16,24,32-bit truecolor displays now also support 8-bit indexed displays, using a private colormap configured as 3:3:2 RGB. When using 8-bit you can specify the "use_stripes" option to use a completely different color scheme involving R,G,B diagonal stripes, a kind of 6:6:6 RGB spread over three pixels. If you are using Windows or MacOS 10: you will have to install a X11 server. This will emulate Unix display on your OS. (note: Unix systems also need a X11 server, but it's built-in and handles the video driver directly). In the case of MacOS 10 and QNX that both use non-X11 display technology on top of a basically Unix OS, the OS comes with a X11 server, but it may be on a "bundled software" CD. method open x11 () synonym of "open x11 here". method open x11 here () connects to the default X11 server, according to your environment variable "DISPLAY". method open x11 local (integer display_number) connects to a display server on this machine. method open x11 remote (symbol host_name, integer display_number) connects to a remote X11 display server using TCP. Sorry, IP addresses are not supported (jMax limitation). Port number will be 6000 plus the display number, because of the X11 standard. grid dim(rows columns {red green blue}) resizes the window to the size of the grid; encodes that grid in the display's pixel format; also displays it if autodraw > 0 the values must be in range 0-255, or else they will be "wrapped". Destroying the object (or sending "close") should close the window. Because of how jMax works, this may be delayed until you do something else. because of the design of Xlib, or if any of the connections involved crashes, then the whole program (fts) has to be terminated. (don't you love xlib). Something similar happens if you close any of the windows yourself, but IIRC this could be fixed. only one window may be used per connection (to simplify matters; this doesn't reduce flexibility). there is an additional argument that may be added to every "open" message; if you don't put it, a new toplevel window is created. if you put "root" then the screen's wallpaper will be used instead (it may fail to work with some popular window managers). You can also put a window number, e.g. 0x28003ff, you may connect to an existing window; you can find out the number of a window by using a tool like xwininfo, part of X11 standard tools. method option out_size (integer height, integer width) changes the window's size, just like sending a grid dim(height,width,3) would. this affects the size of screen captures too. method option draw () forces a redraw of the window's contents. method option autodraw (0,1,2 level)
method option setcursor (0..63 cursor) Selects one of the 64 predefined cursors of X11. (Note that if your cursor table has them numbered from 0 to 126 using only even numbers, then those cursor numbers are all doubled compared to the ones GridFlow uses.) method option hidecursor () This makes the cursor invisible. outlet 0 method position (integer y, integer x, integer buttons) This is emitted every time the cursor moves inside the window connected to this format handler. This is also emitted when the cursor is dragging from inside to outside the window. The y and x coordinates are relative to the upper right corner of the window. Specific button states may be extracted from the button value by applying [>> buttonnumber] and then checking whether the result is odd. Button numbers normally are:
| |||
class format sdl @out | |||
method open () opens a dim(480,640,3) rgb window. grid dim(rows columns {red green blue}) sends frame to screen. window is NOT resized. | |||
class aalib @out | |||
method open aalib (driver, args...) Normally "X11" with uppercase X; else consult the AALib manual. You can pass "commandline options" of AALib here. grid dim(rows columns {white}) converts a greyscale image to an ascii image and possibly displays it. note that the image is typically downscaled by a factor of 2 by aalib itself. grid dim(rows columns {ascii attr}) the inverse of "option dump". Both together in a loop allow to post-process aalib's buffer before displaying. Goes well with "option draw", "option autodraw". method option print (int y, int x, int attr, symbol text) method option autodraw () like X11's option autodraw. method option draw () like X11's option draw. method option dump () produces a Dim[y,x,2] grid whose two channels are ascii character codes and character attributes. |
|||
GridFlow 0.7.1 Documentation |