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/plot.h>
16 #include <fg/plot3.h>
17 #include <fg/surface.h>
18 #include <fg/histogram.h>
19 
20 namespace internal
21 {
22 class _Window;
23 }
24 
25 namespace fg
26 {
27 
33 class Window {
34  private:
35  internal::_Window* value;
36 
37  Window() {}
38 
39  public:
52  FGAPI Window(int pWidth, int pHeight, const char* pTitle,
53  const Window* pWindow=0, const bool invisible = false);
54 
60  FGAPI Window(const Window& other);
61 
65  FGAPI ~Window();
66 
72  FGAPI void setFont(Font* pFont);
73 
79  FGAPI void setTitle(const char* pTitle);
80 
87  FGAPI void setPos(int pX, int pY);
88 
95  FGAPI void setSize(unsigned pWidth, unsigned pHeight);
96 
102  FGAPI void setColorMap(ColorMap cmap);
103 
108  FGAPI long long context() const;
109 
114  FGAPI long long display() const;
115 
119  FGAPI int width() const;
120 
124  FGAPI int height() const;
125 
129  FGAPI internal::_Window* get() const;
130 
134  FGAPI void makeCurrent();
135 
139  FGAPI void hide();
140 
144  FGAPI void show();
145 
153  FGAPI bool close();
154 
164  FGAPI void draw(const Image& pImage, const bool pKeepAspectRatio=true);
165 
175  FGAPI void draw(const Plot& pPlot);
176 
186  FGAPI void draw(const Plot3& pPlot3);
187 
197  FGAPI void draw(const Surface& pSurface);
207  FGAPI void draw(const Histogram& pHist);
208 
218  FGAPI void grid(int pRows, int pCols);
219 
237  FGAPI void draw(int pColId, int pRowId, const Image& pImage, const char* pTitle=0, const bool pKeepAspectRatio=true);
238 
256  FGAPI void draw(int pColId, int pRowId, const Plot& pPlot, const char* pTitle = 0);
257 
258 
276  FGAPI void draw(int pColId, int pRowId, const Plot3& pPlot3, const char* pTitle = 0);
277 
295  FGAPI void draw(int pColId, int pRowId, const Surface& pSurface, const char* pTitle = 0);
296 
314  FGAPI void draw(int pColId, int pRowId, const Histogram& pHist, const char* pTitle = 0);
315 
322  FGAPI void swapBuffers();
323 };
324 
325 }
FGAPI void swapBuffers()
Swaps background OpenGL buffer with front buffer.
Bar graph to display data frequencey.
Definition: histogram.h:27
Line graph to display plots.
Definition: plot.h:27
FGAPI void makeCurrent()
Make the current window's OpenGL context active context.
Definition: CPUCopy.hpp:13
ColorMap
Color maps.
Definition: defines.h:110
3d graph to display 3d line plots.
Definition: plot3.h:27
FGAPI void setSize(unsigned pWidth, unsigned pHeight)
Set the size of the window programmatically.
FGAPI long long display() const
Get Native Window display handle.
FGAPI long long context() const
Get OpenGL context handle.
FGAPI void hide()
Hide the window.
Window is where other objects such as Images, Plots etc.
Definition: window.h:33
#define FGAPI
Definition: defines.h:32
FGAPI void setPos(int pX, int pY)
Set the start position where the window will appear.
Definition: font.h:13
FGAPI void setFont(Font *pFont)
Set font to be used by the window to draw text.
FGAPI int width() const
Font object is essentially a resource handler for the specific font you want to use.
Definition: font.h:26
FGAPI void setTitle(const char *pTitle)
Set the window title.
3d graph to display plots.
Definition: surface.h:27
FGAPI void draw(const Image &pImage, const bool pKeepAspectRatio=true)
Render an Image to Window.
FGAPI void setColorMap(ColorMap cmap)
Set the colormap to be used for subsequent rendering calls.
FGAPI bool close()
Check if the window is ready for close.
FGAPI int height() const
FGAPI void grid(int pRows, int pCols)
Setup grid layout for multivew mode.
FGAPI ~Window()
Window Destructor.
FGAPI void show()
Show the window if hidden, otherwise no effect.
Definition: image.h:25