From 923ee620ce7cc8acf847c29b9da82ba5899ae520 Mon Sep 17 00:00:00 2001 From: Cyril Hrubis Date: Mon, 13 Feb 2012 14:44:05 +0100 Subject: [PATCH] gfx: Added header for Anti Aliased line, finally. --- include/gfx/GP_Gfx.h | 3 +- include/gfx/{GP_Gfx.h => GP_LineAA.h} | 54 ++++++++++++-------------- include/gfx/GP_Gfx.h => libs/gfx/GP_LineAA.c | 57 ++++++++++++---------------- 3 files changed, 51 insertions(+), 63 deletions(-) copy include/gfx/{GP_Gfx.h => GP_LineAA.h} (65%) copy include/gfx/GP_Gfx.h => libs/gfx/GP_LineAA.c (72%) diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h index acc5fd2b..6c2b8f60 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_Gfx.h @@ -52,7 +52,8 @@ #include "GP_Polygon.h" #include "GP_Symbol.h" -#include "GP_RectAA.h" #include "GP_PutPixelAA.h" +#include "GP_LineAA.h" +#include "GP_RectAA.h" #endif /* GP_GFX_H */ diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_LineAA.h similarity index 65% copy from include/gfx/GP_Gfx.h copy to include/gfx/GP_LineAA.h index acc5fd2b..34ec0285 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_LineAA.h @@ -16,43 +16,37 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * * - * * - * Copyright (C) 2009-2011 Cyril Hrubis * + * Copyright (C) 2012 Cyril Hrubis * * * *****************************************************************************/ /* + + Anti Aliased line. - This is a main header for gfx part. + The coordinates are in XX.8 fixed point format, see core/GP_FixedPoint.h + for helper macros. + + For RGB contexts gamma correction tables are used to generate correct + intensity for pixels. */ -#ifndef GP_GFX_H -#define GP_GFX_H +#ifndef GFX_GP_LINE_AA_H +#define GFX_GP_LINE_AA_H -/* basic definitions and structures */ #include "core/GP_Context.h" -#include "core/GP_GetPutPixel.h" -#include "core/GP_WritePixel.h" - -/* public drawing API */ -#include "GP_Fill.h" -#include "GP_HLine.h" -#include "GP_VLine.h" -#include "GP_Line.h" -#include "GP_Rect.h" -#include "GP_Triangle.h" -#include "GP_Tetragon.h" -#include "GP_Circle.h" -#include "GP_CircleSeg.h" -#include "GP_Ellipse.h" -#include "GP_Arc.h" -#include "GP_Polygon.h" -#include "GP_Symbol.h" - -#include "GP_RectAA.h" -#include "GP_PutPixelAA.h" - -#endif /* GP_GFX_H */ + +/* + * Anti Aliased Line respecting context rotation flags and with clipping. + */ +void GP_LineAA(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +/* + * Line without contect rotation flags. + */ +void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +#endif /* GFX_GP_LINE_AA_H */ diff --git a/include/gfx/GP_Gfx.h b/libs/gfx/GP_LineAA.c similarity index 72% copy from include/gfx/GP_Gfx.h copy to libs/gfx/GP_LineAA.c index acc5fd2b..6d30df0d 100644 --- a/include/gfx/GP_Gfx.h +++ b/libs/gfx/GP_LineAA.c @@ -19,40 +19,33 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * * * * - * Copyright (C) 2009-2011 Cyril Hrubis * + * Copyright (C) 2009-2012 Cyril Hrubis * * * *****************************************************************************/ -/* - - This is a main header for gfx part. - - */ - -#ifndef GP_GFX_H -#define GP_GFX_H +#include "core/GP_Transform.h" +#include "core/GP_FnPerBpp.h" -/* basic definitions and structures */ -#include "core/GP_Context.h" -#include "core/GP_GetPutPixel.h" -#include "core/GP_WritePixel.h" +#include "gfx/GP_LineAA.h" -/* public drawing API */ -#include "GP_Fill.h" -#include "GP_HLine.h" -#include "GP_VLine.h" -#include "GP_Line.h" -#include "GP_Rect.h" -#include "GP_Triangle.h" -#include "GP_Tetragon.h" -#include "GP_Circle.h" -#include "GP_CircleSeg.h" -#include "GP_Ellipse.h" -#include "GP_Arc.h" -#include "GP_Polygon.h" -#include "GP_Symbol.h" - -#include "GP_RectAA.h" -#include "GP_PutPixelAA.h" - -#endif /* GP_GFX_H */ +/* +void GP_Line_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_FN_PER_BPP_CONTEXT(GP_Line_Raw, context, context, x0, y0, x1, y1, + pixel); +} +*/ + +void GP_LineAA(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT_FP(context, x0, y0); + GP_TRANSFORM_POINT_FP(context, x1, y1); + + GP_LineAA_Raw(context, x0, y0, x1, y1, pixel); +} -- 2.11.4.GIT