This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via b0f09bfef85c7a22ed6feba890e085634a6517e2 (commit) via e72092bb7d6f87d5d739cc1697da79cd69c6a2a7 (commit) from 50ac1f21f85e66b3d2a8a0a6047971c474c250a4 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/b0f09bfef85c7a22ed6feba890e085634a651...
commit b0f09bfef85c7a22ed6feba890e085634a6517e2 Author: BlueBear jiri.bluebear.dluhos@gmail.com Date: Sat May 7 19:35:10 2011 +0200
Filled triangles are now drawn with polygons.
diff --git a/core/GP.h b/core/GP.h index 1be9710..9600772 100644 --- a/core/GP.h +++ b/core/GP.h @@ -51,7 +51,6 @@ #include "GP_Rect.h" #include "GP_FillRect.h" #include "GP_Triangle.h" -#include "GP_FillTriangle.h" #include "GP_Tetragon.h" #include "GP_FillTetragon.h" #include "GP_Circle.h" diff --git a/core/GP_FillTriangle.c b/core/GP_FillTriangle.c deleted file mode 100644 index 3b483d6..0000000 --- a/core/GP_FillTriangle.c +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include "GP.h" -#include "GP_FnPerBpp.h" -#include "algo/FillTriangle.algo.h" - -#include <math.h> -#include <stdlib.h> - -/* Generate drawing functions for various bit depths. */ -DEF_FILLTRIANGLE_FN(GP_FillTriangle1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp, GP_PutPixel1bpp) -DEF_FILLTRIANGLE_FN(GP_FillTriangle2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp, GP_PutPixel2bpp) -DEF_FILLTRIANGLE_FN(GP_FillTriangle4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp, GP_PutPixel4bpp) -DEF_FILLTRIANGLE_FN(GP_FillTriangle8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp, GP_PutPixel8bpp) -DEF_FILLTRIANGLE_FN(GP_FillTriangle16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp, GP_PutPixel16bpp) -DEF_FILLTRIANGLE_FN(GP_FillTriangle24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp, GP_PutPixel24bpp) -DEF_FILLTRIANGLE_FN(GP_FillTriangle32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp, GP_PutPixel32bpp) - -void GP_FillTriangle(GP_Context * context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_FN_PER_BPP(GP_FillTriangle, context, x0, y0, x1, y1, x2, y2, pixel); -} - -void GP_TFillTriangle(GP_Context* context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_TRANSFORM_POINT(context, x0, y0); - GP_TRANSFORM_POINT(context, x1, y1); - GP_TRANSFORM_POINT(context, x2, y2); - - GP_FillTriangle(context, x0, y0, x1, y1, x2, y2, pixel); -} diff --git a/core/GP_FillTriangle.h b/core/GP_FillTriangle.h deleted file mode 100644 index 11e0b4f..0000000 --- a/core/GP_FillTriangle.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#ifndef GP_FILLTRIANGLE_H -#define GP_FILLTRIANGLE_H - -#include "GP_Context.h" -#include "GP_Common.h" - -void GP_FillTriangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel); - -void GP_TFillTriangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel); - -#endif /* GP_FILLTRIANGLE_H */ diff --git a/core/GP_Triangle.c b/core/GP_Triangle.c index 82caa55..4734617 100644 --- a/core/GP_Triangle.c +++ b/core/GP_Triangle.c @@ -46,3 +46,25 @@ void GP_TTriangle(GP_Context *context, int x0, int y0, int x1, int y1,
GP_Triangle(context, x0, y0, x1, y1, x2, y2, pixel); } + +void GP_FillTriangle(GP_Context * context, int x0, int y0, int x1, int y1, + int x2, int y2, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + int coords[6] = { x0, y0, x1, y1, x2, y2 }; + GP_FillPolygon(context, 3, &coords, pixel); +} + +void GP_TFillTriangle(GP_Context* context, int x0, int y0, int x1, int y1, + int x2, int y2, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT(context, x0, y0); + GP_TRANSFORM_POINT(context, x1, y1); + GP_TRANSFORM_POINT(context, x2, y2); + + int coords[6] = { x0, y0, x1, y1, x2, y2 }; + GP_FillPolygon(context, 3, &coords, pixel); +} diff --git a/core/GP_Triangle.h b/core/GP_Triangle.h index 3684b11..4bc5523 100644 --- a/core/GP_Triangle.h +++ b/core/GP_Triangle.h @@ -34,4 +34,10 @@ void GP_Triangle(GP_Context *context, int x0, int y0, int x1, int y1, void GP_TTriangle(GP_Context *context, int x0, int y0, int x1, int y1, int x2, int y2, GP_Pixel pixel);
+void GP_FillTriangle(GP_Context *context, int x0, int y0, int x1, int y1, + int x2, int y2, GP_Pixel pixel); + +void GP_TFillTriangle(GP_Context *context, int x0, int y0, int x1, int y1, + int x2, int y2, GP_Pixel pixel); + #endif /* GP_TRIANGLE_H */
http://repo.or.cz/w/gfxprim.git/commit/e72092bb7d6f87d5d739cc1697da79cd69c6a...
commit e72092bb7d6f87d5d739cc1697da79cd69c6a2a7 Author: BlueBear jiri.bluebear.dluhos@gmail.com Date: Sat May 7 19:33:59 2011 +0200
Multicolored sierpinsky to aid visual analysis.
diff --git a/targets/sdl/tests/sierpinsky.c b/targets/sdl/tests/sierpinsky.c index d9411ee..99fc99a 100644 --- a/targets/sdl/tests/sierpinsky.c +++ b/targets/sdl/tests/sierpinsky.c @@ -47,14 +47,19 @@ SDL_TimerID timer;
int iter, l, way = 1;
-GP_Pixel black, blue, gray; +GP_Pixel black, blue, gray, red;
-static void sierpinsky(SDL_Surface *surf, GP_Pixel pixel, float x1, float y1, float x4, float y4, int iter) +int draw_edge = 1; + +static void sierpinsky(SDL_Surface *surf, double x1, double y1, double x4, double y4, int iter) { - float x2, y2, x3, y3, x5, y5; + double x2, y2, x3, y3, x5, y5; + GP_Pixel pixel; + GP_RGBToPixel(&context, 0, 0, 255-16*iter, &pixel); if (iter <= 0) { - GP_Line(&context, x1, y1, x4, y4, black); + if (draw_edge) + GP_Line(&context, x1, y1, x4, y4, black); return; }
@@ -69,15 +74,19 @@ static void sierpinsky(SDL_Surface *surf, GP_Pixel pixel, float x1, float y1, fl
GP_FillTriangle(&context, x2, y2, x3, y3, x5, y5, pixel);
- sierpinsky(surf, pixel, x1, y1, x2, y2, iter - 1); - sierpinsky(surf, pixel, x2, y2, x5, y5, iter - 1); - sierpinsky(surf, pixel, x5, y5, x3, y3, iter - 1); - sierpinsky(surf, pixel, x3, y3, x4, y4, iter - 1); + GP_PutPixel(&context, x2, y2, red); + GP_PutPixel(&context, x3, y3, red); + GP_PutPixel(&context, x5, y5, red); + + sierpinsky(surf, x1, y1, x2, y2, iter - 1); + sierpinsky(surf, x2, y2, x5, y5, iter - 1); + sierpinsky(surf, x5, y5, x3, y3, iter - 1); + sierpinsky(surf, x3, y3, x4, y4, iter - 1); }
static void draw(SDL_Surface *surf, int x, int y, int l, int iter) { - float x1, y1, x2, y2, x3, y3; + double x1, y1, x2, y2, x3, y3; int w = surf->w; int h = surf->h;
@@ -96,9 +105,9 @@ static void draw(SDL_Surface *surf, int x, int y, int l, int iter)
GP_FillTriangle(&context, x1, y1, x2, y2, x3, y3, blue);
- sierpinsky(surf, blue, x1, y1, x2, y2, iter/60%6); - sierpinsky(surf, blue, x2, y2, x3, y3, iter/60%6); - sierpinsky(surf, blue, x3, y3, x1, y1, iter/60%6); + sierpinsky(surf, x1, y1, x2, y2, iter/60%6); + sierpinsky(surf, x2, y2, x3, y3, iter/60%6); + sierpinsky(surf, x3, y3, x1, y1, iter/60%6); SDL_UpdateRect(surf, 0, 0, surf->w, surf->h); } @@ -142,6 +151,7 @@ int main(void) GP_ColorNameToPixel(&context, GP_COL_BLACK, &black); GP_ColorNameToPixel(&context, GP_COL_BLUE, &blue); GP_ColorNameToPixel(&context, GP_COL_GRAY_LIGHT, &gray); + GP_ColorNameToPixel(&context, GP_COL_RED, &red);
iter = 0; draw(display, display->w/2, display->h/2, l, iter); @@ -160,6 +170,9 @@ int main(void) case SDLK_p: paused = !paused; break; + case SDLK_e: + draw_edge = !draw_edge; + break; case SDLK_ESCAPE: SDL_Quit(); return 0;
-----------------------------------------------------------------------
Summary of changes: core/GP.h | 1 - core/GP_FillTriangle.c | 60 ---------------------------------------- core/GP_FillTriangle.h | 38 ------------------------- core/GP_Triangle.c | 22 ++++++++++++++ core/GP_Triangle.h | 6 ++++ targets/sdl/tests/sierpinsky.c | 37 ++++++++++++++++-------- 6 files changed, 53 insertions(+), 111 deletions(-) delete mode 100644 core/GP_FillTriangle.c delete mode 100644 core/GP_FillTriangle.h
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.