Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/bug867259 into
lp:zorba.
Commit message:
Added tutorial to documentation
Requested reviews:
William Candillon (wcandillon)
Related bugs:
Bug #867259 in Zorba: Update Image tutorial
https://bugs.launchpad.net/zorba/+bug/867259
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug867259/+merge/160515
Added tutorial to documentation
--
https://code.launchpad.net/~zorba-coders/zorba/bug867259/+merge/160515
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'doc/zorba/indexpage.dox.in'
--- doc/zorba/indexpage.dox.in 2013-02-07 17:24:36 +
+++ doc/zorba/indexpage.dox.in 2013-04-23 22:24:25 +
@@ -62,4 +62,5 @@
\section tutorials Tutorials
- \ref web_crawler_tutorial
+ - \ref image_processing_tutorial
*/
=== added file 'doc/zorba/tut_image.dox'
--- doc/zorba/tut_image.dox 1970-01-01 00:00:00 +
+++ doc/zorba/tut_image.dox 2013-04-23 22:24:25 +
@@ -0,0 +1,222 @@
+/**
+\page image_processing_tutorial Image Processing with Zorba
+
+\section image_proc Image Representation And Formats
+
+\subsection images Images
+
+Images are passed to the functions of the imaging library as xs:base64Binary types and
+any function returning an image will return it as xs:base64Binary type. For example,
+images read by the Zorba file module are already returned as xs:base64Binary and are
+ready to be used. Also, images written to disk using the file module will be ordinary
+binary data if one passes \c binary as serialization option.
+
+
+\subsection image_formats Image Formats
+
+Currently, the imaging library supports the following popular image formats: GIF, JPEG, TIFF, PNG and SVG.
+If any other format is needed, please contact us and we will see if it is possible to support the format.
+
+\subsection functions Functions
+
+All functions provided by the image library are functional and will either return the right value
+or raise an error. The library additionally offers interfaces with schema types in the function
+signatures (\c basicschema.xq, \c manipulationschema.xq, \c paintschema.xq, \c animationschema.xq) which can
+be used to directly validate certain types (e.g. color strings).
+
+
+\subsection colors Colors
+
+Colors are represented as strings in the same way they are used in html. A leading '#' character
+with 6 hexadecimal numbers following for red, green and blue values.
+
+Examples are:
+- Black: #00
+- Red: #FF0
+- Green: #00FF00
+- Blue: #FF
+
+\subsection modules Modules
+
+Zorba provides the following four modules for image processing:
+
+- a href=/html/modules/zorba/image/basichttp://www.zorba-xquery.com/modules/image/basic/a which is concerned with accessing basic image attributes, creating new images and converting their format.
+- a href=/html/modules/zorba/image/manipulationhttp://www.zorba-xquery.com/modules/image/manipulation/a which is concerned with image manipulations like zooming, special effects etc.
+- a href=/html/modules/zorba/image/painthttp://www.zorba-xquery.com/modules/image/paint/a which is concerned with drawing different geometrical shapes and text to images.
+- a href=/html/modules/zorba/image/manipulationhttp://www.zorba-xquery.com/modules/image/animation/a which is concerned with creating animated GIF images.
+
+This tutorial contains a small example for each of the modules.
+
+
+\section basic_imaging_functions Basic Imaging Functions
+
+\subsection creating_an_image Creating An Image
+
+In this example, we create a new image and return the width and type (image format) of the newly created image.
+
+\code
+import module namespace basic = http://www.zorba-xquery.com/modules/image/basic;;
+
+let $new-image as xs:base64Binary := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), GIF)
+let $width := basic:width($new-image)
+let $format := basic:type($new-image)
+return ($width, $format)
+\endcode
+
+
+\subsection explanation Explanation
+
+In line 3 \c $new-image is assigned the result of the basic:create command, so \c $new-image contains
+the xs:base64Binary representation of a plain white GIF image.
+
+In line 4 we use the basic:width command with new-image as argument to get the width of the image
+and in line 5 the basic:type function to get the format which are both passed back in line 6.
+
+\subsection expected_output Expected Output
+
+\code
+?xml version=1.0 encoding=UTF-8?
+100 GIF
+\endcode
+
+\subsection accessing_efix_information Accessing Exif Information
+
+This example shows how to access the Exif information in JPEG images (also possible with TIFF images).
+
+\code
+import module namespace http = http://expath.org/ns/http-client;;
+import module namespace basic = http://www.zorba-xquery.com/modules/image/basic;;
+declare namespace h = http://expath.org/ns/http-client;;
+
+(: Get image from web :)
+let $req := h:request method=GET
+ href=http://www.zorba-xquery.com/tutorials/tutorialimages/exif.jpg;
+