Empirical
Namespaces | Functions
canvas_utils.h File Reference

Various versions of the Draw() function to draw images onto a canvas. More...

#include "Canvas.h"
#include "../base/vector.h"
#include "../Evolve/StateGrid.h"
#include "../geometry/Circle2D.h"
#include "../geometry/Surface2D.h"
#include "../tools/BitMatrix.h"
#include "color_map.h"

Go to the source code of this file.

Namespaces

 emp
 If we are in emscripten, make sure to include the header.
 
 emp::web
 

Functions

void emp::web::Draw (Canvas canvas, const emp::Circle &circle, const std::string &fill="", const std::string &line="")
 Draw a Circle onto the canvas. More...
 
template<size_t COLS, size_t ROWS>
void emp::web::Draw (Canvas canvas, const BitMatrix< COLS, ROWS > &matrix, double w, double h)
 Draw a BitMatrix onto a canvas using black and white squares (can specify cell width and height) More...
 
template<typename BODY_TYPE >
void emp::web::Draw (Canvas canvas, const Surface2D< BODY_TYPE > &surface, const emp::vector< std::string > &color_map)
 
template<typename BODY_TYPE >
void emp::web::Draw (Canvas canvas, const Surface2D< BODY_TYPE > &surface, size_t num_colors)
 
void emp::web::Draw (Canvas canvas, const emp::vector< emp::vector< size_t >> &grid, const emp::vector< std::string > &color_map, std::string line_color, double cell_width, double cell_height, double offset_x, double offset_y)
 
void emp::web::Draw (Canvas canvas, const emp::vector< emp::vector< size_t >> &grid, const emp::vector< std::string > &color_map, std::string line_color, double cell_w, double cell_h)
 
void emp::web::Draw (Canvas canvas, const emp::vector< emp::vector< size_t >> &grid, const emp::vector< std::string > &color_map, std::string line_color="black")
 
void emp::web::Draw (Canvas canvas, const emp::vector< size_t > &grid, size_t grid_cols, const emp::vector< std::string > &color_map, std::string line_color, double cell_width, double cell_height, double offset_x, double offset_y)
 
void emp::web::Draw (Canvas canvas, const StateGrid &state_grid, const emp::vector< std::string > &color_map, std::string line_color="black")
 
void emp::web::DrawGridBG (Canvas canvas, size_t rows, size_t cols, const std::string &bg_color, const std::string &line_color)
 
template<typename CONTAINER_T , typename POINT_FUN_T , typename COLOR_FUN_T >
void emp::web::DrawPoints (Canvas canvas, CONTAINER_T &&container, double radius, POINT_FUN_T &&point_fun, COLOR_FUN_T &&color_fun, const std::string &line_color="black")
 

Detailed Description

Various versions of the Draw() function to draw images onto a canvas.

Note
This file is part of Empirical, https://github.com/devosoft/Empirical
Date
2015-2018

Each version of Draw() takes a canvas widget and some form of data to be drawn on the widget, such as a circle, a bit matrix, or a geometric surface.