Forge: window.h Source File

Forge

window.h
Go to the documentation of this file.
1 /*******************************************************
2 * Copyright (c) 2015-2019, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10 #pragma once
11
12 #include <fg/defines.h>
13 #include <fg/font.h>
14 #include <fg/image.h>
15 #include <fg/chart.h>
16 #include <fg/surface.h>
17 #include <fg/histogram.h>
18
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
41 FGAPI fg_err fg_create_window(fg_window *pWindow,
42 const int pWidth, const int pHeight,
43 const char* pTitle,
44 const fg_window pShareWindow,
45 const bool pInvisible);
46
54 FGAPI fg_err fg_destroy_window(fg_window pWindow);
55
64 FGAPI fg_err fg_set_window_font(fg_window pWindow, fg_font pFont);
65
74 FGAPI fg_err fg_set_window_title(fg_window pWindow, const char* pTitle);
75
85 FGAPI fg_err fg_set_window_position(fg_window pWindow, const int pX, const int pY);
86
96 FGAPI fg_err fg_set_window_size(fg_window pWindow, const unsigned pWidth, const unsigned pHeight);
97
106 FGAPI fg_err fg_set_window_colormap(fg_window pWindow, const fg_color_map pColorMap);
107
116 FGAPI fg_err fg_get_window_context_handle(long long *pContext, const fg_window pWindow);
117
126 FGAPI fg_err fg_get_window_display_handle(long long *pDisplay, const fg_window pWindow);
127
136 FGAPI fg_err fg_get_window_width(int *pWidth, const fg_window pWindow);
137
146 FGAPI fg_err fg_get_window_height(int *pHeight, const fg_window pWindow);
147
155 FGAPI fg_err fg_make_window_current(const fg_window pWindow);
156
166 FGAPI fg_err fg_get_window_grid(int *pRows, int *pCols, const fg_window pWindow);
167
175 FGAPI fg_err fg_hide_window(const fg_window pWindow);
176
184 FGAPI fg_err fg_show_window(const fg_window pWindow);
185
194 FGAPI fg_err fg_close_window(bool* pIsClosed, const fg_window pWindow);
195
205 FGAPI fg_err fg_draw_image(const fg_window pWindow, const fg_image pImage, const bool pKeepAspectRatio);
206
215 FGAPI fg_err fg_draw_chart(const fg_window pWindow, const fg_chart pChart);
216
226 FGAPI fg_err fg_setup_window_grid(int pRows, int pCols, fg_window pWindow);
227
240 FGAPI fg_err fg_draw_image_to_cell(const fg_window pWindow, int pRowId, int pColId,
241 const fg_image pImage, const char* pTitle, const bool pKeepAspectRatio);
242
254 FGAPI fg_err fg_draw_chart_to_cell(const fg_window pWindow, int pRowId, int pColId,
255 const fg_chart pChart, const char* pTitle);
256
264 FGAPI fg_err fg_swap_window_buffers(const fg_window pWindow);
265
277 FGAPI fg_err fg_save_window_framebuffer(const char* pFullPath, const fg_window pWindow);
278
281 #ifdef __cplusplus
282 }
283 #endif
284
285
286 #ifdef __cplusplus
287
288 namespace forge
289 {
290
296 class Window {
297 private:
298 fg_window mValue;
299
300 Window() {}
301
302 public:
315 FGAPI Window(int pWidth, int pHeight, const char* pTitle,
316 const Window* pWindow=0, const bool invisible = false);
317
323 FGAPI Window(const Window& other);
324
328 FGAPI ~Window();
329
335 FGAPI void setFont(Font* pFont);
336
342 FGAPI void setTitle(const char* pTitle);
343
350 FGAPI void setPos(int pX, int pY);
351
358 FGAPI void setSize(unsigned pWidth, unsigned pHeight);
359
365 FGAPI void setColorMap(ColorMap cmap);
366
371 FGAPI long long context() const;
372
377 FGAPI long long display() const;
378
382 FGAPI int width() const;
383
387 FGAPI int height() const;
388
392 FGAPI fg_window get() const;
393
397 FGAPI void makeCurrent();
398
402 FGAPI int gridRows() const;
403
407 FGAPI int gridCols() const;
408
412 FGAPI void hide();
413
417 FGAPI void show();
418
426 FGAPI bool close();
427
438 FGAPI void draw(const Image& pImage, const bool pKeepAspectRatio=true);
439
448 FGAPI void draw(const Chart& pChart);
449
459 FGAPI void grid(int pRows, int pCols);
460
481 FGAPI void draw(int pRowId, int pColId, const Image& pImage, const char* pTitle=0, const bool pKeepAspectRatio=true);
482
501 FGAPI void draw(int pRowId, int pColId, const Chart& pChart, const char* pTitle = 0);
502
509 FGAPI void swapBuffers();
510
521 FGAPI void saveFrameBuffer(const char* pFullPath);
522 };
523
524 }
525
526 #endif
fg_set_window_position
FGAPI fg_err fg_set_window_position(fg_window pWindow, const int pX, const int pY)
Set the window origin of Window Object w.r.t screen origin.
fg_create_window
FGAPI fg_err fg_create_window(fg_window *pWindow, const int pWidth, const int pHeight, const char *pTitle, const fg_window pShareWindow, const bool pInvisible)
Create a Window object.
forge::Window::width
FGAPI int width() const
forge::Window::gridCols
FGAPI int gridCols() const
fg_hide_window
FGAPI fg_err fg_hide_window(const fg_window pWindow)
Hide the Window.
fg_chart
void * fg_chart
Definition: defines.h:42
forge::Window::display
FGAPI long long display() const
Get Native Window display handle.
forge
Definition: chart.h:214
forge::Window::setPos
FGAPI void setPos(int pX, int pY)
Set the start position where the window will appear.
forge::Window::height
FGAPI int height() const
fg_get_window_width
FGAPI fg_err fg_get_window_width(int *pWidth, const fg_window pWindow)
Get the width of Window.
forge::Window::context
FGAPI long long context() const
Get rendering backend context handle.
forge::Window::close
FGAPI bool close()
Check if the window is ready for close.
forge::Window::hide
FGAPI void hide()
Hide the window.
fg_swap_window_buffers
FGAPI fg_err fg_swap_window_buffers(const fg_window pWindow)
Swap back buffer with front buffer.
surface.h
chart.h
forge::Window::show
FGAPI void show()
Show the window if hidden, otherwise no effect.
fg_color_map
fg_color_map
Color maps.
Definition: defines.h:127
forge::Window::makeCurrent
FGAPI void makeCurrent()
Make the current window&#39;s rendering context active context.
font.h
fg_setup_window_grid
FGAPI fg_err fg_setup_window_grid(int pRows, int pCols, fg_window pWindow)
Setup grid layout for multiple view rendering on Window.
forge::Window::setSize
FGAPI void setSize(unsigned pWidth, unsigned pHeight)
Set the size of the window programmatically.
forge::Window::draw
FGAPI void draw(const Image &pImage, const bool pKeepAspectRatio=true)
Render an Image to Window.
forge::Window::grid
FGAPI void grid(int pRows, int pCols)
Setup grid layout for multivew mode.
FGAPI
#define FGAPI
Definition: defines.h:28
fg_save_window_framebuffer
FGAPI fg_err fg_save_window_framebuffer(const char *pFullPath, const fg_window pWindow)
Save the current frame buffer to a file at provided path.
fg_show_window
FGAPI fg_err fg_show_window(const fg_window pWindow)
Show the Window.
defines.h
fg_get_window_display_handle
FGAPI fg_err fg_get_window_display_handle(long long *pDisplay, const fg_window pWindow)
Get the display device handle of Window.
fg_draw_chart_to_cell
FGAPI fg_err fg_draw_chart_to_cell(const fg_window pWindow, int pRowId, int pColId, const fg_chart pChart, const char *pTitle)
Render given chart to Window&#39;s particular sub-view.
forge::Font
Font object is essentially a resource handler for the specific font you want to use.
Definition: font.h:76
fg_get_window_grid
FGAPI fg_err fg_get_window_grid(int *pRows, int *pCols, const fg_window pWindow)
Get the window&#39;s grid size.
fg_make_window_current
FGAPI fg_err fg_make_window_current(const fg_window pWindow)
Make the window&#39;s backend specific context the active context in given thread.
fg_close_window
FGAPI fg_err fg_close_window(bool *pIsClosed, const fg_window pWindow)
Check if the Window is closed.
forge::Window::gridRows
FGAPI int gridRows() const
fg_set_window_font
FGAPI fg_err fg_set_window_font(fg_window pWindow, fg_font pFont)
Set font object to be used by Window Object.
fg_image
void * fg_image
Definition: defines.h:43
forge::Window::setFont
FGAPI void setFont(Font *pFont)
Set font to be used by the window to draw text.
forge::Window::swapBuffers
FGAPI void swapBuffers()
Swaps background buffer with front buffer.
fg_err
fg_err
Definition: defines.h:49
forge::Chart
Chart is base canvas where other plottable objects are rendered.
Definition: chart.h:226
fg_set_window_colormap
FGAPI fg_err fg_set_window_colormap(fg_window pWindow, const fg_color_map pColorMap)
Set the colormap to be used by the Window Object.
fg_set_window_title
FGAPI fg_err fg_set_window_title(fg_window pWindow, const char *pTitle)
Set the title of Window Object.
fg_font
void * fg_font
Definition: defines.h:41
forge::Window::saveFrameBuffer
FGAPI void saveFrameBuffer(const char *pFullPath)
Save window frame buffer to give location in provided image format.
image.h
forge::Window::setTitle
FGAPI void setTitle(const char *pTitle)
Set the window title.
forge::Window::~Window
FGAPI ~Window()
Window Destructor.
histogram.h
fg_draw_chart
FGAPI fg_err fg_draw_chart(const fg_window pWindow, const fg_chart pChart)
Render given chart to Window.
forge::Image
Image is plain rendering of an image over the window or sub-region of it.
Definition: image.h:164
fg_destroy_window
FGAPI fg_err fg_destroy_window(fg_window pWindow)
Destroy Window Object.
forge::Window
Window is where other objects such as Images, Plots etc.
Definition: window.h:296
fg_get_window_context_handle
FGAPI fg_err fg_get_window_context_handle(long long *pContext, const fg_window pWindow)
Get the backend specific context handle of Window.
fg_window
void * fg_window
Definition: defines.h:40
fg_set_window_size
FGAPI fg_err fg_set_window_size(fg_window pWindow, const unsigned pWidth, const unsigned pHeight)
Set the window dimensions of Window Object.
fg_get_window_height
FGAPI fg_err fg_get_window_height(int *pHeight, const fg_window pWindow)
Get the height of Window.
fg_draw_image_to_cell
FGAPI fg_err fg_draw_image_to_cell(const fg_window pWindow, int pRowId, int pColId, const fg_image pImage, const char *pTitle, const bool pKeepAspectRatio)
Render given image to Window&#39;s particular sub-view.
fg_draw_image
FGAPI fg_err fg_draw_image(const fg_window pWindow, const fg_image pImage, const bool pKeepAspectRatio)
Render given image to Window.
forge::Window::setColorMap
FGAPI void setColorMap(ColorMap cmap)
Set the colormap to be used for subsequent rendering calls.