Struct arrayfire::Window
[−]
[src]
pub struct Window { /* fields omitted */ }
Used to render Array objects
The renderings can be either plots, histograms or simply just image displays. A single window can also display multiple of the above renderings at the same time, which is known as multiview mode. An example of that is given below.
Examples
use arrayfire::{histogram, load_image, Window}; let mut wnd = Window::new(1280, 720, String::from("Image Histogram")); let img = load_image("Path to image".to_string(), true/*If color image, 'false' otherwise*/); let hst = histogram(&img, 256, 0 as f64, 255 as f64); loop { wnd.grid(2, 1); wnd.set_view(0, 0); wnd.draw_image(&img, Some("Input Image".to_string())); wnd.set_view(1, 0); wnd.draw_hist(&hst, 0.0, 255.0, Some("Input Image Histogram".to_string())); wnd.show(); if wnd.is_closed() == true { break; } }
Methods
impl Window
[src]
fn new(width: i32, height: i32, title: String) -> Window
Creates new Window object
Parameters
width
is width of the windowheight
is the height of windowtitle
is the string displayed on window title bar
Return Values
Window Object
fn set_position(&self, x: u32, y: u32)
Set window starting position on the screen
Parameters
x
is the horiontal coordinate where window is to be placedy
is the vertical coordinate where window is to be placed
fn set_title(&self, title: String)
fn set_visibility(&self, is_visible: bool)
Set window visibility
Parameters
is_visible
is a boolean indicating whether window is to be hidden or brought into focus
Return Values
None
fn set_size(&self, w: u32, h: u32)
fn set_colormap(&mut self, cmap: ColorMap)
Set color map to be used for rendering image, it can take one of the values of enum ColorMap
fn is_closed(&self) -> bool
Returns true if the window close is triggered by the user
fn grid(&self, rows: i32, cols: i32)
Setup display layout in multiview mode
Parameters
rows
is the number of rows into which whole window is split into in multiple view modecols
is the number of cols into which whole window is split into in multiple view mode
fn show(&mut self)
Used in multiview mode to swap back buffer with front buffer to show the recently rendered frame
fn set_view(&mut self, r: i32, c: i32)
Set the current sub-region to render
This function is only to be used into multiview mode
Parameters
r
is the target row idc
is the target row id
fn set_axes_titles(&mut self, xlabel: String, ylabel: String, zlabel: String)
Set chart axes titles
Parameters
xlabel
is x axis titleylabel
is y axis titlezlabel
is z axis title
fn set_axes_limits_compute(
&mut self,
xrange: &Array,
yrange: &Array,
zrange: Option<&Array>,
exact: bool
)
&mut self,
xrange: &Array,
yrange: &Array,
zrange: Option<&Array>,
exact: bool
)
Set chart axes limits by computing limits from data
In multiple view (grid) mode, setting limits will effect the chart that is currently active via set_view call
Parameters
xrange
is set of all x values to compute min/max for x axisyrange
is set of all y values to compute min/max for y axiszrange
is set of all z values to compute min/max for z axis. If None is passed to this paramter, 2d chart limits are set.exact
indicates if the exact min/max values fromxrange
,yrange
andzrange
are to extracted. If exact is false then the most significant digit is rounded up to next power of 2 and the magnitude remains the same.
fn set_axes_limits_2d(
&mut self,
xmin: f32,
xmax: f32,
ymin: f32,
ymax: f32,
exact: bool
)
&mut self,
xmin: f32,
xmax: f32,
ymin: f32,
ymax: f32,
exact: bool
)
Set 2d chart axes limits
In multiple view (grid) mode, setting limits will effect the chart that is currently active via set_view call
Parameters
xmin
is minimum value on x axisxmax
is maximum value on x axisymin
is minimum value on y axisymax
is maximum value on y axisexact
indicates if the exact min/max values fromxrange
,yrange
andzrange
are to extracted. If exact is false then the most significant digit is rounded up to next power of 2 and the magnitude remains the same.
fn set_axes_limits_3d(
&mut self,
xmin: f32,
xmax: f32,
ymin: f32,
ymax: f32,
zmin: f32,
zmax: f32,
exact: bool
)
&mut self,
xmin: f32,
xmax: f32,
ymin: f32,
ymax: f32,
zmin: f32,
zmax: f32,
exact: bool
)
Set 3d chart axes limits
In multiple view (grid) mode, setting limits will effect the chart that is currently active via set_view call
Parameters
xmin
is minimum value on x axisxmax
is maximum value on x axisymin
is minimum value on y axisymax
is maximum value on y axiszmin
is minimum value on z axiszmax
is maximum value on z axisexact
indicates if the exact min/max values fromxrange
,yrange
andzrange
are to extracted. If exact is false then the most significant digit is rounded up to next power of 2 and the magnitude remains the same.
fn draw_image(&self, input: &Array, title: Option<String>)
Render given Array as an image
Parameters
input
imagetitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_plot2(&self, x: &Array, y: &Array, title: Option<String>)
Render given two Array's x
and y
as a 2d line plot
Parameters
x
is the x coordinates of the ploty
is the y coordinates of the plottitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_plot3(&self, x: &Array, y: &Array, z: &Array, title: Option<String>)
Render given Array's x
, y
and z
as a 3d line plot
Parameters
x
is the x coordinates of the ploty
is the y coordinates of the plotz
is the z coordinates of the plottitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_plot(&self, points: &Array, title: Option<String>)
Render give Arrays of points as a 3d line plot
Parameters
points
is an Array containing list of points of plottitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_hist(
&self,
hst: &Array,
minval: f64,
maxval: f64,
title: Option<String>
)
&self,
hst: &Array,
minval: f64,
maxval: f64,
title: Option<String>
)
Render given Array as a histogram
Parameters
hst
is an Array containing histogram dataminval
is the minimum bin value of histogrammaxval
is the maximum bin value of histogramtitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_surface(
&self,
xvals: &Array,
yvals: &Array,
zvals: &Array,
title: Option<String>
)
&self,
xvals: &Array,
yvals: &Array,
zvals: &Array,
title: Option<String>
)
Render give Arrays as 3d surface
Parameters
x
is the x coordinates of the surface ploty
is the y coordinates of the surface plotz
is the z coordinates of the surface plottitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_scatter2(
&self,
xvals: &Array,
yvals: &Array,
marker: MarkerType,
title: Option<String>
)
&self,
xvals: &Array,
yvals: &Array,
marker: MarkerType,
title: Option<String>
)
Render given Arrays as 2d scatter plot
Parameters
xvals
is the x coordinates of the scatter plotyvals
is the y coordinates of the scatter plotmarker
is of enum type MarkerTypetitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_scatter3(
&self,
xvals: &Array,
yvals: &Array,
zvals: &Array,
marker: MarkerType,
title: Option<String>
)
&self,
xvals: &Array,
yvals: &Array,
zvals: &Array,
marker: MarkerType,
title: Option<String>
)
Render given Arrays as 3d scatter plot
Parameters
xvals
is the x coordinates of the scatter plotyvals
is the y coordinates of the scatter plotzvals
is the z coordinates of the scatter plotmarker
is of enum type MarkerTypetitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_scatter(&self, vals: &Array, marker: MarkerType, title: Option<String>)
Render give Array as 3d scatter plot
Parameters
points
is an Array containing list of points of plotmarker
is of enum type MarkerTypetitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_vector_field2(
&self,
xpnts: &Array,
ypnts: &Array,
xdirs: &Array,
ydirs: &Array,
title: Option<String>
)
&self,
xpnts: &Array,
ypnts: &Array,
xdirs: &Array,
ydirs: &Array,
title: Option<String>
)
Render given Arrays as 2d vector field
Parameters
xpnts
is an Array containing list of x coordinatesxdirs
is an Array containing direction component of x coordypnts
is an Array containing list of y coordinatesydirs
is an Array containing direction component of y coordtitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_vector_field3(
&self,
xpnts: &Array,
ypnts: &Array,
zpnts: &Array,
xdirs: &Array,
ydirs: &Array,
zdirs: &Array,
title: Option<String>
)
&self,
xpnts: &Array,
ypnts: &Array,
zpnts: &Array,
xdirs: &Array,
ydirs: &Array,
zdirs: &Array,
title: Option<String>
)
Render given Arrays as 3d vector field
Parameters
xpnts
is an Array containing list of x coordinatesxdirs
is an Array containing direction component of x coordypnts
is an Array containing list of y coordinatesydirs
is an Array containing direction component of y coordzpnts
is an Array containing list of z coordinateszdirs
is an Array containing direction component of z coordtitle
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
fn draw_vector_field(
&self,
points: &Array,
directions: &Array,
title: Option<String>
)
&self,
points: &Array,
directions: &Array,
title: Option<String>
)
Render given Array as vector field
Parameters
points
is an Array containing list of coordinates of vector fielddirections
is an Array containing directions at the coordinates specified inpoints
Array.title
parameter has effect only in multiview mode, where this string is displayed as the respective cell/view title.
Trait Implementations
impl Clone for Window
[src]
fn clone(&self) -> Window
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl From<u64> for Window
[src]
Used to create Window object from native(ArrayFire) resource handle