Add blank classes for DoJa graphics3d.
[SquirrelJME.git] / nanocoat / include / sjme / gfx.h
blobe678056208ce3c008a36d83b6398de619a338a1b
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 /**
11 * Graphics drawing operations.
13 * @since 2023/11/24
16 #ifndef SQUIRRELJME_GFX_H
17 #define SQUIRRELJME_GFX_H
19 #include "sjme/nvm/nvm.h"
20 #include "sjme/gfxConst.h"
22 /* Anti-C++. */
23 #ifdef __cplusplus
24 #ifndef SJME_CXX_IS_EXTERNED
25 #define SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_SQUIRRELJME_GFX_H
27 extern "C" {
28 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
29 #endif /* #ifdef __cplusplus */
31 /*--------------------------------------------------------------------------*/
33 /**
34 * Frame buffer related storage and information within SquirrelJME, this must
35 * be compatible with @c PencilShelf in SquirrelJME.
37 * @since 2023/11/24
39 typedef struct sjme_gfx_framebuffer sjme_gfx_framebuffer;
41 /**
42 * Stores the state of a renderer within the framebuffer.
44 * @since 2023/11/24
46 typedef struct sjme_gfx_graphics sjme_gfx_graphics;
48 /**
49 * Obtains a graphics drawing instance of the framebuffer.
51 * @param framebuffer The framebuffer to get the graphics from.
52 * @param inOutGraphics The output graphics to initialize into.
53 * @param pixelFormat The @c sjme_gfx_pixelFormat used for the draw.
54 * @param bufferWidth The buffer width, this is the scanline width of the
55 * buffer.
56 * @param bufferHeight The buffer height.
57 * @param buffer The target buffer to draw to, this is cast to the correct
58 * buffer format.
59 * @param offset The offset to the start of the buffer.
60 * @param palette The color palette, may be @c NULL.
61 * @param surfaceX Starting surface X coordinate.
62 * @param surfaceY Starting surface Y coordinate.
63 * @param surfaceWidth Surface width.
64 * @param surfaceHeight Surface height.
65 * @return Returns @c SJME_JNI_TRUE on success.
66 * @since 2023/11/24
68 typedef sjme_jboolean (*sjme_gfx_getGraphics)(
69 sjme_attrInNotNull sjme_gfx_framebuffer* framebuffer,
70 sjme_attrInOutNotNull sjme_gfx_graphics* inOutGraphics,
71 sjme_attrInRange(0, SJME_NUM_GFX_PIXEL_FORMATS)
72 sjme_gfx_pixelFormat pixelFormat,
73 sjme_attrInPositiveNonZero sjme_jint bufferWidth,
74 sjme_attrInPositiveNonZero sjme_jint bufferHeight,
75 sjme_attrInNotNull sjme_pointer buffer,
76 sjme_attrInPositive sjme_jint offset,
77 sjme_attrInNullable sjme_pointer palette,
78 sjme_attrInValue sjme_jint surfaceX,
79 sjme_attrInValue sjme_jint surfaceY,
80 sjme_attrInPositiveNonZero sjme_jint surfaceWidth,
81 sjme_attrInPositiveNonZero sjme_jint surfaceHeight);
83 /**
84 * Functions for drawing in a given graphics accordingly.
86 * @since 2023/11/24
88 typedef struct sjme_gfx_pencilFunctions
90 /** TODO. */
91 sjme_jint todo;
92 } sjme_gfx_pencilFunctions;
94 struct sjme_gfx_graphics
96 /** The framebuffer this state draws into */
97 sjme_gfx_framebuffer* framebuffer;
99 /** The pixel format used. */
100 sjme_gfx_pixelFormat pixelFormat;
102 /** Pencil functions for this graphics. */
103 sjme_gfx_pencilFunctions pencilFunctions;
106 struct sjme_gfx_framebuffer
108 /** The pointer to the framebuffer data, may be @c NULL if opaque. */
109 sjme_pointer pixels;
111 /** The width of the framebuffer in pixels. */
112 sjme_jint width;
114 /** The height of the framebuffer in pixels. */
115 sjme_jint height;
117 /** The scanline length of the framebuffer in pixels. */
118 sjme_jint pitch;
120 /** The true scanline length of the framebuffer in bytes. */
121 sjme_jint pitchBytes;
123 /** Function to get a graphics drawing instance for this framebuffer. */
124 sjme_gfx_getGraphics getGraphics;
126 /** If the framebuffer is allocated extra here, this has room for it. */
127 sjme_jubyte rawReservedBuffer[sjme_flexibleArrayCount];
130 /*--------------------------------------------------------------------------*/
132 /* Anti-C++. */
133 #ifdef __cplusplus
134 #ifdef SJME_CXX_SQUIRRELJME_GFX_H
136 #undef SJME_CXX_SQUIRRELJME_GFX_H
137 #undef SJME_CXX_IS_EXTERNED
138 #endif /* #ifdef SJME_CXX_SQUIRRELJME_GFX_H */
139 #endif /* #ifdef __cplusplus */
141 #endif /* SQUIRRELJME_GFX_H */