PageRenderTime 38ms CodeModel.GetById 15ms app.highlight 12ms RepoModel.GetById 2ms app.codeStats 0ms

/aquaterm.pd

http://github.com/gitpan/PDL-Graphics-AquaTerm
Unknown | 803 lines | 578 code | 225 blank | 0 comment | 0 complexity | 259f223dafdc31a55bbdaea956cf0ce9 MD5 | raw file
  1$VERSION = '0.02';
  2
  3pp_bless('PDL::Graphics::AquaTerm');
  4
  5###
  6# Header files
  7###
  8
  9pp_addhdr('
 10	#include "aquaterm/aquaterm.h"
 11');
 12
 13###
 14# pp_def
 15###
 16
 17# set the background color
 18
 19pp_def('callAqtSetBackgroundColor',
 20	Pars => 'rgb(n);',
 21	GenericTypes => [F],
 22	Code => '
 23		aqtSetBackgroundColor($rgb(n=>0), $rgb(n=>1), $rgb(n=>2));
 24	'
 25);
 26
 27# set the current plot color
 28
 29pp_def('callAqtSetColor',
 30	Pars => 'rgb(n);',
 31	GenericTypes => [F],
 32	Code => '
 33		aqtSetColor($rgb(n=>0), $rgb(n=>1), $rgb(n=>2));
 34	'
 35);
 36
 37# add a bitmap to the plot
 38
 39pp_def('callAqtBitmap',
 40	Pars => 'bm(n,m,o)',
 41	OtherPars => 'float dx; float dy; float dw; float dh',
 42	GenericTypes => [B],
 43	Code => '
 44		aqtEraseRect($COMP(dx), $COMP(dy), $COMP(dw), $COMP(dh));
 45		aqtAddImageWithBitmap($P(bm), $SIZE(m), $SIZE(o), $COMP(dx), $COMP(dy), $COMP(dw), $COMP(dh));
 46	'
 47);
 48
 49# add a line to the plot
 50#	printf("size %d %f %f\n",$SIZE(n),$lx(n=>1),$ly(n=>1)); debugging relic
 51
 52pp_def('callAqtPolyline',
 53	Pars => 'lx(n); ly(n)',
 54	GenericTypes => [F],
 55	Code => '
 56		aqtAddPolyline($P(lx), $P(ly), $SIZE(n));
 57	'
 58);
 59
 60###
 61# XS
 62###
 63
 64# deals with mouse events, which return a string giving the mouse location
 65
 66pp_addxs(<<'EOC');
 67
 68char *
 69callAqtWaitNextEvent()
 70	CODE:
 71		int val;
 72		char temp[40];
 73		
 74		val = aqtWaitNextEvent(temp);
 75		RETVAL = temp;
 76	OUTPUT:
 77		RETVAL
 78		
 79void
 80aqtInit()
 81
 82void
 83aqtOpenPlot(win_num)
 84	int win_num
 85
 86void
 87aqtSelectPlot(win_num)
 88	int win_num
 89
 90void
 91aqtSetPlotSize(size_x, size_y)
 92	int size_x
 93	int size_y
 94	
 95void
 96aqtSetPlotTitle(title)
 97	char *title
 98
 99void
100aqtMoveTo(x,y)
101	int x
102	int y
103	
104void
105aqtAddLineTo(x,y)
106	int x
107	int y
108
109void
110aqtRenderPlot()
111
112void
113aqtClearPlot()
114
115void
116aqtAddLabel(text, x, y, angle, align)
117	char *text
118	float x
119	float y
120	float angle
121	int align
122
123void
124aqtSetLinewidth(lw)
125	float lw
126
127void
128aqtSetLineCapStyle(cs)
129	int cs
130
131void
132aqtSetFontname(fn)
133	char *fn
134
135void
136aqtSetFontsize(fs)
137	float fs
138
139EOC
140
141###
142# Perl subroutines
143###
144
145pp_addpm(<<'EOD');
146
147## we need PDL
148
149use PDL;
150
151## private variables
152
153my $warning_message = ">>> AquaTerm.pm Warning : "; # generic start of warning messages
154my $debug_message = ">>> AquaTerm.pm Debug : ";		# generic start of debugging messages
155my %open_windows;			# stores whether the window exists (by whether the key/value is defined/undefined)
156my $win_counter = 1;		# the default window number to open
157my $initialized = 0;		# flag for whether the connection to the aquaterm program was already made
158my $warn_on = 0;			# turn on/off whether warnings are desired
159my $debug_on = 0;			# turn on/off whether debugging information is desired
160my $current_window = 1;		# the currently active window
161my $color_table = pdl(0);	# local storage for a user-defined color table
162	
163my %window_options = (	# default window options
164	SIZE_X => 400,
165	SIZE_Y => 300,
166	WIN_TITLE => "AquaTerm.pm",
167	BACK_COLOR => [1.0, 1.0, 1.0],
168	WARN_ON => 1,
169	DEBUG_ON => 0
170);
171
172## the private sub-routines
173
174# select a window if it exists, return 0 if it does not.
175
176sub selectWindow {
177	my $ret = 1;
178	my $win_num = $_[0];
179	
180	if ($win_num == -1) {	# default to the currently open window
181		$win_num = $current_window;
182	}
183	
184	if ($open_windows{$win_num}) {
185		unless ($current_window == $win_num) {
186			aqtSelectPlot($win_num);
187			$current_window = $win_num;
188		}
189	} else {
190		print "$warning_message no such window number was available\n";
191		$ret = 0;
192	}
193	
194	$ret;
195}
196
197# parse options hashes
198
199sub parseOptions {
200	my $input_options = shift;
201	my $default_options = shift;
202
203	if ($debug_on){
204		print "$debug_message options hash is : \n";
205	}
206	while ( my($temp_key, $temp_value) = each %{$input_options} ) {
207		if ($debug_on){
208			print "  " . $temp_key . " => " . $temp_value . "\n";
209		}
210		if (exists $default_options->{$temp_key}) {
211			$default_options->{$temp_key} = $temp_value;
212		} else {
213			print "$warning_message no such option : $temp_key\n";
214		}
215	}
216}
217
218# output an options hash (for debugging mostly)
219
220sub outputHash {
221	my $hash_name = shift;
222	my $the_hash = shift;
223	
224	print "$debug_message $hash_name hash is : \n";
225	foreach my $temp_key (keys %{$the_hash}){
226		print "  " . $temp_key . " => " . $the_hash->{$temp_key} . "\n";
227	}
228}
229
230## the public sub-routines
231
232# opens a window using user supplied parameters, or uses defaults if they don't exist
233
234sub aquaOpen{
235	my %options;
236	$window_options{"WIN_NUM"} = $win_counter;
237	
238	if ($debug_on){
239		print "\n>>> aquaOpen\n\n";
240	}
241	
242	# get, check and load any user supplied options
243	
244	if ($_[0]){ parseOptions($_[0], \%window_options); }
245
246	# check if this window number already exists
247
248	if (exists $open_windows{$window_options{"WIN_NUM"}}) {
249		if ($warn_on) {
250			print "$warning_message window number " . $window_options{"WIN_NUM"} . " already exists\n";
251		}
252	}
253	
254	my $win_title = '(' . $window_options{"WIN_NUM"} . ') ' . $window_options{"WIN_TITLE"};
255	$current_window = $window_options{"WIN_NUM"};
256	$open_windows{$window_options{"WIN_NUM"}} = 1;
257	$win_counter++;
258		
259	# initialize connection to aquaterm program, if that hasn't already been done
260	
261	unless ($initialized) {
262		aqtInit();
263		$initialized = 1;
264	}
265
266	# set warnings & debugging flags
267	
268	$warn_on  = $window_options{"WARN_ON"};
269	$debug_on = $window_options{"DEBUG_ON"};
270	
271	# output the window_options hash if we are in debugging mode
272	
273	if ($debug_on){
274		outputHash("window_options", \%window_options);
275		outputHash("open_windows", \%open_windows);
276	}
277	
278	# open up a window with the user/default parameters
279	
280	aqtOpenPlot($window_options{"WIN_NUM"});
281	aqtSetPlotSize($window_options{"SIZE_X"}, $window_options{"SIZE_Y"});
282	aqtSetPlotTitle($win_title);
283
284	# this forces aquaterm to actually open and draw the window
285
286	callAqtSetBackgroundColor(pdl($window_options{"BACK_COLOR"}));
287	aqtMoveTo(0.0, 0.0);
288	aqtAddLineTo(1.0, 1.0);
289	aqtRenderPlot();
290	aqtClearPlot();
291	
292	# if necessary, initialize the default color table (a gray scale)
293	
294	unless($color_table->ndims() == 2){
295		$color_table = zeroes(byte,256,3);
296		$color_table = xvals($color_table);
297	}
298	
299	return 1;
300}
301
302# display a pdl as a 2 dimensional bitmap
303
304sub aquaBitmap{
305	my %options;
306	my %display_options = (	# default display options
307		ERASE => 0,
308		DEST_X => 0,
309		DEST_Y => 0,
310		DEST_W => -1,
311		DEST_H => -1,
312		AUTO_SCALE => 0,
313		M_MIN => 0.0,
314		M_MAX => 255.0,
315		WIN_NUM => -1,
316		TEXT => "",
317		TEXT_X => 6.0,
318		TEXT_Y => 10.0,
319		TEXT_C => [0.0, 0.0, 0.0]
320	);
321	
322	if ($debug_on){
323		print "\n>>> aquaDisplayBitmap\n\n";
324	}
325	
326	# get, check and load user supplied options
327
328	my $num_dims;
329	my @bmp_dims;
330	my $the_bitmap;
331	
332	if (@_) {
333		$the_bitmap = $_[0];
334		$num_dims = $the_bitmap->ndims();
335		@bmp_dims = $the_bitmap->dims();
336		unless (($num_dims == 2) || ($num_dims == 3)) { 
337			print "$warning_message a pdl with $num_dims dimensions is not supported\n";
338			return 0;
339		}
340		if ($_[1]) { parseOptions($_[1], \%display_options); }
341	} else {
342		print "$warning_message no pdl was supplied for aquaDisplayBitmap\n";
343		return 0;
344	}
345	
346	# if the user didn't provide the width and height of the part that they want to show, default to showing the whole thing
347		
348	if ($display_options{"DEST_W"} == -1) {
349		if ($num_dims == 2) {
350			$display_options{"DEST_W"} = $bmp_dims[0];
351		} else {
352			$display_options{"DEST_W"} = $bmp_dims[1];
353		}
354	}
355	if ($display_options{"DEST_H"} == -1) {
356		if ($num_dims == 2) {
357			$display_options{"DEST_H"} = $bmp_dims[1];
358		} else {
359			$display_options{"DEST_H"} = $bmp_dims[2];
360		}
361	}
362	
363	# check whether the user wants to auto-scale the image
364	
365	if ($display_options{"AUTO_SCALE"}){
366		$display_options{"M_MIN"} = min($the_bitmap);
367		$display_options{"M_MAX"} = max($the_bitmap);
368	}
369	
370	# re-scale the image if necessary
371	
372	if (($display_options{"M_MIN"} != 0.0) || ($display_options{"M_MAX"} != 255.0)){
373		if($debug_on){
374			print "$debug_message re-scaling image " . $display_options{"M_MIN"} . " - " . $display_options{"M_MAX"} . "\n";
375 		}
376		$the_bitmap = float($the_bitmap);
377		if($display_options{"M_MIN"} < $display_options{"M_MAX"}) {
378			$the_bitmap = ($the_bitmap - $display_options{"M_MIN"}) * 255.0 / ($display_options{"M_MAX"} - $display_options{"M_MIN"});
379		} else {
380			print "$warning_message min is greater then max, image re-scale aborted\n";
381		}
382	}
383	
384	# threshold the image so that it doesn't roll over
385	
386	$the_bitmap = $the_bitmap * ($the_bitmap >= 0.0);
387	$the_bitmap -= 255.0;
388	$the_bitmap = $the_bitmap * ($the_bitmap <= 0.0);
389	$the_bitmap += 255.0;
390	$the_bitmap = byte($the_bitmap);
391		
392	# select the appropriate window, or open a new one if no such window is available
393
394	unless(selectWindow($display_options{"WIN_NUM"})){
395		aquaOpen({WIN_NUM => $display_options{"WIN_NUM"}, SIZE_X => $display_options{"DEST_W"}, SIZE_Y => $display_options{"DEST_H"}});
396	}
397	
398	# output the display_options hash if we are in debugging mode
399	
400	if ($debug_on){ outputHash("display_options", \%display_options); }
401
402	# make the image "true-color" if necessary
403
404	if ($num_dims == 2) {
405		$the_bitmap = index($color_table, $the_bitmap->dummy(0));	# convert the image to true color
406	}
407	
408	if($display_options{"ERASE"}) { aqtClearPlot(); }	# if desired, clear the current plot
409
410	# display the image
411	
412	callAqtBitmap($the_bitmap, $display_options{"DEST_X"}, $display_options{"DEST_Y"}, $display_options{"DEST_W"}, $display_options{"DEST_H"});
413	
414	# if the user supplied a number, then add it to the plot
415	
416	if ($display_options{"TEXT"}){
417		callAqtSetColor(pdl($display_options{"TEXT_C"}));
418		aqtAddLabel($display_options{"TEXT"}, $display_options{"TEXT_X"}, $display_options{"TEXT_Y"}, 0.0, 0);
419	}
420	
421	# tell aquaterm to draw the new plot
422	
423	aqtRenderPlot();
424	
425	return 1;
426}
427
428# Makes a local copy of a user supplied color table. It is assumed that the color 
429# table pdl is of the form ($levels, $red, $green, $blue), a 256 x 4 pdl, as would 
430# be generated by the command '$color_table = cat(lut_data("xx"))'. $levels is ignored. 
431# $red, $green & $blue are assumed to range from 0 to 1.
432
433sub aquaSetColorTable{
434
435	if ($debug_on){
436		print "\n>>> aquaSetColorTable\n\n";
437	}
438
439	if (@_) {
440		my $col_tab = $_[0];
441		if (($col_tab->getdim(0) == 256)&&($col_tab->getdim(1) == 4)){
442			$color_table = byte(255.0 * ($col_tab->slice('0:255,1:3'))->copy);
443		} else {
444			print "$warning_message color table has the wrong dimensions (256 x 4 expected)";
445		}
446	} else {
447		print "$warning_message no color table supplied";
448	}
449}
450
451# Draw lines between a set of points given by a PDL of size (2,n), where the first dimension is
452# x & y position of the points and n is the number of points
453
454sub aquaPolyLine{
455	my %options;
456	my %line_options = (	# default line options
457		WIN_NUM => -1,
458		ERASE => 0,
459		WIDTH => 1,
460		CAPS => 0,
461		COLOR => [0.0, 0.0, 0.0]
462	);
463	
464	if ($debug_on){
465		print "\n>>> aquaPolyLine\n\n";
466	}
467	
468	# get, check and load user supplied options
469
470	my $the_line;
471	
472	if (@_) {
473		$the_line = float($_[0]);
474		if ($_[1]){ parseOptions($_[1], \%line_options); }
475	} else {
476		print "$warning_message no pdl was supplied for aquaPolyLine\n";
477		return 0;
478	}
479
480	# output the line_options hash if we are in debugging mode
481	
482	if ($debug_on){ outputHash("line_options", \%line_options); }
483
484	# select the right window to draw in
485	
486	unless(selectWindow($line_options{"WIN_NUM"})) { return; }
487
488	# set up for line drawing
489	
490	if($line_options{"ERASE"}) { aqtClearPlot(); }	# if desired, clear the current plot
491	callAqtSetColor(pdl($line_options{"COLOR"}));	# set the line color
492	aqtSetLinewidth($line_options{"WIDTH"});		# set the line width
493	aqtSetLineCapStyle($line_options{"CAPS"});		# set the line cap style
494	
495	# add the line to the plot
496	
497	my $x = $the_line->slice("0,:")->squeeze->copy;
498	my $y = $the_line->slice("1,:")->squeeze->copy;
499	callAqtPolyline($x, $y);
500	
501	# render the plot
502	
503	aqtRenderPlot();
504}
505
506# draw text on the screen with the selectable font, size & color
507
508sub aquaText{
509	my %options;
510	my %text_options = (	# default text options
511		WIN_NUM => -1,
512		ERASE => 0,
513		NAME => "Times-Roman",
514		ANGLE => 0.0,
515		X => 6.0,
516		Y => 10.0,
517		JUST => 0,
518		SIZE => 12.0,
519		COLOR => [0.0, 0.0, 0.0]
520	);
521	
522	if ($debug_on){
523		print "\n>>> aquaDrawText\n\n";
524	}
525	
526	# get, check and load user supplied options
527
528	my $the_text;
529	
530	if (@_) {
531		$the_text = $_[0];
532		if ($_[1]){ parseOptions($_[1], \%text_options); }
533	} else {
534		print "$warning_message no text was supplied for aquaDrawText\n";
535		return 0;
536	}
537
538	# output the text_options hash if we are in debugging mode
539	
540	if ($debug_on){ outputHash("text_options", \%text_options); }
541
542	# select the right window to draw in
543
544	unless(selectWindow($text_options{"WIN_NUM"})) { return; }
545	
546	# set the font size & type & color
547	
548	callAqtSetColor(pdl($text_options{"COLOR"}));
549	aqtSetFontname($text_options{"NAME"});
550	aqtSetFontsize($text_options{"SIZE"});
551
552	# draw the text
553	
554	if($text_options{"ERASE"}) { aqtClearPlot(); }	# if desired, clear the current plot
555	aqtAddLabel($the_text, $text_options{"X"}, $text_options{"Y"}, $text_options{"ANGLE"}, $text_options{"JUST"});
556
557	# render the plot
558	
559	aqtRenderPlot();	
560}
561
562
563# return the coordinates of the next mouse click
564
565sub aquaMouse{
566	my %options;
567	my %mouse_options = (	# mouse options
568		WIN_NUM => -1
569	);
570	
571	if ($debug_on){
572		print "\n>>> aquaMouse\n\n";
573	}
574	
575	# get, check and load user supplied options
576
577	if ($_[0]){ parseOptions($_[0], \%mouse_options); }
578
579	# output the display_options hash if we are in debugging mode
580	
581	if ($debug_on){ outputHash("mouse_options", \%mouse_options); }
582
583	# select the window that we want to click in
584	
585	unless(selectWindow($mouse_options{"WIN_NUM"})) { return; }
586
587	my $event = callAqtWaitNextEvent();
588	my @loc;
589	if($event =~ /{([\d]+)[^\d]+([\d]+)}/){
590		push @loc, $1, $2;
591		# push @loc, $2;
592	}
593	@loc;
594}
595
596EOD
597
598###
599# specify those functions that will be exported
600###
601
602# clear the auto-generated list
603pp_export_nothing();
604
605# add the "right" functions
606pp_add_exported('', 'aquaOpen', 'aquaBitmap', 'aquaSetColorTable', 'aquaPolyLine', 'aquaText', 'aquaMouse');	
607
608###
609# Documentation
610###
611
612pp_addpm({At=>'Bot'},<<'EOD');
613
614=head1 NAME
615
616PDL::Graphics::AquaTerm - Provides access to the AquaTerm Mac OS-X graphics terminal
617
618=head1 SYNOPSIS
619
620  # example 1
621
622  use PDL;
623  use PDL::Graphics::LUT;
624  use PDL::Graphics::AquaTerm;
625  my $x_size = 255; my $y_size = 255;
626  aquaOpen({SIZE_X => $x_size, SIZE_Y => $y_size});
627  aquaSetColorTable(cat(lut_data('idl5')));
628  my $a = xvals(zeroes(byte,$x_size,$y_size));
629  aquaBitmap($a);
630
631# example 2
632
633  use PDL;
634  use PDL::Graphics::AquaTerm;
635  my $x_size = 255; my $y_size = 255;
636  aquaOpen({WIN_NUM => 1, SIZE_X => $x_size, SIZE_Y => $y_size});
637  my $a = sin(xvals(zeroes(float, $x_size, $y_size)) * 0.1);
638  aquaBitmap($a, {AUTO_SCALE => 1});
639
640=head1 DESCRIPTION
641
642This module interfaces PDL directly to the AquaTerm Mac OS-X graphics terminal. It is primarily intended for quickly and easily displaying bitmap images.
643
644The coordinate system is defined by the window size (given in pixels) with (0,0) at the bottom left corner of the window. This means that if the window is set to be 300 x 200, then the bottom left corner will have coordinates (0,0) and the upper right corner will have coordinates (300,200). Anything that is drawn outside this boundary will be automatically clipped.
645
646=head1 FUNCTIONS
647
648=head2 aquaOpen
649
650=for ref
651
652Open a new AquaTerm window
653
654=for usage
655
656  Usage: aquaOpen(); # open the window with the defaults
657  Usage: aquaOpen({SIZE_X => 200, SIZE_Y => 200, BACK_COLOR => [0.0, 0.0, 0.0]});
658                 				
659Opens a new AquaTerm window, it also starts AquaTerm if necessary.
660
661Options recognized :
662
663      SIZE_X - window x size in pixels (default = 400)
664      SIZE_Y - window y size in pixels (default = 300)
665     WIN_NUM - The window number, used by the drawing commands to specify which window to draw in
666   WIN_TITLE - A title for the window, if desired (default = "Aquaterm.pm")
667  BACK_COLOR - [r, g, b] the windows background color (default = [1.0, 1.0, 1.0], i.e. white)
668     WARN_ON - set to 1 to turn on warning messages, 0 to turn off (default = 1)
669    DEBUG_ON - set to 1 to turn on debugging message, 0 to turn off (default = 0)
670
671=head2 aquaBitmap
672
673=for ref
674
675Display a PDL as a bitmap.
676
677=for usage
678
679  Usage: aquaDisplay($my_img); # display $my_img as a bitmap in the currently open window
680  Usage: aquaDisplay($my_img, {AUTO_SCALE => 1.0, TEXT => "my image", TEXT_C => [1.0, 0.0, 0.0]});
681
682Displays a PDL as a bitmap. The PDL can be of size either (m,n) or (3,m,n). PDLs of size (m,n) are converted to indexed color based on the current color table (see aquaSetColorTable). PDLs of size (3,m,n) are displayed as true-color images with the first dimension specifying the color (RGB). Unless a re-scaling is specified, the minimum value displayed is 0.0 and the maximum is 255.0.
683
684Options recognized :
685
686      DEST_X - position of the left side of the bitmap in pixels (default = 0)
687      DEST_Y - position of the bottom of the bitmap in pixels (default = 0)
688      DEST_W - width of the bitmap to be displayed (default = width of the PDL)
689      DEST_H - height of the bitmap to be displayed (default = height of the PDL)
690  AUTO_SCALE - if set equal to 1, the PDL will be rescaled such that its 
691                     minimum value is 1 and its max is 255 (default = 0)
692       M_MIN - the minimum value to be displayed (default = 0.0)
693       M_MAX - the maximum value to be displayed (default = 255.0)
694     WIN_NUM - specify which window to draw in (default = current window)
695        TEXT - text to display on the bitmap
696      TEXT_X - x location of the text in pixels (default = 6)
697      TEXT_Y - y location of the text in pixels (default = 10)
698      TEXT_C - RGB color of the text, (default = [0.0, 0.0, 0.0], i.e. black)
699	
700=head2 aquaSetColorTable
701
702=for ref
703
704Set the color table
705
706=for usage
707
708  Usage: aquaSetColorTable(cat(lut_data('idl5'))); # set the color table to idl5
709
710Makes a local copy of a user supplied color table. The color table must be a 256 x 4 pdl of the form (l,r,g,b), as would be generated by the command '$ct = cat(lut_data("xyz"))'. The l value is ignored. The r, g and b values should be in the range 0.0 - 1.0.
711
712=head2 aquaPolyLine
713
714=for ref
715
716Draws a (2,n) PDL as a line
717
718=for usage
719
720  Usage: aquaPolyLine($line, {WIDTH => 3, COLOR => [0.0, 0.0, 0.0]}); # draw $line black with width 3
721
722Draw a poly-line between a set of points given by a PDL of size (2,n). The first dimension of the PDL gives the x & y position of the individual points, n is the total number of points.
723
724Options recognized
725  WIN_NUM - which window to draw the line in
726    ERASE - clear the selected window prior to drawing the line
727    WIDTH - line width (default = 1)
728     CAPS - line cap style, I'm still unsure exactly what this is...
729    COLOR - RGB color of the line (default is black)
730
731=head2 aquaText
732
733=for ref
734
735Draw text
736
737=for usage
738
739  # draw red 'hello world' at position 20, 30 in the current window
740  Usage: aquaText("hello world", X => 20, Y => 30, COLOR => [1.0, 0.0, 0.0]);
741
742Draws text.
743
744Options recognized
745  WIN_NUM - which window to draw the text in
746    ERASE - clear the current window prior to drawing the text
747     NAME - name of the font to use (default = "Times-Roman")
748    ANGLE - angle to display the text relative to the horizontal in degrees (default = 0.0)
749        X - position in the window of the text anchor point (which depends on the justification of the text) (default = 6)
750        Y - position in the window of the bottom of the text (default = 10)
751     JUST - text justification, left = 0, center = 1, right = -1? (default = 0)
752     SIZE - font size in points (default = 12)
753    COLOR - text color (default is black)
754
755=head2 aquaMouse
756
757= for ref
758
759Returns location of next mouse click in the active window
760
761= for usage
762
763($mx, $my) = aquaMouse();
764
765Returns the location of the next mouse click in the active window as a 2 element array. The elements of the array are the x and y coordinates of the mouse click in pixels. The coordinates are relative to the bottom left corner of the active area of the window.
766
767Options recognized
768  WIN_NUM - which window to get the mouse click in
769
770=head1 INSTALLATION
771
772You must install aquaterm prior to trying to install this module as it links against the aquaterm library. After AquaTerm installation you should have the following directory/file structure:
773
774/usr/local/include/aquaterm/aquaterm.h
775/usr/local/lib/libaquaterm.dylib
776
777as explained in the INSTALL file that accompanies aquaterm.
778
779=head1 KNOWN ISSUES
780
781If you are using this module in a perl script simultaneously with another drawing/graphing module such as PDL::Graphics::PGPLOT::Window then you may have problems with the two modules drawing into the same window. This is hard to work around since PGPlot will always draw in the currently active window regardless of which window it opened in the first place.
782
783The (0,0) of bitmaps is their upper left corner, but for mouse events it is the bottom left corner. If you are trying to use the mouse to select a portion of a bitmap then you need to adjust the coordinates returned by the mouse accordingly (i.e. $good_y = $bitmap_size_y - $y_from_aquaMouse).
784
785=head1 BUGS
786
787No known bugs yet.
788
789=head1 SEE ALSO
790
791http://sourceforge.net/projects/aquaterm/
792
793=head1 AUTHOR
794
795Hazen Babcock (hbabcockos1@mac.com)
796
797This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
798
799=cut
800
801EOD
802
803pp_done();