NeKernel dev
Loading...
Searching...
No Matches
CoreGfx.h
Go to the documentation of this file.
1/* ========================================
2
3 Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
4
5======================================== */
6
7#pragma once
8
9#include <NeKit/Config.h>
10
11#define cg_init() Kernel::UInt32 kCGCursor = 0
12
13#define cg_color(R, G, B) RGB(R, G, B)
14
15#define cg_get_clear_clr() RGB(0, 0, 0x80)
16
17#define cg_clear() kCGCursor = 0UL
18
19#ifdef __NE_AMD64__
21#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) \
22 for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
23 for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
24 *(((Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
25 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) |= \
26 (reg_ptr)[kCGCursor]; \
27 \
28 ++kCGCursor; \
29 } \
30 }
31
33#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) \
34 for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
35 for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
36 *(((Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
37 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
38 (reg_ptr)[kCGCursor]; \
39 \
40 ++kCGCursor; \
41 } \
42 }
43
44#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) \
45 for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
46 for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
47 *(((Kernel::UInt32*) (_Rgn + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
48 (reg_ptr)[kCGCursor]; \
49 \
50 ++kCGCursor; \
51 } \
52 }
53
55#define FBClearRegion(height, width, base_x, base_y) \
56 for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
57 for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
58 *(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
59 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
60 cg_get_clear_clr(); \
61 } \
62 }
63
65#define FBDrawInRegion(clr, height, width, base_x, base_y) \
66 for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) { \
67 for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) { \
68 *(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
69 4 * kHandoverHeader->f_GOP.f_PixelPerLine * x_base + \
70 4 * y_base))) = clr; \
71 } \
72 }
73
75#define FBDrawInRegionToRgn(_Rgn, clr, height, width, base_x, base_y) \
76 for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) { \
77 for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) { \
78 *(((volatile Kernel::UInt32*) (_Rgn + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * x_base + \
79 4 * y_base))) = clr[kCGCursor]; \
80 ++kCGCursor; \
81 } \
82 }
83
84#define FBDrawInRegionA(clr, height, width, base_x, base_y) \
85 for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) { \
86 for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) { \
87 *(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
88 4 * kHandoverHeader->f_GOP.f_PixelPerLine * x_base + \
89 4 * y_base))) |= clr; \
90 } \
91 }
92#else
93#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y)
94#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y)
95#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y)
96#define FBClearRegion(height, width, base_x, base_y)
97#define FBDrawInRegion(clr, height, width, base_x, base_y)
98#define FBDrawInRegionToRgn(_Rgn, clr, height, width, base_x, base_y)
99#define FBDrawInRegionA(clr, height, width, base_x, base_y)
100#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y)
101#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y)
102#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y)
103#define FBClearRegion(height, width, base_x, base_y)
104#define FBDrawInRegion(clr, height, width, base_x, base_y)
105#define FBDrawInRegionToRgn(_Rgn, clr, height, width, base_x, base_y)
106#define FBDrawInRegionA(clr, height, width, base_x, base_y)
107#endif // __NE_AMD64__
108
109#ifndef CORE_GFX_ACCESSIBILITY_H
111#endif // ifndef CORE_GFX_ACCESSIBILITY_H
112
113namespace FB {
118} // namespace FB
#define FBDrawInRegion(clr, height, width, base_x, base_y)
Definition CoreGfx.h:97
#define cg_get_clear_clr()
Definition CoreGfx.h:15
static UInt64 Height()
Definition CoreAccess.h:29
static UInt64 Width()
Definition CoreAccess.h:27
Definition CoreAccess.h:16
Void cg_clear_video()
Definition CoreGfx.h:114
void Void
Definition Config.h:87