XenevaOS
Loading...
Searching...
No Matches
chitralekha.h
Go to the documentation of this file.
1
30#ifndef __CHITRALEKHA_H__
31#define __CHITRALEKHA_H__
32
33#include <stdint.h>
34#include <_xeneva.h>
35
36#ifdef __cplusplus
38#endif
39
53
55
56 /*
57 * ChCreateCanvas -- creates a new canvas
58 * @param reqW -- requested width of the canvas
59 * @param reqH -- requested height of the canvas
60 */
61 XE_LIB ChCanvas* ChCreateCanvas(int reqW, int reqH);
62
63 /*
64 * ChAllocateBuffer -- allocates buffers for graphics
65 * @param canvas -- Pointer to canvas
66 */
68
69 /*
70 * ChDeAllocateBuffer -- de-allocates buffers from
71 * canvas
72 * @param canvas -- pointer to canvas structure
73 */
75
76 /*
77 * ChCanvasScreenUpdate -- updates screen buffer with canvas buffer
78 * contents
79 * @param canvas -- Pointer to canvas
80 * @param x -- x position
81 * @param y -- y position
82 * @param w -- width of the canvas
83 * @param h -- height of the canvas
84 */
85 XE_LIB void ChCanvasScreenUpdate(ChCanvas * canvas, int x, int y, int w, int h);
86
87 /* Orders a completed batch of framebuffer stores. Keep this outside the
88 * scanline copy primitive so one presentation does not issue a full-system
89 * barrier for every row. */
91
92 /*
93 * ChDrawPixel -- draws a pixel to canvas buffer
94 * @param canvas -- pointer to canvas
95 * @param x -- x position
96 * @param y -- y position
97 * @param color -- color of the pixel
98 */
99 XE_LIB void ChDrawPixel(ChCanvas * canvas, int x, int y, uint32_t color);
100
101 /*
102 * ChDrawPixelRAW -- draws a pixel to canvas buffer
103 * @param canvas -- pointer to canvas
104 * @param x -- x position
105 * @param y -- y position
106 * @param color -- color of the pixel
107 */
108 XE_LIB void ChDrawPixelRAW(ChCanvas * canvas, int x, int y, uint32_t color);
109
110 /*
111 * ChDrawPixelAA -- draw anti-aliased pixel
112 * @param canv - Pointer to canvas
113 * @param x -- X location relative to window
114 * @param y -- Y location relative to window
115 * @param color -- Color of the pixel
116 * @param alpha -- Alpha value
117 */
118 XE_LIB void ChDrawPixelAA(ChCanvas * canv, int x, int y, uint32_t color, double alpha);
119
120 /*
121 * ChGetPixel -- retuns a pixel from canvas
122 * @param canvas -- Pointer to canvas structure
123 * @param x -- x position
124 * @param y -- y position
125 */
126 XE_LIB uint32_t ChGetPixel(ChCanvas * canvas, int x, int y);
127
128 /*
129 * ChCanvasFill -- fill the canvas with specific color
130 * @param canvas -- pointer to canvas structure
131 * @param w -- width to fill
132 * @param h -- height to fill
133 * @param color -- color to be filled with
134 */
135 XE_LIB void ChCanvasFill(ChCanvas * canvas, int w, int h, uint32_t color);
136
137 /*
138 * ChGetScreenDiagonal -- get screen diagonal using
139 * pythagorean theorem in centimetre
140 * @param canv -- Pointer to canvas
141 */
142 XE_LIB float ChGetScreenDiagonal(ChCanvas * canv);
143
144 /*
145 * ChGetScreenDPI -- converts screen resolution into
146 * dot-per-inch in centimetre
147 * @param canv -- Pointer to canvas
148 */
149 XE_LIB float ChGetScreenDPI(ChCanvas * canv);
150
151 /*
152 * ChGetScreenAspectRatio -- returns the aspect ration of the
153 * screen
154 * @param canv -- Pointer to canvas
155 */
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif
#define XE_LIB
Definition _xeneva.h:55
#define XE_EXTERN
Definition _xeneva.h:50
unsigned int uint32_t
Definition acefiex.h:163
unsigned short int uint16_t
Definition acefiex.h:162
XE_LIB int ChAllocateBuffer(ChCanvas *canvas)
ChAllocateBuffer – allocates buffers for graphics.
Definition chitralekha.cpp:89
struct _ChCanvas_ ChCanvas
XE_LIB uint32_t ChGetPixel(ChCanvas *canvas, int x, int y)
ChGetPixel – retuns a pixel from canvas.
Definition chitralekha.cpp:273
XE_LIB float ChGetScreenDiagonal(ChCanvas *canv)
ChGetScreenDiagonal – get screen diagonal using pythagorean theorem in centimetre.
Definition chitralekha.cpp:316
XE_LIB float ChGetScreenDPI(ChCanvas *canv)
ChGetScreenDPI – converts screen resolution into dot-per-inch in centimetre.
Definition chitralekha.cpp:327
XE_LIB void ChCanvasScreenUpdate(ChCanvas *canvas, int x, int y, int w, int h)
ChCanvasScreenUpdate – updates screen buffer with canvas buffer contents.
Definition chitralekha.cpp:129
XE_LIB int ChPrintLibName()
Definition chitralekha.cpp:44
XE_LIB void ChDrawPixel(ChCanvas *canvas, int x, int y, uint32_t color)
ChDrawPixel – draws a pixel to canvas buffer.
Definition chitralekha.cpp:184
XE_LIB int ChDeAllocateBuffer(ChCanvas *canvas)
ChDeAllocateBuffer – de-allocates buffers from canvas.
Definition chitralekha.cpp:110
XE_LIB int ChGetScreenAspectRatio(ChCanvas *canv)
ChGetScreenAspectRatio – returns the aspect ration of the screen.
Definition chitralekha.cpp:339
XE_LIB void ChDrawPixelAA(ChCanvas *canv, int x, int y, uint32_t color, double alpha)
ChDrawPixelAA – draw anti-aliased pixel.
Definition chitralekha.cpp:261
XE_LIB void ChCanvasFill(ChCanvas *canvas, int w, int h, uint32_t color)
ChCanvasFill – fill the canvas with specific color.
Definition chitralekha.cpp:305
XE_LIB ChCanvas * ChCreateCanvas(int reqW, int reqH)
ChCreateCanvas – creates a new canvas.
Definition chitralekha.cpp:54
XE_LIB void ChDrawPixelRAW(ChCanvas *canvas, int x, int y, uint32_t color)
ChDrawPixelRAW – draws a pixel to canvas buffer.
Definition chitralekha.cpp:225
XE_LIB void ChCanvasScreenCommit()
Definition chitralekha.cpp:168
ChCanvas * canvas
Definition deomain.cpp:91
Definition chitralekha.h:40
uint32_t * framebuff
Definition chitralekha.h:51
int graphics_fd
Definition chitralekha.h:41
uint32_t screenHeight
Definition chitralekha.h:43
uint32_t pitch
Definition chitralekha.h:46
uint32_t canvasHeight
Definition chitralekha.h:48
uint16_t scanline
Definition chitralekha.h:45
uint32_t screenWidth
Definition chitralekha.h:42
uint32_t canvasWidth
Definition chitralekha.h:47
size_t bufferSz
Definition chitralekha.h:50
uint32_t * buffer
Definition chitralekha.h:49
uint32_t bpp
Definition chitralekha.h:44