From 93aea6a4e0d920f60743fdb89fa102595d6b0d76 Mon Sep 17 00:00:00 2001 From: Cyril Hrubis Date: Sat, 23 Mar 2013 13:47:28 +0100 Subject: [PATCH] doc: pywrap: Start gfx documentation. --- doc/Makefile | 2 +- doc/asciidoc.conf | 1 + doc/core_python.txt | 1 + doc/gfx_python.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 doc/gfx_python.txt diff --git a/doc/Makefile b/doc/Makefile index cb892bfe..4537bf93 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -5,7 +5,7 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt \ get_put_pixel.txt blits.txt progress_callback.txt text_api.txt \ event_queue.txt -SOURCES+=core_python.txt +SOURCES+=core_python.txt gfx_python.txt EXAMPLE_SOURCES=$(wildcard example_*.txt) diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf index 72418b7a..8ce8d857 100644 --- a/doc/asciidoc.conf +++ b/doc/asciidoc.conf @@ -59,6 +59,7 @@ endif::disable-javascript[]

Python bindings

diff --git a/doc/core_python.txt b/doc/core_python.txt index fe295cb5..3e7256f0 100644 --- a/doc/core_python.txt +++ b/doc/core_python.txt @@ -95,6 +95,7 @@ Blit is clipped. TIP: See link:example_py_showimage.html[example] Blit usage. +[[Colors_and_Pixels]] Colors and Pixels ~~~~~~~~~~~~~~~~~ diff --git a/doc/gfx_python.txt b/doc/gfx_python.txt new file mode 100644 index 00000000..28f8899d --- /dev/null +++ b/doc/gfx_python.txt @@ -0,0 +1,48 @@ +Python GFX module +----------------- + +The python binding maps mostly to the C API with the 'GP_' prefix stripped. + +The gfx module adds methods to the gfx context submodule. + +NOTE: You may want to see the link:coordinate_system.html[coordinate system] + first. + +Drawing functions +~~~~~~~~~~~~~~~~~ + +All drawing functions takes a 'pixel' value (to describe color) which +link:core_python.html#Colors_and_Pixels[can be obtained], for a particular +pixel type (context), from a RGB triplet. + +All drawing functions are clipped. Drawing outside of a context is no-op. + +[source,python] +------------------------------------------------------------------------------- +import gfxprim.gfx as gfx + + context.gfx.Fill(pixel) + +------------------------------------------------------------------------------- + +Fills context with particualr 'pixel' value. + +[source,python] +------------------------------------------------------------------------------- +import gfxprim.gfx as gfx + + context.gfx.HLine(x0, x1, y, pixel) +------------------------------------------------------------------------------- + +Draws a horizontal line from 'x0' to 'x1' at 'y'. + +[source,python] +------------------------------------------------------------------------------- +import gfxprim.gfx as gfx + + context.gfx.VLine(x, y0, y1, pixel) +------------------------------------------------------------------------------- + +Draws a vertical line from 'y0' to 'y1' at 'x'. + + -- 2.11.4.GIT