Skip to content

Commit 5e98e82

Browse files
committed
Update documentation for graphics module
1 parent f60f43a commit 5e98e82

File tree

1 file changed

+128
-3
lines changed

1 file changed

+128
-3
lines changed

src/graphics.rs

+128-3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ impl Drop for Window {
134134

135135
impl Window {
136136
/// Creates new Window object
137+
///
138+
/// # Parameters
139+
///
140+
/// - `width` is width of the window
141+
/// - `height` is the height of window
142+
/// - `title` is the string displayed on window title bar
143+
///
144+
/// # Return Values
145+
///
146+
/// Window Object
137147
#[allow(unused_mut)]
138148
pub fn new(width: i32, height: i32, title: String) -> Window {
139149
unsafe {
@@ -153,6 +163,11 @@ impl Window {
153163
}
154164

155165
/// Set window starting position on the screen
166+
///
167+
/// # Parameters
168+
///
169+
/// - `x` is the horiontal coordinate where window is to be placed
170+
/// - `y` is the vertical coordinate where window is to be placed
156171
pub fn set_position(&self, x: u32, y: u32) {
157172
unsafe {
158173
let err_val = af_set_position(self.handle as WndHandle, x as c_uint, y as c_uint);
@@ -161,6 +176,10 @@ impl Window {
161176
}
162177

163178
/// Set window title
179+
///
180+
/// # Parameters
181+
///
182+
/// - `title` is the string to be displayed on window title bar
164183
pub fn set_title(&self, title: String) {
165184
unsafe {
166185
let cstr_ret = CString::new(title.as_bytes());
@@ -220,7 +239,12 @@ impl Window {
220239
}
221240
}
222241

223-
/// Used to setup display layout in multiview mode
242+
/// Setup display layout in multiview mode
243+
///
244+
/// # Parameters
245+
///
246+
/// - `rows` is the number of rows into which whole window is split into in multiple view mode
247+
/// - `cols` is the number of cols into which whole window is split into in multiple view mode
224248
pub fn grid(&self, rows: i32, cols: i32) {
225249
unsafe {
226250
let err_val = af_grid(self.handle as WndHandle, rows as c_int, cols as c_int);
@@ -239,8 +263,14 @@ impl Window {
239263
}
240264
}
241265

242-
/// Used in multiview mode to set the current sub-region to which the subsequence draw call
243-
/// renders to
266+
/// Set the current sub-region to render
267+
///
268+
/// This function is only to be used into multiview mode
269+
///
270+
/// # Parameters
271+
///
272+
/// - `r` is the target row id
273+
/// - `c` is the target row id
244274
pub fn set_view(&mut self, r: i32, c: i32) {
245275
self.row = r;
246276
self.col = c;
@@ -351,6 +381,12 @@ impl Window {
351381
}
352382

353383
/// Render given Array as an image
384+
///
385+
/// # Parameters
386+
///
387+
/// - `input` image
388+
/// - `title` parameter has effect only in multiview mode, where this string
389+
/// is displayed as the respective cell/view title.
354390
pub fn draw_image(&self, input: &Array, title: Option<String>) {
355391
let tstr = match title {
356392
Some(s) => s,
@@ -365,6 +401,13 @@ impl Window {
365401
}
366402

367403
/// Render given two Array's `x` and `y` as a 2d line plot
404+
///
405+
/// # Parameters
406+
///
407+
/// - `x` is the x coordinates of the plot
408+
/// - `y` is the y coordinates of the plot
409+
/// - `title` parameter has effect only in multiview mode, where this string
410+
/// is displayed as the respective cell/view title.
368411
pub fn draw_plot2(&self, x: &Array, y: &Array, title: Option<String>) {
369412
let tstr = match title {
370413
Some(s) => s,
@@ -380,6 +423,14 @@ impl Window {
380423
}
381424

382425
/// Render given Array's `x`, `y` and `z` as a 3d line plot
426+
///
427+
/// # Parameters
428+
///
429+
/// - `x` is the x coordinates of the plot
430+
/// - `y` is the y coordinates of the plot
431+
/// - `z` is the z coordinates of the plot
432+
/// - `title` parameter has effect only in multiview mode, where this string
433+
/// is displayed as the respective cell/view title.
383434
pub fn draw_plot3(&self, x: &Array, y: &Array, z: &Array, title: Option<String>) {
384435
let tstr = match title {
385436
Some(s) => s,
@@ -395,6 +446,12 @@ impl Window {
395446
}
396447

397448
/// Render give Arrays of points as a 3d line plot
449+
///
450+
/// # Parameters
451+
///
452+
/// - `points` is an Array containing list of points of plot
453+
/// - `title` parameter has effect only in multiview mode, where this string
454+
/// is displayed as the respective cell/view title.
398455
pub fn draw_plot(&self, points: &Array, title: Option<String>) {
399456
let tstr = match title {
400457
Some(s) => s,
@@ -409,6 +466,14 @@ impl Window {
409466
}
410467

411468
/// Render given Array as a histogram
469+
///
470+
/// # Parameters
471+
///
472+
/// - `hst` is an Array containing histogram data
473+
/// - `minval` is the minimum bin value of histogram
474+
/// - `maxval` is the maximum bin value of histogram
475+
/// - `title` parameter has effect only in multiview mode, where this string
476+
/// is displayed as the respective cell/view title.
412477
pub fn draw_hist(&self, hst: &Array, minval: f64, maxval: f64, title: Option<String>) {
413478
let tstr = match title {
414479
Some(s) => s,
@@ -424,6 +489,14 @@ impl Window {
424489
}
425490

426491
/// Render give Arrays as 3d surface
492+
///
493+
/// # Parameters
494+
///
495+
/// - `x` is the x coordinates of the surface plot
496+
/// - `y` is the y coordinates of the surface plot
497+
/// - `z` is the z coordinates of the surface plot
498+
/// - `title` parameter has effect only in multiview mode, where this string
499+
/// is displayed as the respective cell/view title.
427500
pub fn draw_surface(&self, xvals: &Array, yvals: &Array, zvals: &Array, title: Option<String>) {
428501
let tstr = match title {
429502
Some(s) => s,
@@ -441,6 +514,14 @@ impl Window {
441514
}
442515

443516
/// Render given Arrays as 2d scatter plot
517+
///
518+
/// # Parameters
519+
///
520+
/// - `xvals` is the x coordinates of the scatter plot
521+
/// - `yvals` is the y coordinates of the scatter plot
522+
/// - `marker` is of enum type [MarkerType](./enum.MarkerType.html)
523+
/// - `title` parameter has effect only in multiview mode, where this string
524+
/// is displayed as the respective cell/view title.
444525
pub fn draw_scatter2(&self, xvals: &Array, yvals: &Array,
445526
marker: MarkerType, title: Option<String>) {
446527
let tstr = match title {
@@ -457,6 +538,15 @@ impl Window {
457538
}
458539

459540
/// Render given Arrays as 3d scatter plot
541+
///
542+
/// # Parameters
543+
///
544+
/// - `xvals` is the x coordinates of the scatter plot
545+
/// - `yvals` is the y coordinates of the scatter plot
546+
/// - `zvals` is the z coordinates of the scatter plot
547+
/// - `marker` is of enum type [MarkerType](./enum.MarkerType.html)
548+
/// - `title` parameter has effect only in multiview mode, where this string
549+
/// is displayed as the respective cell/view title.
460550
pub fn draw_scatter3(&self, xvals: &Array, yvals: &Array, zvals: &Array,
461551
marker: MarkerType, title: Option<String>) {
462552
let tstr = match title {
@@ -473,6 +563,13 @@ impl Window {
473563
}
474564

475565
/// Render give Array as 3d scatter plot
566+
///
567+
/// # Parameters
568+
///
569+
/// - `points` is an Array containing list of points of plot
570+
/// - `marker` is of enum type [MarkerType](./enum.MarkerType.html)
571+
/// - `title` parameter has effect only in multiview mode, where this string
572+
/// is displayed as the respective cell/view title.
476573
pub fn draw_scatter(&self, vals: &Array, marker: MarkerType, title: Option<String>) {
477574
let tstr = match title {
478575
Some(s) => s,
@@ -487,6 +584,15 @@ impl Window {
487584
}
488585

489586
/// Render given Arrays as 2d vector field
587+
///
588+
/// # Parameters
589+
///
590+
/// - `xpnts` is an Array containing list of x coordinates
591+
/// - `xdirs` is an Array containing direction component of x coord
592+
/// - `ypnts` is an Array containing list of y coordinates
593+
/// - `ydirs` is an Array containing direction component of y coord
594+
/// - `title` parameter has effect only in multiview mode, where this string
595+
/// is displayed as the respective cell/view title.
490596
pub fn draw_vector_field2(&self, xpnts: &Array, ypnts: &Array,
491597
xdirs: &Array, ydirs: &Array, title: Option<String>) {
492598
let tstr = match title {
@@ -504,6 +610,17 @@ impl Window {
504610
}
505611

506612
/// Render given Arrays as 3d vector field
613+
///
614+
/// # Parameters
615+
///
616+
/// - `xpnts` is an Array containing list of x coordinates
617+
/// - `xdirs` is an Array containing direction component of x coord
618+
/// - `ypnts` is an Array containing list of y coordinates
619+
/// - `ydirs` is an Array containing direction component of y coord
620+
/// - `zpnts` is an Array containing list of z coordinates
621+
/// - `zdirs` is an Array containing direction component of z coord
622+
/// - `title` parameter has effect only in multiview mode, where this string
623+
/// is displayed as the respective cell/view title.
507624
pub fn draw_vector_field3(&self, xpnts: &Array, ypnts: &Array, zpnts: &Array,
508625
xdirs: &Array, ydirs: &Array, zdirs: &Array,
509626
title: Option<String>) {
@@ -523,6 +640,14 @@ impl Window {
523640
}
524641

525642
/// Render given Array as vector field
643+
///
644+
/// # Parameters
645+
///
646+
/// - `points` is an Array containing list of coordinates of vector field
647+
/// - `directions` is an Array containing directions at the coordinates specified in `points`
648+
/// Array.
649+
/// - `title` parameter has effect only in multiview mode, where this string
650+
/// is displayed as the respective cell/view title.
526651
pub fn draw_vector_field(&self, points: &Array, directions: &Array, title: Option<String>) {
527652
let tstr = match title {
528653
Some(s) => s,

0 commit comments

Comments
 (0)