summaryrefslogtreecommitdiff
path: root/meme/gaux.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-02-14 20:38:28 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-02-14 20:38:28 (GMT)
commit5551daea48a8e1363e67a2a77de7b6b9c0acfa14 (patch)
tree68e884d89c2fe4d4f65e1d9ced1484139bf3811b /meme/gaux.c
parent929702e4c0dbacdd0874a789b632044cc80dfd81 (diff)
downloadmisc-5551daea48a8e1363e67a2a77de7b6b9c0acfa14.zip
misc-5551daea48a8e1363e67a2a77de7b6b9c0acfa14.tar.gz
misc-5551daea48a8e1363e67a2a77de7b6b9c0acfa14.tar.bz2
meme/: use adaptive outline instead of rectangle for marker text
Diffstat (limited to 'meme/gaux.c')
-rw-r--r--meme/gaux.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/meme/gaux.c b/meme/gaux.c
index 9295448..272c64b 100644
--- a/meme/gaux.c
+++ b/meme/gaux.c
@@ -1,8 +1,8 @@
/*
* gaux.c - Auxiliary graphics functions
*
- * Written 2014 by Werner Almesberger
- * Copyright 2014 Werner Almesberger
+ * Written 2014, 2016 by Werner Almesberger
+ * Copyright 2014, 2016 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,3 +22,18 @@ SDL_Surface *sdl_surface(Uint32 flags, int width, int height)
return SDL_CreateRGBSurface(flags, width, height,
fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask);
}
+
+
+/*
+ * Loosely based on
+ * https://forums.libsdl.org/viewtopic.php?t=3653&sid=964c840d9a6461f79e00ccd745da6c1c
+ */
+
+Uint32 get_pixel(const SDL_Surface *s, Sint16 x, Sint16 y, Uint32 null)
+{
+ if (x < 0 || y < 0)
+ return null;
+ if (x >= s->w || y >= s->h)
+ return null;
+ return ((Uint32 *) s->pixels)[y * (s->pitch / sizeof(Uint32)) + x];
+}