libidxgui
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009 by Pierre Sermanet * 00003 * pierre.sermanet@gmail.com * 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Redistribution under a license not approved by the Open Source 00014 * Initiative (http://www.opensource.org) must display the 00015 * following acknowledgement in all advertising material: 00016 * This product includes software developed at the Courant 00017 * Institute of Mathematical Sciences (http://cims.nyu.edu). 00018 * * The names of the authors may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00023 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY 00025 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00028 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 ***************************************************************************/ 00032 00033 #ifndef GUI_H_ 00034 #define GUI_H_ 00035 00036 #include <ostream> 00037 #include "libidx.h" 00038 #include "gui_thread.h" 00039 00040 using namespace std; 00041 00042 namespace ebl { 00043 00045 EXPORT int new_window(const char *wname = NULL, uint h = 0, uint w = 0); 00047 EXPORT int new_window(const string &wname, uint h = 0, uint w = 0); 00049 EXPORT int new_window3d(const char *wname = NULL, uint h = 0, uint w = 0); 00051 EXPORT int new_window3d(const string &wname, uint h = 0, uint w = 0); 00053 EXPORT void select_window(int wid); 00056 EXPORT void disable_window_updates(); 00059 EXPORT void enable_window_updates(); 00060 00072 template<class T> 00073 void draw_matrix(idx<T> &im, unsigned int h0, unsigned int w0, 00074 double zoomh, double zoomw, T minv = 0, T maxv = 0); 00077 template<class T> 00078 void draw_matrix(idx<T> &im, uint h0 = 0, uint w0 = 0); 00085 EXPORT void draw_matrix_unsafe(idx<ubyte> &im, uint h0 = 0, uint w0 = 0); 00087 template<class T> 00088 void draw_matrix_frame(idx<T> &im, ubyte r, ubyte g, ubyte b, 00089 unsigned int h0 = 0, unsigned int w0 = 0, 00090 double zoomh = 1.0, double zoomw = 1.0, 00091 T minv = 0, T maxv = 0); 00093 template<class T> 00094 void draw_matrix(idx<T> &im, const char *str, 00095 unsigned int h0 = 0, unsigned int w0 = 0, 00096 double zoomh = 1.0, double zoomw = 1.0, 00097 T minv = 0, T maxv = 0); 00099 template<class T> 00100 void draw_mask(idx<T> &im, uint h0 = 0, uint w0 = 0, 00101 double zoomh = 1.0, double zoomw = 1.0, 00102 ubyte r = 255, ubyte g = 0, ubyte b = 0, ubyte a = 127, 00103 T threshold = 0.0); 00104 00106 EXPORT void quit_gui(); 00108 EXPORT void clear_window(); 00110 EXPORT void clear_resize_window(); 00114 EXPORT void save_window(const char *filename, int wid = -1); 00115 00117 EXPORT void draw_arrow(int h1, int w1, int h2, int w2); 00119 EXPORT void draw_flow(idx<float> &flow, int h, int w); 00123 EXPORT void draw_box(rect<int> &box, ubyte r = 255, ubyte g = 255, 00124 ubyte b = 255, ubyte a = 255, string *s = NULL); 00128 EXPORT void draw_box(rect<float> &box, ubyte r = 255, ubyte g = 255, 00129 ubyte b = 255, ubyte a = 255, string *s = NULL); 00133 EXPORT void draw_box(int h0, int w0, int h, int w, ubyte r = 255, 00134 ubyte g = 255, ubyte b = 255, ubyte a = 255, 00135 string *s = NULL); 00139 EXPORT void draw_box(float h0, float w0, float h, float w, ubyte r = 255, 00140 ubyte g = 255, ubyte b = 255, ubyte a = 255, 00141 string *s = NULL); 00145 EXPORT void draw_cross(float h0, float w0, float length, ubyte r = 255, 00146 ubyte g = 255, ubyte b = 255, ubyte a = 255, 00147 string *s = NULL); 00151 EXPORT void draw_ellipse(float h0, float w0, float h, float w, ubyte r = 255, 00152 ubyte g = 255, ubyte b = 255, ubyte a = 255, 00153 string *s = NULL); 00154 00156 EXPORT void set_gui_silent(); 00158 EXPORT void set_gui_silent(const std::string *filename); 00160 EXPORT void set_gui_silent(const char *filename); 00161 00165 EXPORT void draw_text(string *s); 00169 EXPORT void draw_text(string *s, unsigned int h0, unsigned int w0); 00173 EXPORT void set_text_origin(unsigned int h0, unsigned int w0); 00180 EXPORT void set_text_colors(unsigned char fg_r, unsigned char fg_g, 00181 unsigned char fg_b, unsigned char fg_a, 00182 unsigned char bg_r, unsigned char bg_g, 00183 unsigned char bg_b, unsigned char bg_a); 00185 EXPORT void set_text_colors(int fg_r, int fg_g, int fg_b, int fg_a, 00186 int bg_r, int bg_g, int bg_b, int bg_a); 00188 EXPORT void set_bg_colors(int r, int g, int b); 00190 EXPORT void set_font_size(int sz); 00191 00196 EXPORT void set_window_cout_and_gui(); 00200 EXPORT void set_window_gui_only(); 00202 EXPORT void night_mode(); 00204 EXPORT void set_window_title(const char *s); 00206 EXPORT void freeze_window_size(uint h, uint w); 00207 00209 00211 EXPORT void draw_sphere(float x, float y, float z, float radius, 00212 const char *s = NULL, 00213 int r = 255, int g = 255, int b = 255, int a = 255); 00218 EXPORT void draw_cylinder(float x, float y, float z, float length, 00219 float top_radius, float base_radius, 00220 float a1, float a2, const char *s = NULL, 00221 int r = 255, int g = 255, 00222 int b = 255, int a = 255, bool tops = false); 00224 EXPORT void draw_text(float x, float y, float z, const char *s, 00225 int r = 255, int g = 255, int b = 255, int a = 255); 00228 EXPORT void draw_line(float x, float y, float z, 00229 float x1, float y1, float z1, 00230 const char *s = NULL, int r = 255, int g = 255, 00231 int b = 255, int a = 255); 00232 00233 00234 } // namespace ebl 00235 00236 #include "gui.hpp" 00237 00238 #endif /* GUI_H_ */