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 66cbe1a3b25ba7d4c3361d420fa9de364c02557e (commit)
from 446922190513e6535202e8f45ab897bc622390ee (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/66cbe1a3b25ba7d4c3361d420fa9de364c02…
commit 66cbe1a3b25ba7d4c3361d420fa9de364c02557e
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sun Jan 22 19:46:51 2012 +0100
First implementation of partial ellipse (plus some angle-related utils).
diff --git a/include/core/GP_AngleUtils.h b/include/core/GP_AngleUtils.h
new file mode 100644
index 0000000..f896b37
--- /dev/null
+++ b/include/core/GP_AngleUtils.h
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * 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-2011 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (c) 2012 Jiri Dluhos <jiri.bluebear.dluhos(a)gmail.com> *
+ * *
+ *****************************************************************************/
+
+#ifndef GP_ANGLE_UTILS_H
+#define GP_ANGLE_UTILS_H
+
+double GP_NormalizeAngle(double phi);
+int GP_AngleInRange(double angle, double start, double end);
+
+#endif
No newline at end of file
diff --git a/libs/core/GP_AngleUtils.c b/libs/core/GP_AngleUtils.c
new file mode 100644
index 0000000..f1c279b
--- /dev/null
+++ b/libs/core/GP_AngleUtils.c
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * 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) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
+ * Copyright (C) 2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2012 Jiri Dluhos <jiri.bluebear.dluhos(a)gmail.com> *
+ * *
+ *****************************************************************************/
+
+#include "GP_AngleUtils.h"
+
+#include <math.h>
+
+double GP_NormalizeAngle(double phi)
+{
+ // clamp angle to <-2*pi, 2*pi>
+ double phi2 = fmod(phi, 2*M_PI);
+
+ // clamp angle to <0, 2*pi>
+ if (phi2 < 0)
+ phi2 += 2*M_PI;
+
+ return phi2;
+}
+
+int GP_AngleInRange(double angle, double start, double end)
+{
+ if (start < end) {
+ return (angle >= start && angle <= end);
+ } else {
+ return (angle >= start && angle <= 2*M_PI)
+ || (angle >= 0 && angle <= end);
+ }
+}
No newline at end of file
diff --git a/libs/gfx/GP_PartialEllipse.c b/libs/gfx/GP_PartialEllipse.c
new file mode 100644
index 0000000..5415a58
--- /dev/null
+++ b/libs/gfx/GP_PartialEllipse.c
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * 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-2012 Jiri "BlueBear" Dluhos *
+ * <jiri.bluebear.dluhos(a)gmail.com> *
+ * *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include "GP_Gfx.h"
+#include "core/GP_FnPerBpp.h"
+
+#include "algo/PartialEllipse.algo.h"
+
+/* Generate drawing functions for various bit depths. */
+GP_DEF_DRAW_FN_PER_BPP(GP_PartialEllipse_Raw, DEF_PARTIAL_ELLIPSE_FN)
+
+void GP_PartialEllipse_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size a, GP_Size b, int start, int end, GP_Pixel pixel)
+{
+ GP_CHECK_CONTEXT(context);
+
+ GP_FN_PER_BPP_CONTEXT(GP_PartialEllipse_Raw, context, context,
+ xcenter, ycenter, a, b, start, end, pixel);
+}
+
+void GP_PartialEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size a, GP_Size b, int start, int end, GP_Pixel pixel)
+{
+ GP_CHECK_CONTEXT(context);
+
+ /* recalculate center point and swap a and b when axes are swapped */
+ GP_TRANSFORM_POINT(context, xcenter, ycenter);
+ GP_TRANSFORM_SWAP(context, a, b);
+
+ GP_PartialEllipse_Raw(context, xcenter, ycenter, a, b, start, end, pixel);
+}
No newline at end of file
diff --git a/libs/gfx/algo/PartialEllipse.algo.h b/libs/gfx/algo/PartialEllipse.algo.h
new file mode 100644
index 0000000..b87826e
--- /dev/null
+++ b/libs/gfx/algo/PartialEllipse.algo.h
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * 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(a)gmail.com> *
+ * *
+ * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include "core/GP_AngleUtils.h"
+
+#include <math.h>
+
+/*
+ * This macro defines a partial ellipse drawing function.
+ * Arguments:
+ * CONTEXT_T - user-defined type of drawing context (passed to PUTPIXEL)
+ * PIXVAL_T - user-defined pixel value type (passed to PUTPIXEL)
+ * PUTPIXEL - a pixel drawing function f(context, x, y, pixval)
+ * FN_NAME - name of the function to be defined
+ */
+#define DEF_PARTIAL_ELLIPSE_FN(FN_NAME, CONTEXT_T, PIXVAL_T, PUTPIXEL) +void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, int a, int b, + int start, int end, PIXVAL_T pixval) +{ + double startAngle = GP_NormalizeAngle(2*M_PI*(start / 360000.0)); + double endAngle = GP_NormalizeAngle(2*M_PI*(end / 360000.0)); ++ int x; + for (x = -a; x <= a; x++) { + double angle = acos(((double) x) / a); + double y = floor(b*sin(angle)); + if (GP_AngleInRange(angle, startAngle, endAngle)) { + PUTPIXEL(context, xcenter+x, ycenter-y, pixval); + } + if (GP_AngleInRange(2*M_PI - angle, startAngle, endAngle)) { + PUTPIXEL(context, xcenter+x, ycenter+y, pixval); + } + } ++ int y; + for (y = -b; y <= b; y++) { + double angle = asin(((double) y) / b); + double x = floor(a*cos(angle)); + if (GP_AngleInRange(angle, startAngle, endAngle)) { + PUTPIXEL(context, xcenter+x, ycenter-y, pixval); + } + if (GP_AngleInRange(M_PI - angle, startAngle, endAngle)) { + PUTPIXEL(context, x
center-x, ycenter-y, pixval); + } + } +}
No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
.../GP_DefaultFont.h => core/GP_AngleUtils.h} | 14 ++--
libs/core/{GP_GetPutPixel.c => GP_AngleUtils.c} | 38 ++++++-----
libs/gfx/{GP_Arc.c => GP_PartialEllipse.c} | 34 ++++------
.../algo/{Line.algo.h => PartialEllipse.algo.h} | 72 ++++++++------------
4 files changed, 69 insertions(+), 89 deletions(-)
copy include/{text/GP_DefaultFont.h => core/GP_AngleUtils.h} (87%)
copy libs/core/{GP_GetPutPixel.c => GP_AngleUtils.c} (74%)
copy libs/gfx/{GP_Arc.c => GP_PartialEllipse.c} (73%)
copy libs/gfx/algo/{Line.algo.h => PartialEllipse.algo.h} (66%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 446922190513e6535202e8f45ab897bc622390ee (commit)
from 09241d96413a6376d399b4e81219fdf2d9fb1462 (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/446922190513e6535202e8f45ab897bc6223…
commit 446922190513e6535202e8f45ab897bc622390ee
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jan 22 19:05:00 2012 +0100
filters: Blur fix row/column prefill.
diff --git a/libs/filters/GP_Linear.c b/libs/filters/GP_Linear.c
index 447e805..a55d1fe 100644
--- a/libs/filters/GP_Linear.c
+++ b/libs/filters/GP_Linear.c
@@ -154,7 +154,7 @@ int GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *dst,
GP_Coord x, y;
uint32_t i;
int32_t ikernel[kw];
- uint32_t size = dst->w + kw;
+ uint32_t size = dst->w + kw - 1;
for (i = 0; i < kw; i++)
ikernel[i] = kernel[i] * MUL + 0.5;
@@ -179,15 +179,15 @@ int GP_FilterHLinearConvolution_Raw(const GP_Context *src, GP_Context *dst,
B[i] = GP_Pixel_GET_B_RGB888(pix);
}
- for (i = kw/2; i < src->w; i++) {
+ for (i = 0; i < src->w; i++) {
pix = GP_GetPixel_Raw_24BPP(src, i, y);
- R[i] = GP_Pixel_GET_R_RGB888(pix);
- G[i] = GP_Pixel_GET_G_RGB888(pix);
- B[i] = GP_Pixel_GET_B_RGB888(pix);
+ R[i+kw/2] = GP_Pixel_GET_R_RGB888(pix);
+ G[i+kw/2] = GP_Pixel_GET_G_RGB888(pix);
+ B[i+kw/2] = GP_Pixel_GET_B_RGB888(pix);
}
- for (i = src->w; i < size; i++) {
+ for (i = src->w + kw/2; i < size; i++) {
R[i] = GP_Pixel_GET_R_RGB888(pix);
G[i] = GP_Pixel_GET_G_RGB888(pix);
B[i] = GP_Pixel_GET_B_RGB888(pix);
@@ -233,7 +233,7 @@ int GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *dst,
GP_Coord x, y;
uint32_t i;
int32_t ikernel[kh];
- uint32_t size = dst->h + kh;
+ uint32_t size = dst->h + kh - 1;
for (i = 0; i < kh; i++)
ikernel[i] = kernel[i] * MUL + 0.5;
@@ -258,15 +258,15 @@ int GP_FilterVLinearConvolution_Raw(const GP_Context *src, GP_Context *dst,
B[i] = GP_Pixel_GET_B_RGB888(pix);
}
- for (i = kh/2; i < src->h; i++) {
+ for (i = 0; i < src->h; i++) {
pix = GP_GetPixel_Raw_24BPP(src, x, i);
- R[i] = GP_Pixel_GET_R_RGB888(pix);
- G[i] = GP_Pixel_GET_G_RGB888(pix);
- B[i] = GP_Pixel_GET_B_RGB888(pix);
+ R[i+kh/2] = GP_Pixel_GET_R_RGB888(pix);
+ G[i+kh/2] = GP_Pixel_GET_G_RGB888(pix);
+ B[i+kh/2] = GP_Pixel_GET_B_RGB888(pix);
}
- for (i = src->h; i < size; i++) {
+ for (i = src->h + kh/2; i < size; i++) {
R[i] = GP_Pixel_GET_R_RGB888(pix);
G[i] = GP_Pixel_GET_G_RGB888(pix);
B[i] = GP_Pixel_GET_B_RGB888(pix);
-----------------------------------------------------------------------
Summary of changes:
libs/filters/GP_Linear.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 d093866437ca8adc100d6bc2a40011a26c26e813 (commit)
from c5d3e2a62fabfd142f86d47f51e313680d363ea3 (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/d093866437ca8adc100d6bc2a40011a26c26…
commit d093866437ca8adc100d6bc2a40011a26c26e813
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Jan 21 22:23:24 2012 +0100
demos: fbshow add missing -lrt.
diff --git a/demos/fbshow/Makefile b/demos/fbshow/Makefile
index 74d83fb..c5acfc4 100644
--- a/demos/fbshow/Makefile
+++ b/demos/fbshow/Makefile
@@ -4,7 +4,7 @@ CSOURCES=$(shell echo *.c)
INCLUDE=
CFLAGS+=-pthread
-LDFLAGS+=-pthread
+LDFLAGS+=-pthread -lrt
LDLIBS+=-lGP -lGP_backends -lSDL -L$(TOPDIR)/build/
APPS=fbshow
-----------------------------------------------------------------------
Summary of changes:
demos/fbshow/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")