78 lines
2.9 KiB
C
78 lines
2.9 KiB
C
/*
|
|
* JoeyDev
|
|
* Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
|
|
*
|
|
* This software is provided 'as-is', without any express or implied
|
|
* warranty. In no event will the authors be held liable for any damages
|
|
* arising from the use of this software.
|
|
*
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
* including commercial applications, and to alter it and redistribute it
|
|
* freely, subject to the following restrictions:
|
|
*
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
* claim that you wrote the original software. If you use this software
|
|
* in a product, an acknowledgment in the product documentation would be
|
|
* appreciated but is not required.
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
* misrepresented as being the original software.
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
*/
|
|
|
|
|
|
#ifndef DRAW_H
|
|
#define DRAW_H
|
|
|
|
|
|
#define jint16 short
|
|
#define jbool unsigned char
|
|
#define jbyte unsigned char
|
|
|
|
#define jtrue 1
|
|
#define jfalse 0
|
|
|
|
|
|
typedef struct _jlStackS {
|
|
struct _jlStackS *previous;
|
|
void *data;
|
|
} jlStackT;
|
|
|
|
typedef struct _jlColorS {
|
|
jbyte r;
|
|
jbyte g;
|
|
jbyte b;
|
|
} jlColorT;
|
|
|
|
typedef struct _jlContextS {
|
|
jbyte *_pixels;
|
|
jbyte _jlDrawColor;
|
|
jbyte _jlDrawFillColor;
|
|
jlStackT *_jlFillStackTop;
|
|
jlColorT _jlPalette[16];
|
|
} jlContextT;
|
|
|
|
|
|
jlContextT *jlContextNew(jbyte *pixels);
|
|
void jlContextDel(jlContextT **context);
|
|
|
|
void jlDrawBox(jlContextT *c, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
|
void jlDrawBoxFilled(jlContextT *c, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
|
void jlDrawCircle(jlContextT *c, jint16 x, jint16 y, jint16 radius);
|
|
void jlDrawClear(jlContextT *c);
|
|
jbyte jlDrawColorGet(jlContextT *c);
|
|
void jlDrawColorSet(jlContextT *c, jbyte index);
|
|
void jlDrawEllipse(jlContextT *c, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
|
void jlDrawFill(jlContextT *c, jint16 x, jint16 y);
|
|
void jlDrawFillTo(jlContextT *c, jint16 x, jint16 y, jbyte color);
|
|
void jlDrawLine(jlContextT *c, jint16 x1, jint16 y1, jint16 x2, jint16 y2);
|
|
jbyte jlDrawPixelGet(jlContextT *c, jint16 x, jint16 y);
|
|
void jlDrawPixelSet(jlContextT *c, jint16 x, jint16 y);
|
|
void jlPaletteDefault(jlContextT *c);
|
|
void jlPaletteSet(jlContextT *c, jbyte index, jbyte r, jbyte g, jbyte b);
|
|
#define jlUtilStackPop(c, stack) _jlUtilStackPop(c, (jlStackT **)&(stack)) // Syntatic Sugar
|
|
void *_jlUtilStackPop(jlContextT *c, jlStackT **stack);
|
|
#define jlUtilStackPush(c, stack, data) _jlUtilStackPush(c, (jlStackT **)&(stack), data, __LINE__, (char *)__FILE__) // Syntatic Sugar
|
|
void _jlUtilStackPush(jlContextT *c, jlStackT **stack, void *data, jint16 line, const char *file);
|
|
|
|
|
|
#endif // DRAW_H
|