summaryrefslogtreecommitdiff
path: root/graphics.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-11 20:48:13 +0000
committerrodri <rgl@antares-labs.eu>2024-09-11 20:48:13 +0000
commit09ffa3cfc72a10e82c5c68f4010d1c518f0c3328 (patch)
treebe398761d4f406071417a0b021803d494aa90c11 /graphics.h
parent8806aad87f7be2d2e82c7db2b9f0978246e5a747 (diff)
downloadlibgraphics-09ffa3cfc72a10e82c5c68f4010d1c518f0c3328.tar.gz
libgraphics-09ffa3cfc72a10e82c5c68f4010d1c518f0c3328.tar.bz2
libgraphics-09ffa3cfc72a10e82c5c68f4010d1c518f0c3328.zip
change the raster format to RGBA32. draw to any image format. clean up.
got rid of the bullshit dance between XRGB32 and RGBA32, now all rasters are RGBA32 and premultiply alpha before loading up an image and drawing over the destination. this lets the user compose their own scenes with correct transparency. no more mediocre clearcolor. as a consequence drawing got slower, but if i get the turbo drawing pool working properly that should go away. textures also take alpha pre-multiplied channels into account, dividing them when sampling, so loading transparent textures will show the correct colors.
Diffstat (limited to 'graphics.h')
-rw-r--r--graphics.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/graphics.h b/graphics.h
index 3cd070f..39af008 100644
--- a/graphics.h
+++ b/graphics.h
@@ -24,8 +24,8 @@ enum {
LightSpot,
/* raster formats */
- COLOR32 = 0,
- FLOAT32,
+ COLOR32 = 0, /* RGBA32 */
+ FLOAT32, /* F32 */
/* texture formats */
RAWTexture = 0, /* unmanaged */
@@ -314,7 +314,7 @@ struct Framebufctl
void (*draw)(Framebufctl*, Image*, char*, Point, Point);
void (*memdraw)(Framebufctl*, Memimage*, char*, Point, Point);
void (*swap)(Framebufctl*);
- void (*reset)(Framebufctl*, ulong);
+ void (*reset)(Framebufctl*);
void (*createraster)(Framebufctl*, char*, ulong);
Raster *(*fetchraster)(Framebufctl*, char*);
Framebuf *(*getfb)(Framebufctl*);
@@ -350,7 +350,6 @@ struct Camera
} clip;
Matrix3 proj; /* VCS to clip space xform */
Projection projtype;
- ulong clearcolor;
int cullmode;
int enableblend;
int enabledepth;
@@ -431,14 +430,20 @@ Color samplecubemap(Cubemap*, Point3, Color(*)(Texture*, Point2));
/* util */
Point2 modulapt2(Point2, Point2);
+Point2 minpt2(Point2, Point2);
+Point2 maxpt2(Point2, Point2);
Point3 modulapt3(Point3, Point3);
+Point3 minpt3(Point3, Point3);
+Point3 maxpt3(Point3, Point3);
Memimage *rgb(ulong);
Memimage *dupmemimage(Memimage*);
/* color */
+ulong col2ul(Color);
+Color ul2col(ulong);
+int hasalpha(ulong);
Color srgb2linear(Color);
Color linear2srgb(Color);
-ulong rgba2xrgb(ulong);
Color aces(Color);
Color aces2(Color);