Re: [AQT-dev] Aquaterm and SuperMongo
Brought to you by:
persquare
From: Per P. <per...@ma...> - 2004-10-04 20:20:37
|
On Oct 4, 2004, at 21:19, Nor Pirzkal wrote: > Hi, > > Does anyone know if there might be a SuperMongo Aquaterm device that > somewhat might have put together? Nope, not yet ;-) > It would be great to be able to get SM to run natively under OSX > without the need for the ugly X11 device... > I was looking at the SM documentation and creating a device seems > pretty straight forward, but without a good Aquaterm documentation I > am finding it hard to find the bits I need to use in Aquaterm to > emulate the various SM calls (e.g. init device, draw line from (x1,y1) > to (x2,y2) etc...). > I am including the info I have from SM in the hope that someone > familiar with Aquaterm might be able to let me know if this is a lost > cause of something really trivial to do once one knows the Aquaterm > API. Trivial, really! The API was designed with something exactly like this in mind... You should be able to look at the aquaterm.trm driver in gnuplot to see how it can be done: http://cvs.sourceforge.net/viewcvs.py/gnuplot/gnuplot/term/ aquaterm.trm?rev=1.7&view=auto If you cannot for some reason use Objective-C, which I do recommend, you may use the C-API defined in /usr/local/include/aquaterm/aquaterm.h The C function naming follows that of the ObjC API as detailed in AQTAdapter, see http://aquaterm.sourceforge.net/index.shtml?page=d4 The demo.c file included in the distribution should help you too. [SNIP] Without actually reading the DEVICES function definitions carefully, the following hints should help you get started: > The current definition of DEVICES looks like this: > typedef struct { /* output device dependent functions */ > char d_name[40]; /* name of device */ > int (*dev_setup)(); /* initialisation */ AQTAdapter *adapter = [[AQTAdapter alloc] init] // ObjC, or aqtInit() // plain C // You'll also need to open a plot and set it's size etc. > void (*dev_enable)(), /* enable graphics */ no need > void (*dev_line)(), /* draw a line from x1, y1 to x2, y2 */ // NB you need to scale the coords [adapter moveToPoint:NSMakePoint(x1, y1)] [adapter addLineToPoint:NSMakePoint(x2, y2)] // ObjC, or aqtMoveTo(x1, y1) aqtAddLineTo(x2, y2) // plain C > void (*dev_reloc)(), /* relocate current position */ [adapter moveToPoint:NSMakePoint(x, y)] // ObjC, or aqtMoveTo(x1 y) // plain C > void (*dev_draw)(), /* draw a line from current pos to x,y > */ [adapter addLineToPoint:NSMakePoint(x, y)] // ObjC, or aqtAddLineTo(x, y) // plain C > int (*dev_char)(), /* hardware characters */ addLabel:atPoint:angle:align: // from now on only abbreviated ObjC examples, OK? > int (*dev_ltype)(), /* hardware line type */ takeColorFromColormapEntry: //?? > int (*dev_lweight)(), /* hardware line weight */ setLinewidth: > void (*dev_erase)(), /* erase graphics screen */ clearPlot > void (*dev_idle)(), /* switch from graph to alpha mode */ you may want to render the plot here, maybe not. Depends on SM > int (*dev_cursor)(), /* cursor display */ waitNextEvent > void (*dev_close)(), /* close device */ closePlot > int (*dev_dot)(), /* draw a single pixel dot */ single pixels doesn't exist in device independent drawing like AQT, you probably want to draw a small circle instead... > int (*dev_fill_pt)(), /* draw a filled point */ figure out what to draw or let SM fix it for you... > int (*dev_fill_polygon)(), /* draw a filled polygon */ addPolygonWithVertexPoints:pointCount: // and friends > void (*dev_ctype)(), /* set colour of line */ takeColorFromColormapEntry: > int (*dev_set_ctype)(), /* set possible colours of lines */ setColorRed:green:blue: // ?? or maybe create an entry in colormap > void (*dev_gflush)(); /* flush graphics */ renderPlot > void (*dev_page)(); /* start a new page */ openPlotWithIndex or selectPlotWithIndex: > void (*dev_redraw)(); /* redraw the screen, if need be */ tricky, performance issue, but probably renderPlot > } DEVICES; > > Should you decide to start hacking up an SM adapter, just get the basic stuff up first, i.e. "hello SM world". Then add functionality as you get up to speed. I'd be happy to answer any further questions you might have. Remember to link with -laquaterm -framwork Foundation Hope this helps, Per |