Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/details/graphics.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**

\addtogroup graphics_func
@{

A list of graphics functions to visualize data

\defgroup gfx_func_window Window Functions
@{

Window creation, modification and destruction functions.

@}

\defgroup gfx_func_draw Rendering Functions
@{

Rendering functions to draw images, plots etc.

@}

@}
*/
4 changes: 3 additions & 1 deletion examples/graphics/conway_pretty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ int main(int argc, char *argv[])

af::Window simpleWindow(512, 512, "Conway's Game Of Life - Current State");
af::Window prettyWindow(512, 512, "Conway's Game Of Life - Visualizing States");
simpleWindow.setPos(25, 25);
prettyWindow.setPos(125, 15);

int frame_count = 0;

Expand All @@ -50,7 +52,7 @@ int main(int argc, char *argv[])

array display = tile(state, 1, 1, 3, 1);

while(!simpleWindow.close() || !prettyWindow.close()) {
while(!simpleWindow.close() && !prettyWindow.close()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set this back to ||. The checks are being done before the image calls in line 58 and 59.

af::timer delay = timer::start();

if(!simpleWindow.close()) simpleWindow.image(state);
Expand Down
3 changes: 2 additions & 1 deletion examples/graphics/fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ int main(int argc, char **argv)
info();
printf("** ArrayFire Fractals Demo **\n");
af::Window wnd("Fractal Demo");
wnd.setColorMap(AF_COLORMAP_SPECTRUM);

float center[] = {-0.5, 0};
// Keep zomming out for each frame
for (int zoom = 1000; zoom > 10; zoom -= 5) {
for (int zoom = 1000; zoom > 100; zoom -= 1) {
// Generate the grid at the current zoom factor
array c = complex_grid(WIDTH, HEIGHT, zoom, center);

Expand Down
1 change: 1 addition & 0 deletions examples/image_processing/brain_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ array segment_volume(array A, int k)
void brain_seg(bool console)
{
af::Window wnd("Brain Segmentation Demo");
wnd.setColorMap(AF_COLORMAP_HEAT);

double time_total = 30; // run for N seconds

Expand Down
1 change: 1 addition & 0 deletions examples/image_processing/optical_flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static void diffs(array& Ix, array& Iy, array& It, array I1, array I2)
static void optical_flow_demo(bool console)
{
af::Window wnd("Horn-Schunck Optical Flow Demo");
wnd.setColorMap(AF_COLORMAP_COLORS);

double time_total = 10; // run for N seconds

Expand Down
11 changes: 11 additions & 0 deletions include/af/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ typedef enum {
AF_NORM_EUCLID = AF_NORM_VECTOR_2, ///< The default. Same as AF_NORM_VECTOR_2
} af_norm_type;

typedef enum {
AF_COLORMAP_DEFAULT = 0, ///< Default grayscale map
AF_COLORMAP_SPECTRUM= 1, ///< Spectrum map
AF_COLORMAP_COLORS = 2, ///< Colors
AF_COLORMAP_RED = 3, ///< Red hue map
AF_COLORMAP_MOOD = 4, ///< Mood map
AF_COLORMAP_HEAT = 5, ///< Heat map
AF_COLORMAP_BLUE = 6 ///< Blue hue map
} af_colormap;

// Below enum is purely added for example purposes
// it doesn't and shoudn't be used anywhere in the
// code. No Guarantee's provided if it is used.
Expand All @@ -309,6 +319,7 @@ namespace af
typedef af_conv_mode convMode;
typedef af_conv_domain convDomain;
typedef af_mat_prop matProp;
typedef af_colormap ColorMap;
typedef af_norm_type normType;
}

Expand Down
Loading