Merge lp:~zorba-coders/zorba/update3.0_image-module into lp:zorba/image-module

Proposed by Juan Zacarias
Status: Merged
Merged at revision: 62
Proposed branch: lp:~zorba-coders/zorba/update3.0_image-module
Merge into: lp:zorba/image-module
Diff against target: 4286 lines (+1468/-855)
83 files modified
src/CMakeLists.txt (+74/-7)
src/animation.xq (+10/-10)
src/animation.xq.src/animation_module.h (+1/-1)
src/basic.xq (+29/-29)
src/basic.xq.src/basic_module.h (+1/-1)
src/com/CMakeLists.txt (+0/-17)
src/com/zorba-xquery/CMakeLists.txt (+0/-17)
src/com/zorba-xquery/www/CMakeLists.txt (+0/-17)
src/com/zorba-xquery/www/modules/CMakeLists.txt (+0/-15)
src/com/zorba-xquery/www/modules/image/CMakeLists.txt (+0/-86)
src/image.jsd (+360/-0)
src/image.xsd (+3/-3)
src/image_commons/image_function.cpp (+3/-3)
src/image_commons/image_module.h (+1/-1)
src/manipulation.xq (+112/-112)
src/manipulation.xq.src/manipulation_module.h (+1/-1)
src/paint.xq (+116/-83)
src/paint.xq.src/paint.cpp (+218/-274)
src/paint.xq.src/paint.h (+2/-3)
src/paint.xq.src/paint_module.h (+1/-1)
test/Queries/image/animation.xq (+3/-3)
test/Queries/image/animation_create.xq (+1/-1)
test/Queries/image/animation_create_morphed.xq (+1/-1)
test/Queries/image/basic.xq (+1/-1)
test/Queries/image/basic_compress.xq (+1/-1)
test/Queries/image/basic_convert.xq (+1/-1)
test/Queries/image/basic_create.xq (+1/-1)
test/Queries/image/basic_equals.xq (+1/-1)
test/Queries/image/basic_exif.xq (+1/-1)
test/Queries/image/basic_height.xq (+1/-1)
test/Queries/image/basic_svg.xq (+1/-1)
test/Queries/image/basic_type.xq (+1/-1)
test/Queries/image/basic_width.xq (+1/-1)
test/Queries/image/manipulation_1.xq (+3/-3)
test/Queries/image/manipulation_2.xq (+3/-3)
test/Queries/image/manipulation_3.xq (+3/-3)
test/Queries/image/manipulation_4.xq (+3/-3)
test/Queries/image/manipulation_5.xq (+3/-3)
test/Queries/image/manipulation_add_noise.xq (+1/-1)
test/Queries/image/manipulation_blur.xq (+1/-1)
test/Queries/image/manipulation_charcoal.xq (+1/-1)
test/Queries/image/manipulation_chop.xq (+1/-1)
test/Queries/image/manipulation_contrast.xq (+1/-1)
test/Queries/image/manipulation_crop.xq (+1/-1)
test/Queries/image/manipulation_despeckle.xq (+1/-1)
test/Queries/image/manipulation_edge.xq (+1/-1)
test/Queries/image/manipulation_emboss.xq (+1/-1)
test/Queries/image/manipulation_enhance.xq (+1/-1)
test/Queries/image/manipulation_equalize.xq (+1/-1)
test/Queries/image/manipulation_erase.xq (+1/-1)
test/Queries/image/manipulation_flip.xq (+1/-1)
test/Queries/image/manipulation_flop.xq (+1/-1)
test/Queries/image/manipulation_gamma.xq (+1/-1)
test/Queries/image/manipulation_gamma2.xq (+1/-1)
test/Queries/image/manipulation_implode.xq (+1/-1)
test/Queries/image/manipulation_oil_paint.xq (+1/-1)
test/Queries/image/manipulation_overlay.xq (+2/-2)
test/Queries/image/manipulation_reduce_noise.xq (+1/-1)
test/Queries/image/manipulation_resize.xq (+1/-1)
test/Queries/image/manipulation_rotate.xq (+1/-1)
test/Queries/image/manipulation_solarize.xq (+1/-1)
test/Queries/image/manipulation_stereo.xq (+1/-1)
test/Queries/image/manipulation_sub_image.xq (+2/-2)
test/Queries/image/manipulation_swirl.xq (+1/-1)
test/Queries/image/manipulation_transparent.xq (+1/-1)
test/Queries/image/manipulation_trim.xq (+1/-1)
test/Queries/image/manipulation_watermark.xq (+1/-1)
test/Queries/image/manipulation_zoom.xq (+1/-1)
test/Queries/image/manipulation_zoom_height.xq (+2/-2)
test/Queries/image/manipulation_zoom_width.xq (+2/-2)
test/Queries/image/paint_1.xq (+53/-12)
test/Queries/image/paint_2.xq (+40/-16)
test/Queries/image/paint_3.xq (+39/-8)
test/Queries/image/paint_4.xq (+81/-12)
test/Queries/image/paint_5.xq (+72/-11)
test/Queries/image/paint_6.xq (+43/-8)
test/Queries/image/paint_circles.xq (+37/-13)
test/Queries/image/paint_different_lines.xq (+37/-7)
test/Queries/image/paint_polygon.xq (+9/-4)
test/Queries/image/paint_polyline.xq (+9/-4)
test/Queries/image/paint_rectangles.xq (+28/-6)
test/Queries/image/paint_stroked_polyline.xq (+11/-4)
test/Queries/image/paint_text.xq (+11/-3)
To merge this branch: bzr merge lp:~zorba-coders/zorba/update3.0_image-module
Reviewer Review Type Date Requested Status
Juan Zacarias Approve
Chris Hillery Approve
Review via email: mp+179826@code.launchpad.net

Commit message

Updated image module to zorba 3.0 format

JSONification of module parameters

Description of the change

Updated image module to zorba 3.0 format

JSONification of module parameters

To post a comment you must log in.
Revision history for this message
Juan Zacarias (juan457) wrote :

Misses JSON validation

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/update3.0_image-module/+merge/179826

Stage "BuildZorbaUbuntu" failed.

Check compiler output at http://jenkins.lambda.nu/job/BuildZorbaUbuntu/446/parsed_console to view the results.

61. By Chris Hillery

Fixed a few build/doc errors.

Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/update3.0_image-module/+merge/179826

Stage "ZorbaVQ" failed.

Check console output at http://jenkins.lambda.nu/job/ZorbaVQ/495/console to view the results.

62. By Chris Hillery

Merge from trunk (?).

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/update3.0_image-module/+merge/179826 :
Votes: {'Approve': 1}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/update3.0_image-module/+merge/179826

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/241/console to view the results.

Revision history for this message
Juan Zacarias (juan457) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2011-07-26 10:43:30 +0000
+++ src/CMakeLists.txt 2013-10-23 04:15:35 +0000
@@ -1,4 +1,4 @@
1# Copyright 2006-2008 The FLWOR Foundation.1# Copyright 2006-2010 The FLWOR Foundation.
2# 2#
3# Licensed under the Apache License, Version 2.0 (the "License");3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.4# you may not use this file except in compliance with the License.
@@ -11,9 +11,76 @@
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and12# See the License for the specific language governing permissions and
13# limitations under the License.13# limitations under the License.
1414#
15# all external module libraries are generated in the directory15
16# of the corresponding .xq file16########################################################################
17MESSAGE(STATUS "Add com")17# ImageMagick
18ADD_SUBDIRECTORY(com)18########################################################################
19MESSAGE(STATUS "End modules")19IF(ZORBA_SUPPRESS_ImageMagick)
20 MESSAGE(STATUS "ZORBA_SUPPRESS_ImageMagick is true - not searching for ImageMagick.")
21ELSE(ZORBA_SUPPRESS_ImageMagick)
22 MESSAGE (STATUS "Looking for ImageMagick")
23 FIND_PACKAGE(ImageMagick COMPONENTS Magick++ MagickCore MagickWand)
24
25 IF(ImageMagick_FOUND)
26 MESSAGE(STATUS "Found ImageMagick include dirs ${ImageMagick_INCLUDE_DIRS}")
27 MESSAGE(STATUS "Found ImageMagick libraries ${ImageMagick_LIBRARIES}")
28 INCLUDE_DIRECTORIES("${ImageMagick_INCLUDE_DIRS}")
29
30 INCLUDE_DIRECTORIES("image_commons")
31 INCLUDE_DIRECTORIES("image_draw")
32 DECLARE_ZORBA_SCHEMA(FILE image.xsd
33 URI "http://zorba.io/modules/image/image")
34 DECLARE_ZORBA_MODULE(URI "http://zorba.io/modules/image/basic"
35 VERSION 2.0 FILE "basic.xq"
36 EXTRA_SOURCES image_commons image_draw
37 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
38 DECLARE_ZORBA_MODULE(VERSION 1.0 FILE "manipulation.xq"
39 URI "http://zorba.io/modules/image/manipulation"
40 EXTRA_SOURCES image_commons
41 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
42 DECLARE_ZORBA_MODULE(VERSION 1.0 FILE "paint.xq"
43 URI "http://zorba.io/modules/image/paint"
44 EXTRA_SOURCES image_draw image_commons
45 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
46 DECLARE_ZORBA_MODULE(VERSION 1.0 FILE "animation.xq"
47 URI "http://zorba.io/modules/image/animation"
48 EXTRA_SOURCES image_commons
49 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
50
51 # this could crash because of the ImageMagick version
52 # must be compiled in debug mode
53 SET (KNOWN_CRASHES)
54 IF (WIN32)
55 IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
56 LIST (APPEND KNOWN_CRASHES
57 zorba_image_module/image/basic.xq 867693
58 zorba_image_module/image/basic_convert.xq 867693
59 zorba_image_module/image/basic_create.xq 867693
60 zorba_image_module/image/paint_1.xq 867693
61 zorba_image_module/image/paint_2.xq 867693
62 zorba_image_module/image/paint_3.xq 867693
63 zorba_image_module/image/paint_4.xq 867693
64 zorba_image_module/image/paint_5.xq 867693
65 zorba_image_module/image/paint_6.xq 867693
66 zorba_image_module/image/paint_circles.xq 867693
67 zorba_image_module/image/paint_different_lines.xq 867693
68 zorba_image_module/image/paint_polygon.xq 867693
69 zorba_image_module/image/paint_polyline.xq 867693
70 zorba_image_module/image/paint_rectangles.xq 867693
71 zorba_image_module/image/paint_stroked_polyline.xq 867693
72 zorba_image_module/image/paint_text.xq 867693
73 )
74 ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
75 ENDIF (WIN32)
76
77 ADD_TEST_DIRECTORY ("${PROJECT_SOURCE_DIR}/test" "${KNOWN_CRASHES}")
78
79 ELSE (ImageMagick_FOUND)
80 MESSAGE(STATUS "Magick++ component found: ${ImageMagick_Magick++_FOUND}")
81 MESSAGE(STATUS "MagickCore component found: ${ImageMagick_MagickCore_FOUND}")
82 MESSAGE(STATUS "MagickWand component found: ${ImageMagick_MagickWand_FOUND}")
83 MESSAGE(STATUS "If you want to use image handling functionality please install the ImageMagick library containing these 3 components: Magick++, MagickCore, MagickWand.\n Please note that on some OS\n- ImageMagick and\n- libMagick++ (on OpenSuse) or ImageMagick-c++(on Fedora)\n are 2 different packages and you need to install both of them and additionally their development packages.")
84 ENDIF (ImageMagick_FOUND)
85ENDIF(ZORBA_SUPPRESS_ImageMagick)
86MESSAGE(STATUS "")
2087
=== renamed file 'src/com/zorba-xquery/www/modules/image/animation.xq' => 'src/animation.xq'
--- src/com/zorba-xquery/www/modules/image/animation.xq 2013-08-09 09:37:05 +0000
+++ src/animation.xq 2013-10-23 04:15:35 +0000
@@ -23,38 +23,38 @@
23 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>23 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>
24 : @project Zorba/Image/Animation24 : @project Zorba/Image/Animation
25 :)25 :)
26module namespace anim = 'http://www.zorba-xquery.com/modules/image/animation';26module namespace anim = 'http://zorba.io/modules/image/animation';
2727
28declare namespace ierr = "http://www.zorba-xquery.com/modules/image/error";28declare namespace ierr = "http://zorba.io/modules/image/error";
29declare namespace ver = "http://zorba.io/options/versioning";29declare namespace ver = "http://zorba.io/options/versioning";
30declare option ver:module-version "1.0";30declare option ver:module-version "1.0";
3131
32(:~32(:~
33 : Creates an animated GIF image.33 : <p>Creates an animated GIF image.</p>
34 : The resulting animated GIF shows the passed images consecutively. 34 : <p>The resulting animated GIF shows the passed images consecutively.</p>
35 : It has the same width and height as the first passed image.35 : <p>It has the same width and height as the first passed image.</p>
36 :36 :
37 : @param $images the image sequence37 : @param $images the image sequence
38 : @param $delay the hundredths of seconds an image is shown38 : @param $delay the hundredths of seconds an image is shown
39 : @param $iterations the amount of times all images are shown. 0 for infinite.39 : @param $iterations the amount of times all images are shown. 0 for infinite.
40 : @return the animated GIF40 : @return the animated GIF
41 : @error ierr:IM001 one of the passed images is invalid.41 : @error ierr:INVALID_IMAGE the passed image is invalid.
42 : @example test/Queries/image/animation_create.xq42 : @example test/Queries/image/animation_create.xq
43 :)43 :)
44declare function anim:create-animated-gif($images as xs:base64Binary+, $delay as xs:unsignedInt, $iterations as xs:unsignedInt) as xs:base64Binary external; 44declare function anim:create-animated-gif($images as xs:base64Binary+, $delay as xs:unsignedInt, $iterations as xs:unsignedInt) as xs:base64Binary external;
4545
4646
47(:~47(:~
48 : Creates an animated GIF image with morph effect.48 : <p>Creates an animated GIF image with morph effect.</p>
49 : The resulting animated GIF shows the passed images consecutively with morph effect between the changes.49 : <p>The resulting animated GIF shows the passed images consecutively with morph effect between the changes.</p>
50 : It has the same width and height as the first passed image.50 : <p>It has the same width and height as the first passed image.</p>
51 :51 :
52 : @param $images the image sequence52 : @param $images the image sequence
53 : @param $delay the hundredths of seconds an image is shown53 : @param $delay the hundredths of seconds an image is shown
54 : @param $iterations the amount of times all images are shown. 0 for infinite.54 : @param $iterations the amount of times all images are shown. 0 for infinite.
55 : @param $nr-of-morph-images the number of additionally added images to create the morph effect between two passed images.55 : @param $nr-of-morph-images the number of additionally added images to create the morph effect between two passed images.
56 : @return the animated GIF56 : @return the animated GIF
57 : @error ierr:IM001 one of the passed images is invalid.57 : @error ierr:INVALID_IMAGE the passed image is invalid.
58 : @example test/Queries/image/animation_create.xq58 : @example test/Queries/image/animation_create.xq
59 :)59 :)
60declare function anim:create-morphed-gif($images as xs:base64Binary+, $delay as xs:unsignedInt, $iterations as xs:unsignedInt, $nr-of-morph-images as xs:unsignedInt) as xs:base64Binary external; 60declare function anim:create-morphed-gif($images as xs:base64Binary+, $delay as xs:unsignedInt, $iterations as xs:unsignedInt, $nr-of-morph-images as xs:unsignedInt) as xs:base64Binary external;
6161
=== renamed directory 'src/com/zorba-xquery/www/modules/image/animation.xq.src' => 'src/animation.xq.src'
=== modified file 'src/animation.xq.src/animation_module.h'
--- src/com/zorba-xquery/www/modules/image/animation.xq.src/animation_module.h 2011-10-06 08:18:47 +0000
+++ src/animation.xq.src/animation_module.h 2013-10-23 04:15:35 +0000
@@ -33,7 +33,7 @@
33 33
3434
35 virtual String35 virtual String
36 getURI() const { return "http://www.zorba-xquery.com/modules/image/animation"; }36 getURI() const { return "http://zorba.io/modules/image/animation"; }
3737
38};38};
3939
4040
=== renamed file 'src/com/zorba-xquery/www/modules/image/basic.xq' => 'src/basic.xq'
--- src/com/zorba-xquery/www/modules/image/basic.xq 2013-08-09 09:37:05 +0000
+++ src/basic.xq 2013-10-23 04:15:35 +0000
@@ -17,7 +17,7 @@
17:)17:)
1818
19(:~19(:~
20 : This module provides function to do the following basic image operations:20 : <p>This module provides function to do the following basic image operations:</p>
21 : <ul>21 : <ul>
22 : <li>create empty images</li>22 : <li>create empty images</li>
23 : <li>compare images</li>23 : <li>compare images</li>
@@ -25,8 +25,8 @@
25 : <li>convert an image one format to another</li>25 : <li>convert an image one format to another</li>
26 : <li>retrieve with, height, format, and exif information from an image</li>26 : <li>retrieve with, height, format, and exif information from an image</li>
27 : </ul>27 : </ul>
28 :28 : <p/>
29 : The following image formats are supported:29 : <p>The following image formats are supported:
30 : <ul>30 : <ul>
31 : <li>GIF</li>31 : <li>GIF</li>
32 : <li>JPEG</li>32 : <li>JPEG</li>
@@ -34,27 +34,27 @@
34 : <li>TIFF</li>34 : <li>TIFF</li>
35 : <li>BMP</li>35 : <li>BMP</li>
36 : </ul>36 : </ul>
37 :37 : </p>
38 : <p>The errors raised by functions of this module have the namespace38 : <p>The errors raised by functions of this module have the namespace
39 : <tt>http://www.zorba-xquery.com/modules/image/error</tt> (associated with prefix ierr).</p>39 : <tt>http://zorba.io/modules/image/error</tt> (associated with prefix ierr).</p>
40 :40 :
41 : @author Daniel Thomas41 : @author Daniel Thomas
42 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>42 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>
43 : @project Zorba/Image/Basic43 : @project Zorba/Image/Basic
44 :44 :
45 :)45 :)
46module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';46module namespace basic = 'http://zorba.io/modules/image/basic';
4747
48import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';48import schema namespace image = 'http://zorba.io/modules/image/image';
4949
50declare namespace err = "http://www.w3.org/2005/xqt-errors";50declare namespace err = "http://www.w3.org/2005/xqt-errors";
51declare namespace ierr = "http://www.zorba-xquery.com/modules/image/error";51declare namespace ierr = "http://zorba.io/modules/image/error";
52declare namespace ver = "http://zorba.io/options/versioning";52declare namespace ver = "http://zorba.io/options/versioning";
53declare namespace svg = "http://www.w3.org/2000/svg";53declare namespace svg = "http://www.w3.org/2000/svg";
54declare option ver:module-version "2.0";54declare option ver:module-version "2.0";
5555
56(:~56(:~
57 : Returns the width of the passed image.57 : <p>Returns the width of the passed image.</p>
58 : 58 :
59 : @param $image the image59 : @param $image the image
60 : @return the width in pixels60 : @return the width in pixels
@@ -64,24 +64,24 @@
64declare function basic:width($image as xs:base64Binary) as xs:unsignedInt external; 64declare function basic:width($image as xs:base64Binary) as xs:unsignedInt external;
6565
66(:~66(:~
67 : Returns the height of the passed image.67 : <p>Returns the height of the passed image.</p>
68 : 68 :
69 : @param $image the image69 : @param $image the image
70 : @return the height in pixels70 : @return the height in pixels
71 : @error ierr:IM001 the passed image is invalid.71 : @error ierr:INVALID_IMAGE the passed image is invalid.
72 : @example test/Queries/image/basic_height.xq72 : @example test/Queries/image/basic_height.xq
73 :)73 :)
74declare function basic:height($image as xs:base64Binary) as xs:unsignedInt external; 74declare function basic:height($image as xs:base64Binary) as xs:unsignedInt external;
7575
7676
77(:~77(:~
78 : Compresses the passed image. 78 : <p>Compresses the passed image.</p>
79 : Compressing means lowering the quality and reducing the size.79 : <p>Compressing means lowering the quality and reducing the size.</p>
80 :80 :
81 : @param $image the image81 : @param $image the image
82 : @param $quality compression level, 0 to 10082 : @param $quality compression level, 0 to 100
83 : @return the compressed image 83 : @return the compressed image
84 : @error ierr:IM001 the passed image is invalid.84 : @error ierr:INVALID_IMAGE the passed image is invalid.
85 : @example test/Queries/image/basic_compress.xq85 : @example test/Queries/image/basic_compress.xq
86 :)86 :)
87declare function basic:compress($image as xs:base64Binary, $quality as xs:unsignedInt) as xs:base64Binary external; 87declare function basic:compress($image as xs:base64Binary, $quality as xs:unsignedInt) as xs:base64Binary external;
@@ -89,12 +89,12 @@
8989
9090
91(:~91(:~
92 : Converts an image to another format.92 : <p>Converts an image to another format.</p>
93 :93 :
94 : @param $image the source image94 : @param $image the source image
95 : @param $format the format (see supported formats above) of the resulting image.95 : @param $format the format (see supported formats above) of the resulting image.
96 : @return A new image with the same content as the passed image but with the specified file format.96 : @return A new image with the same content as the passed image but with the specified file format.
97 : @error ierr:IM001 the passed image is invalid.97 : @error ierr:INVALID_IMAGE the passed image is invalid.
98 : @error err:FORG0001 unsupported image format 98 : @error err:FORG0001 unsupported image format
99 : @example test/Queries/image/basic_convert.xq99 : @example test/Queries/image/basic_convert.xq
100 :)100 :)
@@ -107,17 +107,17 @@
107107
108108
109(:~109(:~
110 : Returns the format of the passed image. 110 : <p>Returns the format of the passed image.</p>
111 :111 :
112 : @param $image the image112 : @param $image the image
113 : @return the format 113 : @return the format
114 : @error ierr:IM001 the passed image is invalid.114 : @error ierr:INVALID_IMAGE the passed image is invalid.
115 : @example test/Queries/image/basic_type.xq115 : @example test/Queries/image/basic_type.xq
116 :)116 :)
117declare function basic:format($image as xs:base64Binary) as xs:string external; 117declare function basic:format($image as xs:base64Binary) as xs:string external;
118 118
119(:~119(:~
120 : Creates an empty image with background color white.120 : <p>Creates an empty image with background color white.</p>
121 :121 :
122 : @param $width the width of the new image122 : @param $width the width of the new image
123 : @param $height the height of the new image123 : @param $height the height of the new image
@@ -133,37 +133,37 @@
133declare %private function basic:create-impl($width as xs:unsignedInt, $height as xs:unsignedInt, $format as xs:string) as xs:base64Binary external; 133declare %private function basic:create-impl($width as xs:unsignedInt, $height as xs:unsignedInt, $format as xs:string) as xs:base64Binary external;
134134
135(:~135(:~
136 : Reads exif information from an image.136 : <p>Reads exif information from an image.</p>
137 : This function works for JPEG and TIFF images only. 137 : <p>This function works for JPEG and TIFF images only.</p>
138 : It returns empty sequence if no exif information matching the passed tag is found.138 : <p>It returns empty sequence if no exif information matching the passed tag is found.</p>
139 :139 :
140 : @param $image the image140 : @param $image the image
141 : @param $tag the field name we want read (e.g. DateTime).141 : @param $tag the field name we want read (e.g. DateTime).
142 : @return exif field content142 : @return exif field content
143 : @error ierr:IM001 the passed image is invalid.143 : @error ierr:INVALID_IMAGE the passed image is invalid.
144 : @example test/Queries/image/basic_exif.xq144 : @example test/Queries/image/basic_exif.xq
145 :)145 :)
146declare function basic:exif($image as xs:base64Binary, $tag as xs:string) as xs:string? external; 146declare function basic:exif($image as xs:base64Binary, $tag as xs:string) as xs:string? external;
147147
148(:~148(:~
149 : Compares two images.149 : <p>Compares two images.</p>
150 :150 :
151 : @param $image1 first image151 : @param $image1 first image
152 : @param $image2 second image152 : @param $image2 second image
153 : @return True if the images are equal.153 : @return True if the images are equal.
154 : @error ierr:IM001 one of the passed images is invalid.154 : @error ierr:INVALID_IMAGE one of the passed images is invalid.
155 : @example test/Queries/image/basic_equals.xq155 : @example test/Queries/image/basic_equals.xq
156 :)156 :)
157declare function basic:equals($image1 as xs:base64Binary, $image2 as xs:base64Binary) as xs:boolean external; 157declare function basic:equals($image1 as xs:base64Binary, $image2 as xs:base64Binary) as xs:boolean external;
158158
159159
160(:~160(:~
161 : Converts an SVG image to a supported image format.161 : <p>Converts an SVG image to a supported image format.</p>
162 :162 :
163 : @param $svg the image to convert163 : @param $svg the image to convert
164 : @param $format target format 164 : @param $format target format
165 : @return the resulting image165 : @return the resulting image
166 : @error ierr:IM001 the passed SVG is invalid.166 : @error ierr:INVALID_IMAGE the passed SVG is invalid.
167 : @example test/Queries/image/basic_svg.xq167 : @example test/Queries/image/basic_svg.xq
168 :)168 :)
169declare function basic:convert-svg(169declare function basic:convert-svg(
@@ -182,12 +182,12 @@
182};182};
183183
184(:~184(:~
185 : Converts an SVG image to a supported image format.185 : <p>Converts an SVG image to a supported image format.</p>
186 :186 :
187 : @param $svg the image to convert as string187 : @param $svg the image to convert as string
188 : @param $format target format 188 : @param $format target format
189 : @return the resulting image189 : @return the resulting image
190 : @error ierr:IM001 the passed SVG is invalid.190 : @error ierr:INVALID_IMAGE the passed SVG is invalid.
191 : @example test/Queries/image/basic_svg.xq191 : @example test/Queries/image/basic_svg.xq
192 :)192 :)
193declare function basic:convert-svg-string(193declare function basic:convert-svg-string(
194194
=== renamed directory 'src/com/zorba-xquery/www/modules/image/basic.xq.src' => 'src/basic.xq.src'
=== modified file 'src/basic.xq.src/basic_module.h'
--- src/com/zorba-xquery/www/modules/image/basic.xq.src/basic_module.h 2011-10-06 08:18:47 +0000
+++ src/basic.xq.src/basic_module.h 2013-10-23 04:15:35 +0000
@@ -33,7 +33,7 @@
33 33
3434
35 virtual String35 virtual String
36 getURI() const { return "http://www.zorba-xquery.com/modules/image/basic"; }36 getURI() const { return "http://zorba.io/modules/image/basic"; }
3737
38};38};
3939
4040
=== removed directory 'src/com'
=== removed file 'src/com/CMakeLists.txt'
--- src/com/CMakeLists.txt 2011-10-06 08:18:47 +0000
+++ src/com/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
1# Copyright 2006-2008 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# all external module libraries are generated in the directory
16# of the corresponding .xq file
17ADD_SUBDIRECTORY(zorba-xquery)
180
=== removed directory 'src/com/zorba-xquery'
=== removed file 'src/com/zorba-xquery/CMakeLists.txt'
--- src/com/zorba-xquery/CMakeLists.txt 2011-10-06 08:18:47 +0000
+++ src/com/zorba-xquery/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
1# Copyright 2006-2008 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# all external module libraries are generated in the directory
16# of the corresponding .xq file
17ADD_SUBDIRECTORY(www)
180
=== removed directory 'src/com/zorba-xquery/www'
=== removed file 'src/com/zorba-xquery/www/CMakeLists.txt'
--- src/com/zorba-xquery/www/CMakeLists.txt 2011-10-06 08:18:47 +0000
+++ src/com/zorba-xquery/www/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
1# Copyright 2006-2008 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# all external module libraries are generated in the directory
16# of the corresponding .xq file
17ADD_SUBDIRECTORY(modules)
180
=== removed directory 'src/com/zorba-xquery/www/modules'
=== removed file 'src/com/zorba-xquery/www/modules/CMakeLists.txt'
--- src/com/zorba-xquery/www/modules/CMakeLists.txt 2011-10-06 08:18:47 +0000
+++ src/com/zorba-xquery/www/modules/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1# Copyright 2006-2008 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15ADD_SUBDIRECTORY(image)
16\ No newline at end of file0\ No newline at end of file
171
=== removed directory 'src/com/zorba-xquery/www/modules/image'
=== removed file 'src/com/zorba-xquery/www/modules/image/CMakeLists.txt'
--- src/com/zorba-xquery/www/modules/image/CMakeLists.txt 2012-10-29 20:36:25 +0000
+++ src/com/zorba-xquery/www/modules/image/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,86 +0,0 @@
1# Copyright 2006-2010 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16########################################################################
17# ImageMagick
18########################################################################
19IF(ZORBA_SUPPRESS_ImageMagick)
20 MESSAGE(STATUS "ZORBA_SUPPRESS_ImageMagick is true - not searching for ImageMagick.")
21ELSE(ZORBA_SUPPRESS_ImageMagick)
22 MESSAGE (STATUS "Looking for ImageMagick")
23 FIND_PACKAGE(ImageMagick COMPONENTS Magick++ MagickCore MagickWand)
24
25 IF(ImageMagick_FOUND)
26 MESSAGE(STATUS "Found ImageMagick include dirs ${ImageMagick_INCLUDE_DIRS}")
27 MESSAGE(STATUS "Found ImageMagick libraries ${ImageMagick_LIBRARIES}")
28 INCLUDE_DIRECTORIES("${ImageMagick_INCLUDE_DIRS}")
29
30 INCLUDE_DIRECTORIES("image_commons")
31 INCLUDE_DIRECTORIES("image_draw")
32 DECLARE_ZORBA_SCHEMA(FILE image.xsd
33 URI "http://www.zorba-xquery.com/modules/image/image")
34 DECLARE_ZORBA_MODULE(URI "http://www.zorba-xquery.com/modules/image/basic"
35 VERSION 2.0 FILE "basic.xq"
36 EXTRA_SOURCES image_commons image_draw
37 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
38 DECLARE_ZORBA_MODULE(VERSION 1.0 FILE "manipulation.xq"
39 URI "http://www.zorba-xquery.com/modules/image/manipulation"
40 EXTRA_SOURCES image_commons
41 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
42 DECLARE_ZORBA_MODULE(VERSION 1.0 FILE "paint.xq"
43 URI "http://www.zorba-xquery.com/modules/image/paint"
44 EXTRA_SOURCES image_draw image_commons
45 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
46 DECLARE_ZORBA_MODULE(VERSION 1.0 FILE "animation.xq"
47 URI "http://www.zorba-xquery.com/modules/image/animation"
48 EXTRA_SOURCES image_commons
49 LINK_LIBRARIES ${ImageMagick_LIBRARIES})
50
51 # this could crash because of the ImageMagick version
52 # must be compiled in debug mode
53 SET (KNOWN_CRASHES)
54 IF (WIN32)
55 IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
56 LIST (APPEND KNOWN_CRASHES
57 zorba_image_module/image/basic.xq 867693
58 zorba_image_module/image/basic_convert.xq 867693
59 zorba_image_module/image/basic_create.xq 867693
60 zorba_image_module/image/paint_1.xq 867693
61 zorba_image_module/image/paint_2.xq 867693
62 zorba_image_module/image/paint_3.xq 867693
63 zorba_image_module/image/paint_4.xq 867693
64 zorba_image_module/image/paint_5.xq 867693
65 zorba_image_module/image/paint_6.xq 867693
66 zorba_image_module/image/paint_circles.xq 867693
67 zorba_image_module/image/paint_different_lines.xq 867693
68 zorba_image_module/image/paint_polygon.xq 867693
69 zorba_image_module/image/paint_polyline.xq 867693
70 zorba_image_module/image/paint_rectangles.xq 867693
71 zorba_image_module/image/paint_stroked_polyline.xq 867693
72 zorba_image_module/image/paint_text.xq 867693
73 )
74 ENDIF (CMAKE_BUILD_TYPE STREQUAL "Debug")
75 ENDIF (WIN32)
76
77 ADD_TEST_DIRECTORY ("${PROJECT_SOURCE_DIR}/test" "${KNOWN_CRASHES}")
78
79 ELSE (ImageMagick_FOUND)
80 MESSAGE(STATUS "Magick++ component found: ${ImageMagick_Magick++_FOUND}")
81 MESSAGE(STATUS "MagickCore component found: ${ImageMagick_MagickCore_FOUND}")
82 MESSAGE(STATUS "MagickWand component found: ${ImageMagick_MagickWand_FOUND}")
83 MESSAGE(STATUS "If you want to use image handling functionality please install the ImageMagick library containing these 3 components: Magick++, MagickCore, MagickWand.\n Please note that on some OS\n- ImageMagick and\n- libMagick++ (on OpenSuse) or ImageMagick-c++(on Fedora)\n are 2 different packages and you need to install both of them and additionally their development packages.")
84 ENDIF (ImageMagick_FOUND)
85ENDIF(ZORBA_SUPPRESS_ImageMagick)
86MESSAGE(STATUS "")
870
=== added file 'src/image.jsd'
--- src/image.jsd 1970-01-01 00:00:00 +0000
+++ src/image.jsd 2013-10-23 04:15:35 +0000
@@ -0,0 +1,360 @@
1{
2 "$namespace" : "http://zorba.io/modules/images/"
3 "$types" : [
4 {
5 "$name" : "imageFormat",
6 "$about" : "This schema defines the different types used in the modules under:
7 http://zorba.io/modules/images/",
8 "$kind" : "atomic",
9 "$baseType" : "string",
10 "$enumarion" : [ "GIF", "PNG", "JPEG", "TIFF", "BMP" ]
11 },
12 {
13 "$name" : "colorType",
14 "$about" : "This type defines how colors should be formatted.",
15 "$kind" : "atomic",
16 "$baseType" : "string",
17 "$length" : 7,
18 "$pattern" : "[#]([A-F0-9]{6})"
19 },
20 {
21 "$name" : "noiseType",
22 "$about" : "This type defines the different names that are allowed as noise identifiers.",
23 "$kind" : "atomic",
24 "$baseType" : "string",
25 "$enumarion" : [ "UniformNoise", "GaussianNoise", "MultiplicativeGaussianNoise", "ImpulseNoise", "LaplacianNoise", "PoissonNoise" ]
26 },
27 {
28 "$name" : "compositeOperatorType",
29 "$about" : "This type defines the different operators applicable for overlaying images.
30 OverCompositeOp: The result is the union of the the two image shapes with the composite image obscuring image in the region of overlap.
31 InCompositeOp: The result is a simply composite image cut by the shape of image. None of the image data of image is included in the result.
32 OutCompositeOp: The resulting image is composite image with the shape of image cut out.
33 AtopCompositeOp: The result is the same shape as image image, with composite image obscuring image there the image shapes overlap. Note that this differs from OverCompositeOp because the portion of composite image outside of image's shape does not appear in the result.
34 XorCompositeOp: The result is the image data from both composite image and image that is outside the overlap region. The overlap region will be blank.
35 PlusCompositeOp: The result is just the sum of the image data. Output values are cropped to 255 (no overflow). This operation is independent of the matte channels.
36 MinusCompositeOp: The result of composite image - image, with overflow cropped to zero. The matte chanel is ignored (set to 255, full coverage).
37 AddCompositeOp: The result of composite image + image, with overflow wrapping around (mod 256).
38 SubtractCompositeOp: The result of composite image - image, with underflow wrapping around (mod 256). The add and subtract operators can be used to perform reverible transformations.
39 DifferenceCompositeOp: The result of abs(composite image - image). This is useful for comparing two very similar images.
40 BumpmapCompositeOp: The result image shaded by composite image."
41 "$kind" : "atomic",
42 "$baseType" : "string",
43 "$enumarion" : [ "OverCompositeOp", "InCompositeOp", "OutCompositeOp", "AtopCompositeOp", "XorCompositeOp", "PlusCompositeOp", "MinusCompositeOp", "AddCompositeOp", "SubtractCompositeOp", "DifferenceCompositeOp", "BumpmapCompositeOp" ]
44 },
45 {
46 "$name" : "pointType",
47 "$kind" : "array",
48 "$content" : [ "integer" ],
49 "$minLength" : 2,
50 "$maxLength" : 2
51 },
52 {
53 "$name" : "pointsType",
54 "$kind" : "array",
55 "$content" : [ "pointType" ],
56 "$minLength" : 1
57 },
58 {
59 "$name" : "line",
60 "$kind" : "object",
61 "$content" : {
62 "start" : {
63 "$type" : "pointType"
64 },
65 "end" : {
66 "$type" : "pointType"
67 },
68 "strokeWidth" : {
69 "$type" : "double",
70 "$optional" : true
71 },
72 "strokeColor" : {
73 "$type" : "colorType",
74 "optional" : true
75 },
76 "fillColor" : {
77 "$type" : "colorType",
78 "optional" : true
79 },
80 "antiAliasing" : {
81 "$type" : "boolean",
82 "optional" : true
83 }
84 }
85 },
86 {
87 "$name" : "polyLine",
88 "$kind" : "object"
89 "$content" : {
90 "points" : {
91 "$type" : "pointsType"
92 },
93 "strokeWidth" : {
94 "$type" : "double",
95 "$optional" : true
96 },
97 "strokeColor" : {
98 "$type" : "colorType",
99 "optional" : true
100 },
101 "fillColor" : {
102 "$type" : "colorType",
103 "optional" : true
104 },
105 "antiAliasing" : {
106 "$type" : "boolean",
107 "optional" : true
108 }
109 }
110 },
111 {
112 "$name" : "strokedPolyLine"
113 "$kind" : "object"
114 "$content" : {
115 "points" : {
116 "$type" : "pointsType"
117 },
118 "strokeLength" : {
119 "$type" : "double"
120 },
121 "gapLength" : {
122 "$type" : "double"
123 },
124 "strokeWidth" : {
125 "$type" : "double",
126 "$optional" : true
127 },
128 "strokeColor" : {
129 "$type" : "colorType",
130 "optional" : true
131 },
132 "fillColor" : {
133 "$type" : "colorType",
134 "optional" : true
135 },
136 "antiAliasing" : {
137 "$type" : "boolean",
138 "optional" : true
139 }
140 }
141 },
142 {
143 "$name" : "rectangle",
144 "$kind" : "object",
145 "$content" : {
146 "upperLeft" : {
147 "$type" : "pointType"
148 },
149 "lowerRight" : {
150 "$type" : "pointType"
151 },
152 "strokeWidth" : {
153 "$type" : "double",
154 "$optional" : true
155 },
156 "strokeColor" : {
157 "$type" : "colorType",
158 "optional" : true
159 },
160 "fillColor" : {
161 "$type" : "colorType",
162 "optional" : true
163 },
164 "antiAliasing" : {
165 "$type" : "boolean",
166 "optional" : true
167 }
168 }
169 },
170 {
171 "$name" : "roundedRectangle",
172 "$kind" : "object",
173 "$content" : {
174 "upperLeft" : {
175 "$type" : "pointType"
176 },
177 "lowerRight" : {
178 "$type" : "pointType"
179 },
180 "cornerWidth" : {
181 "$type" : "double"
182 },
183 "cornerHeight" : {
184 "$type" : "double"
185 },
186 "strokeWidth" : {
187 "$type" : "double",
188 "$optional" : true
189 },
190 "strokeColor" : {
191 "$type" : "colorType",
192 "optional" : true
193 },
194 "fillColor" : {
195 "$type" : "colorType",
196 "optional" : true
197 },
198 "antiAliasing" : {
199 "$type" : "boolean",
200 "optional" : true
201 }
202 }
203 },
204 {
205 "$name" : "circle",
206 "$kind" : "object",
207 "$content" : {
208 "origin" : {
209 "$type" : "pointType"
210 },
211 "radius" : {
212 "$type" : "double"
213 },
214 "strokeWidth" : {
215 "$type" : "double",
216 "$optional" : true
217 },
218 "strokeColor" : {
219 "$type" : "colorType",
220 "optional" : true
221 },
222 "fillColor" : {
223 "$type" : "colorType",
224 "optional" : true
225 },
226 "antiAliasing" : {
227 "$type" : "boolean",
228 "optional" : true
229 }
230 }
231 },
232 {
233 "$name" : "ellipse",
234 "$kind" : "object",
235 "$content" : {
236 "origin" : {
237 "$type" : "pointType"
238 },
239 "radiusX" : {
240 "$type" : "double"
241 },
242 "radiusY" : {
243 "$type" : "double"
244 },
245 "strokeWidth" : {
246 "$type" : "double",
247 "$optional" : true
248 },
249 "strokeColor" : {
250 "$type" : "colorType",
251 "optional" : true
252 },
253 "fillColor" : {
254 "$type" : "colorType",
255 "optional" : true
256 },
257 "antiAliasing" : {
258 "$type" : "boolean",
259 "optional" : true
260 }
261 }
262 },
263 {
264 "$name" : "arc",
265 "$kind" : "object",
266 "$content" : {
267 "origin" : {
268 "$type" : "pointType"
269 },
270 "radiusX" : {
271 "$type" : "double"
272 },
273 "radiusY" : {
274 "$type" : "double"
275 },
276 "startDegrees" : {
277 "$type" : "double"
278 },
279 "endDegrees" : {
280 "$type" : "double"
281 },
282 "strokeWidth" : {
283 "$type" : "double",
284 "$optional" : true
285 },
286 "strokeColor" : {
287 "$type" : "colorType",
288 "optional" : true
289 },
290 "fillColor" : {
291 "$type" : "colorType",
292 "optional" : true
293 },
294 "antiAliasing" : {
295 "$type" : "boolean",
296 "optional" : true
297 }
298 }
299 },
300 {
301 "$name" : "polygon",
302 "$kind" : "object",
303 "$content" : {
304 "points" : {
305 "$kind" : "pointsType"
306 },
307 "strokeWidth" : {
308 "$type" : "double",
309 "$optional" : true
310 },
311 "strokeColor" : {
312 "$type" : "colorType",
313 "optional" : true
314 },
315 "fillColor" : {
316 "$type" : "colorType",
317 "optional" : true
318 },
319 "antiAliasing" : {
320 "$type" : "boolean",
321 "optional" : true
322 }
323 }
324 },
325 {
326 "$name" : "text",
327 "$kind" : "object",
328 "$content" : {
329 "origin" : {
330 "$type" : "pointType"
331 },
332 "text" : {
333 "$type" : "string"
334 },
335 "font" : {
336 "$type" : "string"
337 },
338 "fontSize" : {
339 "$type" : "double"
340 },
341 "strokeWidth" : {
342 "$type" : "double",
343 "$optional" : true
344 },
345 "strokeColor" : {
346 "$type" : "colorType",
347 "optional" : true
348 },
349 "fillColor" : {
350 "$type" : "colorType",
351 "optional" : true
352 },
353 "antiAliasing" : {
354 "$type" : "boolean",
355 "optional" : true
356 }
357 }
358 }
359 ]
360}
0\ No newline at end of file361\ No newline at end of file
1362
=== renamed file 'src/com/zorba-xquery/www/modules/image/image.xsd' => 'src/image.xsd'
--- src/com/zorba-xquery/www/modules/image/image.xsd 2011-08-07 00:38:36 +0000
+++ src/image.xsd 2013-10-23 04:15:35 +0000
@@ -1,8 +1,8 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<schema 2<schema
3 xmlns="http://www.w3.org/2001/XMLSchema" 3 xmlns="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://www.zorba-xquery.com/modules/image/image"4 targetNamespace="http://zorba.io/modules/image/image"
5 xmlns:image="http://www.zorba-xquery.com/modules/image/image"5 xmlns:image="http://zorba.io/modules/image/image"
6 elementFormDefault="qualified">6 elementFormDefault="qualified">
77
8<!--8<!--
@@ -25,7 +25,7 @@
25 <annotation xml:lang="en">25 <annotation xml:lang="en">
26 <documentation>26 <documentation>
27 This schema defines the different types used in the modules under:27 This schema defines the different types used in the modules under:
28 http://www.zorba-xquery.com/modules/images/28 http://zorba.io/modules/images/
29 </documentation>29 </documentation>
30 </annotation>30 </annotation>
31 31
3232
=== renamed directory 'src/com/zorba-xquery/www/modules/image/image_commons' => 'src/image_commons'
=== modified file 'src/image_commons/image_function.cpp'
--- src/com/zorba-xquery/www/modules/image/image_commons/image_function.cpp 2013-07-31 21:49:56 +0000
+++ src/image_commons/image_function.cpp 2013-10-23 04:15:35 +0000
@@ -55,8 +55,8 @@
55ImageFunction::throwImageError(const DynamicContext* aDynamicContext, const char *aMessage) {55ImageFunction::throwImageError(const DynamicContext* aDynamicContext, const char *aMessage) {
56 std::stringstream lErrorMessage;56 std::stringstream lErrorMessage;
57 // constuct error QName57 // constuct error QName
58 String lNamespace = "http://www.zorba-xquery.com/modules/image/error";58 String lNamespace = "http://zorba.io/modules/image/error";
59 String lLocalname = "IM001";59 String lLocalname = "INVALID_IMAGE";
60 Item lQName = ImageModule::getItemFactory()->createQName(lNamespace, "image", lLocalname);60 Item lQName = ImageModule::getItemFactory()->createQName(lNamespace, "image", lLocalname);
61 // if we have zero length image, then tell the user so61 // if we have zero length image, then tell the user so
62 if (std::string(aMessage).find("zero-length") != std::string::npos) {62 if (std::string(aMessage).find("zero-length") != std::string::npos) {
@@ -70,7 +70,7 @@
7070
71void 71void
72ImageFunction::throwErrorWithQName (const DynamicContext* aDynamicContext, const String& aLocalName, const String& aMessage) {72ImageFunction::throwErrorWithQName (const DynamicContext* aDynamicContext, const String& aLocalName, const String& aMessage) {
73 String lNamespace = "http://www.zorba-xquery.com/modules/image/error";73 String lNamespace = "http://zorba.io/modules/image/error";
74 Item lQName = ImageModule::getItemFactory()->createQName(lNamespace, "image", aLocalName);74 Item lQName = ImageModule::getItemFactory()->createQName(lNamespace, "image", aLocalName);
75 USER_EXCEPTION(lQName, aMessage); 75 USER_EXCEPTION(lQName, aMessage);
76}76}
7777
=== modified file 'src/image_commons/image_module.h'
--- src/com/zorba-xquery/www/modules/image/image_commons/image_module.h 2012-08-31 22:09:12 +0000
+++ src/image_commons/image_module.h 2013-10-23 04:15:35 +0000
@@ -54,7 +54,7 @@
5454
55public:55public:
56 virtual String56 virtual String
57 getURI() const { return "http://www.zorba-xquery.com/modules/image/"; }57 getURI() const { return "http://zorba.io/modules/image/"; }
58 58
59 ImageModule()59 ImageModule()
60 {60 {
6161
=== renamed directory 'src/com/zorba-xquery/www/modules/image/image_draw' => 'src/image_draw'
=== renamed file 'src/com/zorba-xquery/www/modules/image/manipulation.xq' => 'src/manipulation.xq'
--- src/com/zorba-xquery/www/modules/image/manipulation.xq 2013-10-12 01:08:44 +0000
+++ src/manipulation.xq 2013-10-23 04:15:35 +0000
@@ -17,43 +17,43 @@
1717
1818
19(:~19(:~
20 : This module provides functions to handle image manipulations like resizing, zooming, 20 : <p>This module provides functions to handle image manipulations like resizing, zooming,
21 : special effects etc.21 : special effects etc.</p>
22 :22 :
23 : <p>The errors raised by functions of this module have the namespace23 : <p>The errors raised by functions of this module have the namespace
24 : <tt>http://www.zorba-xquery.com/modules/image/error</tt> (associated with prefix ierr).</p>24 : <tt>http://zorba.io/modules/image/error</tt> (associated with prefix ierr).</p>
25 :25 :
26 : @author Daniel Thomas26 : @author Daniel Thomas
27 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>27 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>
28 : @project Zorba/Image/Manipulation28 : @project Zorba/Image/Manipulation
29 :29 :
30 :)30 :)
31module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';31module namespace man = 'http://zorba.io/modules/image/manipulation';
3232
33import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';33import schema namespace image = 'http://zorba.io/modules/image/image';
3434
35declare namespace err = "http://www.w3.org/2005/xqt-errors";35declare namespace err = "http://www.w3.org/2005/xqt-errors";
36declare namespace ierr = "http://www.zorba-xquery.com/modules/image/error";36declare namespace ierr = "http://zorba.io/modules/image/error";
37declare namespace ver = "http://zorba.io/options/versioning";37declare namespace ver = "http://zorba.io/options/versioning";
38declare option ver:module-version "1.0";38declare option ver:module-version "1.0";
3939
40(:~40(:~
41 : Get a copy of the passed image with changed width and height (without 41 : <p>Get a copy of the passed image with changed width and height (without
42 : zooming the image's content). 42 : zooming the image's content).</p>
43 : To change the size of the actual contents of an image, use the zoom function.43 : <p>To change the size of the actual contents of an image, use the zoom function.</p>
44 :44 : <p/>
45 : More in detail: If the new dimensions are greater than the current dimensions 45 : <p>More in detail: If the new dimensions are greater than the current dimensions
46 : the new image will have the passed image in the upper left corner and the rest 46 : the new image will have the passed image in the upper left corner and the rest
47 : will be filled with the current background color.47 : will be filled with the current background color.</p>
48 : If the passed dimensions are less than the current dimensions, the new image 48 : <p>If the passed dimensions are less than the current dimensions, the new image
49 : will contain the specified rectangle of the passed image beginning at the upper 49 : will contain the specified rectangle of the passed image beginning at the upper
50 : left corner.50 : left corner.</p>
51 :51 :
52 : @param $image image to resize52 : @param $image image to resize
53 : @param $width new width53 : @param $width new width
54 : @param $height new height54 : @param $height new height
55 : @return resized copy of the source image55 : @return resized copy of the source image
56 : @error ierr:IM001 passed image is invalid.56 : @error ierr:INVALID_IMAGE passed image is invalid.
57 : @example test/Queries/image/manipulation_resize.xq57 : @example test/Queries/image/manipulation_resize.xq
58 :)58 :)
59declare function man:resize($image as xs:base64Binary, 59declare function man:resize($image as xs:base64Binary,
@@ -61,34 +61,34 @@
61 $height as xs:unsignedInt) as xs:base64Binary external; 61 $height as xs:unsignedInt) as xs:base64Binary external;
6262
63(:~63(:~
64 : Zoom the passed image by the specified factor while keeping the ratio between 64 : <p>Zoom the passed image by the specified factor while keeping the ratio between
65 : width and height.65 : width and height.</p>
66 :66 : <p/>
67 : A ratio of less than 1 will make the image smaller. 67 : <p>A ratio of less than 1 will make the image smaller.</p>
68 : A ratio of less or equal than 0 will not effect the image.68 : <p>A ratio of less or equal than 0 will not effect the image.</p>
69 : Important note: this function does not change the size information stored in the69 : <p>Important note: this function does not change the size information stored in the
70 : image (e.g. basic:width will not show a different value).70 : image (e.g. basic:width will not show a different value).</p>
71 :71 :
72 : @param $image image to resize72 : @param $image image to resize
73 : @param $ratio ratio to zoom width and height by73 : @param $ratio ratio to zoom width and height by
74 : @return A copy of $image with resized content74 : @return A copy of $image with resized content
75 : @error ierr:IM001 passed image is invalid75 : @error ierr:INVALID_IMAGE the passed image is invalid.
76 : @example test/Queries/image/manipulation_zoom.xq76 : @example test/Queries/image/manipulation_zoom.xq
77 :)77 :)
78declare function man:zoom($image as xs:base64Binary, 78declare function man:zoom($image as xs:base64Binary,
79 $ratio as xs:double) as xs:base64Binary external; 79 $ratio as xs:double) as xs:base64Binary external;
8080
81(:~81(:~
82 : Zoom the passed image to a given new width while keeping the ratio between 82 : <p>Zoom the passed image to a given new width while keeping the ratio between
83 : width and height. 83 : width and height.</p>
84 : So, the height is scaled accordingly.84 : <p>So, the height is scaled accordingly.</p>
85 : Important note: this function does not change the size information stored 85 : <p>Important note: this function does not change the size information stored
86 : in the image (e.g. basic:width will not show a different value).86 : in the image (e.g. basic:width will not show a different value).</p>
87 : 87 :
88 : @param $image image to resize88 : @param $image image to resize
89 : @param $width new width for the image in pixels89 : @param $width new width for the image in pixels
90 : @return A copy of $image with given $width and height changed accordingly90 : @return A copy of $image with given $width and height changed accordingly
91 : @error ierr:IM001 passed image is invalid91 : @error ierr:INVALID_IMAGE the passed image is invalid.
92 : @example test/Queries/image/manipulation_zoom_width.xq92 : @example test/Queries/image/manipulation_zoom_width.xq
93 :)93 :)
94declare function man:zoom-by-width($image as xs:base64Binary, 94declare function man:zoom-by-width($image as xs:base64Binary,
@@ -96,26 +96,26 @@
9696
9797
98(:~98(:~
99 : Zoom the passed image to a given new height while keeping the ratio between 99 : <p>Zoom the passed image to a given new height while keeping the ratio between
100 : width and height.100 : width and height.</p>
101 : So, the width is scaled accordingly.101 : <p>So, the width is scaled accordingly.</p>
102 : Important note: this function does not change the size information stored 102 : <p>Important note: this function does not change the size information stored
103 : in the image (e.g. basic:width will not show a different value).103 : in the image (e.g. basic:width will not show a different value).</p>
104 : 104 :
105 : @param $image image to resize105 : @param $image image to resize
106 : @param $height new height for the image in pixels106 : @param $height new height for the image in pixels
107 : @return A copy of $image with given $height and width adjusted accordingly107 : @return A copy of $image with given $height and width adjusted accordingly
108 : @error ierr:IM001 passed image is invalid108 : @error ierr:INVALID_IMAGE the passed image is invalid.
109 : @example test/Queries/image/manipulation_zoom_height.xq109 : @example test/Queries/image/manipulation_zoom_height.xq
110 :)110 :)
111declare function man:zoom-by-height($image as xs:base64Binary, 111declare function man:zoom-by-height($image as xs:base64Binary,
112 $height as xs:unsignedInt) as xs:base64Binary external; 112 $height as xs:unsignedInt) as xs:base64Binary external;
113113
114(:~114(:~
115 : Copy a part of the source image specified by a rectangle. 115 : <p>Copy a part of the source image specified by a rectangle.</p>
116 : If the passed parameters for the sub-image specify a rectangle that isn't 116 : <p>If the passed parameters for the sub-image specify a rectangle that isn't
117 : entirely within the source image only the area that lies within the image 117 : entirely within the source image only the area that lies within the image
118 : boundaries will be returned.118 : boundaries will be returned.</p>
119 :119 :
120 : @param $image the image from which to extract a sub-image120 : @param $image the image from which to extract a sub-image
121 : @param $left-upper-x is the x value of the upper left corner of the rectangle121 : @param $left-upper-x is the x value of the upper left corner of the rectangle
@@ -125,7 +125,7 @@
125 : @param $width width of the rectangle to cut out125 : @param $width width of the rectangle to cut out
126 : @param $height height of the rectangle to cut out126 : @param $height height of the rectangle to cut out
127 : @return A new image containing parts of the source image127 : @return A new image containing parts of the source image
128 : @error ierr:IM001 passed image is invalid128 : @error ierr:INVALID_IMAGE the passed image is invalid.
129 : @example test/Queries/image/manipulation_sub_image.xq129 : @example test/Queries/image/manipulation_sub_image.xq
130 :)130 :)
131declare function man:sub-image($image as xs:base64Binary, 131declare function man:sub-image($image as xs:base64Binary,
@@ -135,10 +135,10 @@
135 $height as xs:unsignedInt) as xs:base64Binary external; 135 $height as xs:unsignedInt) as xs:base64Binary external;
136136
137(:~137(:~
138 : Overlay $image with $overlay-image at the specfied position.138 : <p>Overlay $image with $overlay-image at the specfied position.</p>
139 :139 : <p/>
140 : The $operator defines the details of the overlay and can have one of the 140 : <p>The $operator defines the details of the overlay and can have one of the
141 : following values:141 : following values:</p>
142 : <ul> 142 : <ul>
143 : <li>OverCompositeOp: The result is the union of the two image shapes 143 : <li>OverCompositeOp: The result is the union of the two image shapes
144 : with the overlay image obscuring image in the region of overlap.</li> 144 : with the overlay image obscuring image in the region of overlap.</li>
@@ -178,7 +178,7 @@
178 : @param $operator defines how the overlay image should be overlayed (see details178 : @param $operator defines how the overlay image should be overlayed (see details
179 : in operator listing above)179 : in operator listing above)
180 : @return A new image consisting of $image overlayed with $overlay-image.180 : @return A new image consisting of $image overlayed with $overlay-image.
181 : @error ierr:IM001 passed image is invalid181 : @error ierr:INVALID_IMAGE the passed image is invalid.
182 : @error err:FORG0001 unsupported operator182 : @error err:FORG0001 unsupported operator
183 : @example test/Queries/image/manipulation_overlay.xq183 : @example test/Queries/image/manipulation_overlay.xq
184 :)184 :)
@@ -202,14 +202,14 @@
202 as xs:base64Binary external; 202 as xs:base64Binary external;
203203
204(:~204(:~
205 : Copy a part of a source image as new image. 205 : <p>Copy a part of a source image as new image.</p>
206 : The copied part is all right of $upper-left-x and below $upper-left-y.206 : <p>The copied part is all right of $upper-left-x and below $upper-left-y.</p>
207 : 207 :
208 : @param $image source image208 : @param $image source image
209 : @param $upper-left-x x position of the upper left corner of the part to copy209 : @param $upper-left-x x position of the upper left corner of the part to copy
210 : @param $upper-left-y y position of the upper left corner of the part to copy210 : @param $upper-left-y y position of the upper left corner of the part to copy
211 : @return A new image copied from a part of source image211 : @return A new image copied from a part of source image
212 : @error ierr:IM001 passed image is invalid212 : @error ierr:INVALID_IMAGE the passed image is invalid.
213 : @example test/Queries/image/manipulation_chop.xq213 : @example test/Queries/image/manipulation_chop.xq
214 :)214 :)
215declare function man:chop($image as xs:base64Binary, 215declare function man:chop($image as xs:base64Binary,
@@ -217,14 +217,14 @@
217 $upper-left-y as xs:unsignedInt) as xs:base64Binary external; 217 $upper-left-y as xs:unsignedInt) as xs:base64Binary external;
218218
219(:~219(:~
220 : Copy a part of a source image as new image.220 : <p>Copy a part of a source image as new image.</p>
221 : The copied part is all left of $lower-right-x and above $lower-right-y.221 : <p>The copied part is all left of $lower-right-x and above $lower-right-y.</p>
222 : 222 :
223 : @param $image source image223 : @param $image source image
224 : @param $lower-right-x x position of the lower right corner of the part to copy224 : @param $lower-right-x x position of the lower right corner of the part to copy
225 : @param $lower-right-y y position of the lower right corner of the part to copy225 : @param $lower-right-y y position of the lower right corner of the part to copy
226 : @return A new image copied from a part of source image226 : @return A new image copied from a part of source image
227 : @error ierr:IM001 passed image is invalid227 : @error ierr:INVALID_IMAGE the passed image is invalid.
228 : @example test/Queries/image/manipulation_crop.xq228 : @example test/Queries/image/manipulation_crop.xq
229 :)229 :)
230declare function man:crop($image as xs:base64Binary, 230declare function man:crop($image as xs:base64Binary,
@@ -233,16 +233,16 @@
233233
234234
235(:~235(:~
236 : Get a new image as rotated copy of a passed source image (rotated by -360 to 236 : <p>Get a new image as rotated copy of a passed source image (rotated by -360 to
237 : 360 degrees).237 : 360 degrees).</p>
238 : The image is enlarged if this is required for containing the rotated image, 238 : <p>The image is enlarged if this is required for containing the rotated image,
239 : but never shrunk even if the rotation would make a smaller image possible.239 : but never shrunk even if the rotation would make a smaller image possible.</p>
240 :240 :
241 : @param $image source image.241 : @param $image source image.
242 : @param $angle between -360 to 360 degrees. Other values will be adjusted by 242 : @param $angle between -360 to 360 degrees. Other values will be adjusted by
243 : modulo 360243 : modulo 360
244 : @return A rotated copy of $image244 : @return A rotated copy of $image
245 : @error ierr:IM001 passed image is invalid245 : @error ierr:INVALID_IMAGE the passed image is invalid.
246 : @example test/Queries/image/manipulation_rotate.xq246 : @example test/Queries/image/manipulation_rotate.xq
247 :)247 :)
248declare function man:rotate($image as xs:base64Binary, 248declare function man:rotate($image as xs:base64Binary,
@@ -250,50 +250,50 @@
250250
251251
252(:~252(:~
253 : Set all pixels of the image to the current backround color.253 : <p>Set all pixels of the image to the current backround color.</p>
254 : In most cases, this will result in all pixels to be set to white.254 : <p>In most cases, this will result in all pixels to be set to white.</p>
255 :255 :
256 : @param $image image to erase256 : @param $image image to erase
257 : @return A copy of image with all pixels set to the current background color257 : @return A copy of image with all pixels set to the current background color
258 : @error ierr:IM001 passed image is invalid258 : @error ierr:INVALID_IMAGE the passed image is invalid.
259 : @example test/Queries/image/manipulation_erase.xq259 : @example test/Queries/image/manipulation_erase.xq
260 :)260 :)
261declare function man:erase($image as xs:base64Binary) as xs:base64Binary external; 261declare function man:erase($image as xs:base64Binary) as xs:base64Binary external;
262262
263(:~263(:~
264 : Flop an image (horizontal rotation).264 : <p>Flop an image (horizontal rotation).</p>
265 :265 :
266 : @param $image source image266 : @param $image source image
267 : @return A horizontally rotated copy of $image267 : @return A horizontally rotated copy of $image
268 : @error ierr:IM001 passed image is invalid268 : @error ierr:INVALID_IMAGE the passed image is invalid.
269 : @example test/Queries/image/manipulation_flop.xq269 : @example test/Queries/image/manipulation_flop.xq
270 :)270 :)
271declare function man:flop($image as xs:base64Binary) as xs:base64Binary external; 271declare function man:flop($image as xs:base64Binary) as xs:base64Binary external;
272272
273(:~273(:~
274 : Flip an image (vertical rotation).274 : <p>Flip an image (vertical rotation).</p>
275 :275 :
276 : @param $image source image276 : @param $image source image
277 : @return A vertically rotated copy of $image277 : @return A vertically rotated copy of $image
278 : @error ierr:IM001 passed image is invalid278 : @error ierr:INVALID_IMAGE the passed image is invalid.
279 : @example test/Queries/image/manipulation_flip.xq279 : @example test/Queries/image/manipulation_flip.xq
280 :)280 :)
281declare function man:flip($image as xs:base64Binary) as xs:base64Binary external; 281declare function man:flip($image as xs:base64Binary) as xs:base64Binary external;
282282
283(:~283(:~
284 : Trim edges of the image's background color from the image.284 : <p>Trim edges of the image's background color from the image.</p>
285 :285 :
286 : @param $image the source image286 : @param $image the source image
287 : @return A trimmed copy of $image287 : @return A trimmed copy of $image
288 : @error ierr:IM001 passed image is invalid288 : @error ierr:INVALID_IMAGE the passed image is invalid.
289 : @example test/Queries/image/manipulation_trim.xq289 : @example test/Queries/image/manipulation_trim.xq
290 :)290 :)
291declare function man:trim($image as xs:base64Binary) as xs:base64Binary external; 291declare function man:trim($image as xs:base64Binary) as xs:base64Binary external;
292292
293(:~293(:~
294 : Add noise to an image.294 : <p>Add noise to an image.</p>
295 :295 : <p/>
296 : Allowed noise types are: 296 : <p>Allowed noise types are:</p>
297 : <ul> 297 : <ul>
298 : <li>UniformNoise</li>298 : <li>UniformNoise</li>
299 : <li>GaussianNoise</li>299 : <li>GaussianNoise</li>
@@ -306,7 +306,7 @@
306 : @param $image the source image306 : @param $image the source image
307 : @param $noise-type specifies the type of noise to add 307 : @param $noise-type specifies the type of noise to add
308 : @return A copy of $image with added noise308 : @return A copy of $image with added noise
309 : @error ierr:IM001 passed image is invalid309 : @error ierr:INVALID_IMAGE the passed image is invalid.
310 : @error err:FORG0001 unsupported noise type310 : @error err:FORG0001 unsupported noise type
311 : @example test/Queries/image/manipulation_add_noise.xq311 : @example test/Queries/image/manipulation_add_noise.xq
312 :)312 :)
@@ -320,13 +320,13 @@
320 as xs:base64Binary external;320 as xs:base64Binary external;
321321
322(:~ 322(:~
323 : Blur an image.323 : <p>Blur an image.</p>
324 : 324 :
325 : @param $image the source image325 : @param $image the source image
326 : @param $radius is the radius of the Gaussian in pixels.326 : @param $radius is the radius of the Gaussian in pixels.
327 : @param $sigma is the standard deviation of the Laplacian in pixels.327 : @param $sigma is the standard deviation of the Laplacian in pixels.
328 : @return A blured copy of $image328 : @return A blured copy of $image
329 : @error ierr:IM001 passed image is invalid329 : @error ierr:INVALID_IMAGE the passed image is invalid.
330 : @example test/Queries/image/manipulation_blur.xq330 : @example test/Queries/image/manipulation_blur.xq
331 :)331 :)
332declare function man:blur($image as xs:base64Binary, 332declare function man:blur($image as xs:base64Binary,
@@ -334,55 +334,55 @@
334 $sigma as xs:int) as xs:base64Binary external; 334 $sigma as xs:int) as xs:base64Binary external;
335335
336(:~336(:~
337 : Despeckle an image.337 : <p>Despeckle an image.</p>
338 : 338 :
339 : @param $image the source image339 : @param $image the source image
340 : @return A despeckled copy of $image340 : @return A despeckled copy of $image
341 : @error ierr:IM001 passed image is invalid341 : @error ierr:INVALID_IMAGE the passed image is invalid.
342 : @example test/Queries/image/manipulation_despeckle.xq342 : @example test/Queries/image/manipulation_despeckle.xq
343 :)343 :)
344declare function man:despeckle($image as xs:base64Binary) as xs:base64Binary external; 344declare function man:despeckle($image as xs:base64Binary) as xs:base64Binary external;
345345
346(:~346(:~
347 : Enhance an images (minimizes noise).347 : <p>Enhance an images (minimizes noise).</p>
348 : 348 :
349 : @param $image the source image349 : @param $image the source image
350 : @return An enhanced copy of $image.350 : @return An enhanced copy of $image.
351 : @error ierr:IM001 passed image is invalid351 : @error ierr:INVALID_IMAGE the passed image is invalid.
352 : @example test/Queries/image/manipulation_enhance.xq352 : @example test/Queries/image/manipulation_enhance.xq
353 :) 353 :)
354declare function man:enhance($image as xs:base64Binary) as xs:base64Binary external; 354declare function man:enhance($image as xs:base64Binary) as xs:base64Binary external;
355355
356(:~356(:~
357 : Equalize an images (histogramm equalization).357 : <p>Equalize an images (histogramm equalization).</p>
358 : 358 :
359 : @param $image the source image359 : @param $image the source image
360 : @return An equalized copy of $image.360 : @return An equalized copy of $image.
361 : @error ierr:IM001 passed image is invalid361 : @error ierr:INVALID_IMAGE the passed image is invalid.
362 : @example test/Queries/image/manipulation_equalize.xq362 : @example test/Queries/image/manipulation_equalize.xq
363 :) 363 :)
364declare function man:equalize($image as xs:base64Binary) as xs:base64Binary external; 364declare function man:equalize($image as xs:base64Binary) as xs:base64Binary external;
365365
366(:~366(:~
367 : Highlight edges in an image.367 : <p>Highlight edges in an image.</p>
368 : 368 :
369 : @param $image the source image369 : @param $image the source image
370 : @param $radius radius of the pixel neighborhood (0 for automatic selection)370 : @param $radius radius of the pixel neighborhood (0 for automatic selection)
371 : @return An edged copy of $image371 : @return An edged copy of $image
372 : @error ierr:IM001 passed image is invalid372 : @error ierr:INVALID_IMAGE the passed image is invalid.
373 : @example test/Queries/image/manipulation_edge.xq373 : @example test/Queries/image/manipulation_edge.xq
374 :) 374 :)
375declare function man:edge($image as xs:base64Binary, 375declare function man:edge($image as xs:base64Binary,
376 $radius as xs:unsignedInt) as xs:base64Binary external; 376 $radius as xs:unsignedInt) as xs:base64Binary external;
377377
378(:~378(:~
379 : Apply a charcoal effect to the image (looks like a charcoal sketch).379 : <p>Apply a charcoal effect to the image (looks like a charcoal sketch).</p>
380 :380 :
381 : @param $image the source image381 : @param $image the source image
382 : @param $radius radius of the Gaussian in pixels382 : @param $radius radius of the Gaussian in pixels
383 : @param $sigma standard deviation of the Laplacian in pixels383 : @param $sigma standard deviation of the Laplacian in pixels
384 : @return A charcoaled copy of $image384 : @return A charcoaled copy of $image
385 : @error ierr:IM001 passed image is invalid385 : @error ierr:INVALID_IMAGE the passed image is invalid.
386 : @example test/Queries/image/manipulation_charcoal.xq386 : @example test/Queries/image/manipulation_charcoal.xq
387 :)387 :)
388declare function man:charcoal($image as xs:base64Binary, 388declare function man:charcoal($image as xs:base64Binary,
@@ -390,13 +390,13 @@
390 $sigma as xs:double) as xs:base64Binary external; 390 $sigma as xs:double) as xs:base64Binary external;
391391
392(:~392(:~
393 : Emboss an images (highlights edges with 3D effect).393 : <p>Emboss an images (highlights edges with 3D effect).</p>
394 : 394 :
395 : @param $image the source image395 : @param $image the source image
396 : @param $radius radius of the Gaussian in pixels396 : @param $radius radius of the Gaussian in pixels
397 : @param $sigma standard deviation of the Laplacian in pixels397 : @param $sigma standard deviation of the Laplacian in pixels
398 : @return An embossed copy of $image398 : @return An embossed copy of $image
399 : @error ierr:IM001 passed image is invalid399 : @error ierr:INVALID_IMAGE the passed image is invalid.
400 : @example test/Queries/image/manipulation_emboss.xq400 : @example test/Queries/image/manipulation_emboss.xq
401 :) 401 :)
402declare function man:emboss($image as xs:base64Binary, 402declare function man:emboss($image as xs:base64Binary,
@@ -404,23 +404,23 @@
404 $sigma as xs:double) as xs:base64Binary external; 404 $sigma as xs:double) as xs:base64Binary external;
405405
406(:~406(:~
407 : Apply a solarize effect to the image (similar to the effect seen when 407 : <p>Apply a solarize effect to the image (similar to the effect seen when
408 : exposing a photographic film to light during the development process).408 : exposing a photographic film to light during the development process).</p>
409 :409 :
410 : @param $image the source image410 : @param $image the source image
411 : @param $factor strength of the solarization (0 to 65535; 65535=100%)411 : @param $factor strength of the solarization (0 to 65535; 65535=100%)
412 : @return A solarized copy of $image.412 : @return A solarized copy of $image.
413 : @error ierr:IM001 passed image is invalid413 : @error ierr:INVALID_IMAGE the passed image is invalid.
414 : @example test/Queries/image/manipulation_solarize.xq414 : @example test/Queries/image/manipulation_solarize.xq
415 :)415 :)
416declare function man:solarize($image as xs:base64Binary, 416declare function man:solarize($image as xs:base64Binary,
417 $factor as xs:double) as xs:base64Binary external; 417 $factor as xs:double) as xs:base64Binary external;
418418
419(:~419(:~
420 : Make two passed images appear as stereo image when viewed with red-blue glasses.420 : <p>Make two passed images appear as stereo image when viewed with red-blue glasses.</p>
421 : Both images should be same but from a slightly different angle for this to work.421 : <p>Both images should be same but from a slightly different angle for this to work.</p>
422 : Both images should have the same size, if not, the size of the left image will 422 : <p>Both images should have the same size, if not, the size of the left image will
423 : be taken.423 : be taken.</p>
424 :424 :
425 : @param $left-image left image for the stereo image.425 : @param $left-image left image for the stereo image.
426 : @param $right-image right image for the stereo image.426 : @param $right-image right image for the stereo image.
@@ -432,15 +432,15 @@
432 $right-image as xs:base64Binary) as xs:base64Binary external; 432 $right-image as xs:base64Binary) as xs:base64Binary external;
433433
434(:~434(:~
435 : Make all pixels of the specfied color transparent.435 : <p>Make all pixels of the specfied color transparent.</p>
436 :436 : <p/>
437 : This works correctly only with image types supporting transparency 437 : <p>This works correctly only with image types supporting transparency
438 : (e.g GIF or PNG).438 : (e.g GIF or PNG).</p>
439 :439 :
440 : @param $image the source image440 : @param $image the source image
441 : @param $color color to make transparent (e.g. '#FFFFFF')441 : @param $color color to make transparent (e.g. '#FFFFFF')
442 : @return A copy of $image with the specified color made transparent.442 : @return A copy of $image with the specified color made transparent.
443 : @error ierr:IM001 passed image is invalid443 : @error ierr:INVALID_IMAGE the passed image is invalid.
444 : @error err:FORG0001 unsupported color444 : @error err:FORG0001 unsupported color
445 : @example test/Queries/image/manipulation_transparent.xq445 : @example test/Queries/image/manipulation_transparent.xq
446 :)446 :)
@@ -452,64 +452,64 @@
452declare %private function man:transparent-impl($image as xs:base64Binary, $color as image:colorType) as xs:base64Binary external; 452declare %private function man:transparent-impl($image as xs:base64Binary, $color as image:colorType) as xs:base64Binary external;
453453
454(:~454(:~
455 : Swirl an image (image pixels are rotated by degree).455 : <p>Swirl an image (image pixels are rotated by degree).</p>
456 :456 :
457 : @param $image the source image457 : @param $image the source image
458 : @param $degree degree to swirl image pixels458 : @param $degree degree to swirl image pixels
459 : @return A swirled copy of $image459 : @return A swirled copy of $image
460 : @error ierr:IM001 passed image is invalid460 : @error ierr:INVALID_IMAGE the passed image is invalid.
461 : @example test/Queries/image/manipulation_swirl.xq461 : @example test/Queries/image/manipulation_swirl.xq
462 :)462 :)
463declare function man:swirl($image as xs:base64Binary, 463declare function man:swirl($image as xs:base64Binary,
464 $degree as xs:double) as xs:base64Binary external; 464 $degree as xs:double) as xs:base64Binary external;
465465
466(:~466(:~
467 : Reduce noise of an image using a noise peak elemination filter.467 : <p>Reduce noise of an image using a noise peak elemination filter.</p>
468 :468 :
469 : @param $image the source image469 : @param $image the source image
470 : @param $order defines how much the noise is reduced470 : @param $order defines how much the noise is reduced
471 : @return A copy of $image with reduced noise471 : @return A copy of $image with reduced noise
472 : @error ierr:IM001 passed image is invalid472 : @error ierr:INVALID_IMAGE the passed image is invalid.
473 : @example test/Queries/image/manipulation_reduce_noise.xq473 : @example test/Queries/image/manipulation_reduce_noise.xq
474 :)474 :)
475declare function man:reduce-noise($image as xs:base64Binary, 475declare function man:reduce-noise($image as xs:base64Binary,
476 $order as xs:double) as xs:base64Binary external; 476 $order as xs:double) as xs:base64Binary external;
477 477
478(:~478(:~
479 : Contrast an image (enhances image intensity differences) by a given value.479 : <p>Contrast an image (enhances image intensity differences) by a given value.</p>
480 : 480 :
481 : @param $image the source image481 : @param $image the source image
482 : @param $sharpen defines how much the image is contrasted.482 : @param $sharpen defines how much the image is contrasted.
483 : @return A contrasted copy of $image 483 : @return A contrasted copy of $image
484 : @error ierr:IM001 passed image is invalid484 : @error ierr:INVALID_IMAGE the passed image is invalid.
485 : @example test/Queries/image/manipulation_contrast.xq485 : @example test/Queries/image/manipulation_contrast.xq
486 :)486 :)
487declare function man:contrast($image as xs:base64Binary, 487declare function man:contrast($image as xs:base64Binary,
488 $sharpen as xs:double) as xs:base64Binary external;488 $sharpen as xs:double) as xs:base64Binary external;
489489
490(:~490(:~
491 : Gamma correct an image.491 : <p>Gamma correct an image.</p>
492 : Gamma values less than zero will erase the image.492 : <p>Gamma values less than zero will erase the image.</p>
493 : 493 :
494 : @param $image the source image494 : @param $image the source image
495 : @param $gamma-value value for which to gamma correct the image495 : @param $gamma-value value for which to gamma correct the image
496 : @return A gamma corrected copy of $image496 : @return A gamma corrected copy of $image
497 : @error ierr:IM001 passed image is invalid497 : @error ierr:INVALID_IMAGE the passed image is invalid.
498 : @example test/Queries/image/manipulation_gamma.xq498 : @example test/Queries/image/manipulation_gamma.xq
499 :)499 :)
500declare function man:gamma($image as xs:base64Binary, 500declare function man:gamma($image as xs:base64Binary,
501 $gamma-value as xs:double) as xs:base64Binary external;501 $gamma-value as xs:double) as xs:base64Binary external;
502502
503(:~503(:~
504 : Gamma correct an image for every color channel seperately.504 : <p>Gamma correct an image for every color channel seperately.</p>
505 : Gamma values less than zero for any color will erase the corresponding color.505 : <p>Gamma values less than zero for any color will erase the corresponding color.</p>
506 : 506 :
507 : @param $image the source image507 : @param $image the source image
508 : @param $gamma-red value to gamma correct the red channel of the image508 : @param $gamma-red value to gamma correct the red channel of the image
509 : @param $gamma-green value to gamma correct the green channel of the image509 : @param $gamma-green value to gamma correct the green channel of the image
510 : @param $gamma-blue value to gamma correct the blue channel of the image510 : @param $gamma-blue value to gamma correct the blue channel of the image
511 : @return A gamma corrected copy of $image511 : @return A gamma corrected copy of $image
512 : @error ierr:IM001 passed image is invalid512 : @error ierr:INVALID_IMAGE the passed image is invalid.
513 : @example test/Queries/image/manipulation_gamma2.xq513 : @example test/Queries/image/manipulation_gamma2.xq
514 :)514 :)
515declare function man:gamma($image as xs:base64Binary, 515declare function man:gamma($image as xs:base64Binary,
@@ -518,32 +518,32 @@
518 $gamma-blue as xs:double) as xs:base64Binary external; 518 $gamma-blue as xs:double) as xs:base64Binary external;
519 519
520(:~520(:~
521 : Apply an implode effect to an image (a sort of special effect).521 : <p>Apply an implode effect to an image (a sort of special effect).</p>
522 : 522 :
523 : @param $image the source image523 : @param $image the source image
524 : @param $factor factor to implode to524 : @param $factor factor to implode to
525 : @return An imploded copy of $image.525 : @return An imploded copy of $image.
526 : @error ierr:IM001 passed image is invalid526 : @error ierr:INVALID_IMAGE the passed image is invalid.
527 : @example test/Queries/image/manipulation_implode.xq 527 : @example test/Queries/image/manipulation_implode.xq
528 :)528 :)
529declare function man:implode($image as xs:base64Binary, 529declare function man:implode($image as xs:base64Binary,
530 $factor as xs:double) as xs:base64Binary external; 530 $factor as xs:double) as xs:base64Binary external;
531531
532(:~532(:~
533 : Apply an oil paint effect to an image (makes the image look as if it was 533 : <p>Apply an oil paint effect to an image (makes the image look as if it was
534 : an oil paint).534 : an oil paint).</p>
535 :535 :
536 : @param $image the source image536 : @param $image the source image
537 : @param $radius radius with which to oil paint537 : @param $radius radius with which to oil paint
538 : @return A oil-painted copy of $image538 : @return A oil-painted copy of $image
539 : @error ierr:IM001 passed image is invalid539 : @error ierr:INVALID_IMAGE the passed image is invalid.
540 : @example test/Queries/image/manipulation_oil_paint.xq540 : @example test/Queries/image/manipulation_oil_paint.xq
541 :)541 :)
542declare function man:oil-paint($image as xs:base64Binary, 542declare function man:oil-paint($image as xs:base64Binary,
543 $radius as xs:double) as xs:base64Binary external; 543 $radius as xs:double) as xs:base64Binary external;
544 544
545(:~545(:~
546 : Add a $watermark image to $image.546 : <p>Add a $watermark image to $image.</p>
547 : 547 :
548 : @param $image the source image548 : @param $image the source image
549 : @param $watermark the watermark image549 : @param $watermark the watermark image
550550
=== renamed directory 'src/com/zorba-xquery/www/modules/image/manipulation.xq.src' => 'src/manipulation.xq.src'
=== modified file 'src/manipulation.xq.src/manipulation_module.h'
--- src/com/zorba-xquery/www/modules/image/manipulation.xq.src/manipulation_module.h 2011-10-06 08:18:47 +0000
+++ src/manipulation.xq.src/manipulation_module.h 2013-10-23 04:15:35 +0000
@@ -31,7 +31,7 @@
31 31
32 32
33 virtual String33 virtual String
34 getURI() const { return "http://www.zorba-xquery.com/modules/image/manipulation"; }34 getURI() const { return "http://zorba.io/modules/image/manipulation"; }
35 35
36 virtual ExternalFunction*36 virtual ExternalFunction*
37 getExternalFunction(const String& aLocalname);37 getExternalFunction(const String& aLocalname);
3838
=== renamed file 'src/com/zorba-xquery/www/modules/image/paint.xq' => 'src/paint.xq'
--- src/com/zorba-xquery/www/modules/image/paint.xq 2013-08-09 09:37:05 +0000
+++ src/paint.xq 2013-10-23 04:15:35 +0000
@@ -17,9 +17,9 @@
17:)17:)
1818
19(:~19(:~
20 : This module provides a function to extend an image with additional shapes. 20 : <p>This module provides a function to extend an image with additional shapes.</p>
21 : 21 : <p/>
22 : Fully supported image formats are:22 : <p>Fully supported image formats are:</p>
23 : <ul>23 : <ul>
24 : <li>GIF</li>24 : <li>GIF</li>
25 : <li>JPEG</li>25 : <li>JPEG</li>
@@ -29,136 +29,169 @@
29 : </ul>29 : </ul>
30 :30 :
31 : <p>The errors raised by functions of this module have the namespace31 : <p>The errors raised by functions of this module have the namespace
32 : <tt>http://www.zorba-xquery.com/modules/image/error</tt> (associated with prefix ierr).</p>32 : <tt>http://zorba.io/modules/image/error</tt> (associated with prefix ierr).</p>
33 :33 :
34 : @author Daniel Thomas34 : @author Daniel Thomas
35 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>35 : @library <a href="http://www.imagemagick.org/Magick++/">Magick++ C++ Library</a>
36 : @project Zorba/Image/Paint36 : @project Zorba/Image/Paint
37 :37 :
38 :)38 :)
39module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';39module namespace paint = 'http://zorba.io/modules/image/paint';
4040
41import schema namespace img = 'http://www.zorba-xquery.com/modules/image/image';41import schema namespace img = 'http://zorba.io/modules/image/image';
4242
43declare namespace err = "http://www.w3.org/2005/xqt-errors";43declare namespace err = "http://www.w3.org/2005/xqt-errors";
44declare namespace ierr = "http://www.zorba-xquery.com/modules/image/error";44declare namespace ierr = "http://zorba.io/modules/image/error";
45declare namespace ver = "http://zorba.io/options/versioning";45declare namespace ver = "http://zorba.io/options/versioning";
46declare option ver:module-version "1.0";46declare option ver:module-version "1.0";
4747
4848
49(:~49(:~
50 : Extends the passed image with a sequence of shapes. 50 : <p>Extends the passed image with a sequence of shapes.</p>
51 : The shapes are passed as a sequence of elements.51 : <p>The shapes are passed as a sequence of elements.</p>
52 : The possibilities for shape elements are:52 : <p>The possibilities for shape elements are:</p>
53 : <ul>53 : <ul>
54 : <li> line: 54 : <li> line:
55 : <pre class="brush: xml">55 : <pre class="brush: json">
56 : &lt;img:line&gt;56 : {
57 : &lt;img:start&gt;&lt;img:x&gt;-20&lt;/img:x&gt;&lt;img:y&gt;-20&lt;/img:y&gt;&lt;/img:start&gt;57 : "line" :
58 : &lt;img:end&gt;&lt;img:x&gt;80&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/img:end&gt;58 : {
59 : &lt;/img:line&gt;</pre>59 : "start" : [0, 0],
60 : "end" : [80, 80]
61 : }
62 : }
63 : </pre>
60 : </li> 64 : </li>
61 : <li> polyline: 65 : <li> polyline:
62 : <pre class="brush: xml">66 : <pre class="">
63 : &lt;img:polyLine&gt;67 : {
64 : &lt;img:point&gt;&lt;img:x&gt;10&lt;/img:x&gt;&lt;img:y&gt;10&lt;/img:y&gt;&lt;/img:point&gt;68 : "polyLine" :
65 : &lt;img:point&gt;&lt;img:x&gt;40&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/point&gt;69 : {
66 : &lt;img:point&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;30&lt;/img:y&gt;&lt;/point&gt;70 : "points" : [ [10, 10], [30, 10], [30, 30], [10, 30] ]
67 : &lt;img:point&gt;&lt;img:x&gt;200&lt;/img:x&gt;&lt;img:y&gt;200&lt;/img:y&gt;&lt;/point&gt;71 : }
68 : &lt;/img:polyLine&gt; 72 : }
69 : </pre>73 : </pre>
70 : </li>74 : </li>
71 : <li> stroked polyline: 75 : <li> stroked polyline:
72 : <pre class="brush: xml">76 : <pre class="brush: xml">
73 : &lt;img:strokedPolyLine&gt;77 : {
74 : &lt;img:point&gt;&lt;img:x&gt;10&lt;/img:x&gt;&lt;img:y&gt;10&lt;/img:y&gt;&lt;/img:point&gt;78 : "strokedPolyLine" :
75 : &lt;img:point&gt;&lt;img:x&gt;40&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/img:point&gt;79 : {
76 : &lt;img:point&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;30&lt;/img:y&gt;&lt;/img:point&gt;80 : "points" : [ [10, 10], [40, 80], [50, 30] ],
77 : &lt;img:strokeLength&gt;5&lt;/img:strokeLength&gt;&lt;img:gapLength&gt;2&lt;/img:gapLength&gt;81 : "strokeLength" : 10,
78 : &lt;/img:strokedPolyLine&gt;82 : "gapLength" : 2
83 : }
84 : }
79 : </pre>85 : </pre>
80 : </li>86 : </li>
81 : <li> rectangle:87 : <li> rectangle:
82 : <pre class="brush: xml">88 : <pre class="brush: xml">
83 : &lt;img:rectangle&gt;89 : {
84 : &lt;img:upperLeft&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:upperLeft&gt;90 : "rectangle" :
85 : &lt;img:lowerRight&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:lowerRight&gt;91 : {
86 : &lt;/img:rectangle&gt;92 : "upperLeft" : [ 20, 20 ],
93 : "lowerRight" : [ 50, 50 ]
94 : }
95 : }
87 : </pre>96 : </pre>
88 : </li>97 : </li>
89 : <li> rounded rectangle: 98 : <li> rounded rectangle:
90 : <pre class="brush: xml">99 : <pre class="brush: json">
91 : &lt;img:roundedRectangle&gt;100 : { "roundedRectangle" :
92 : &lt;img:upperLeft&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:upperLeft&gt;101 : {
93 : &lt;img:lowerRight&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:lowerRight&gt;102 : "upperLeft" : [ 20, 20 ],
94 : &lt;img:cornerWidth&gt;10&lt;/img:cornerWidth&gt;&lt;img:cornerHeight&gt;10&lt;/img:cornerHeight&gt;103 : "lowerRight" : [ 50, 50 ],
95 : &lt;/img:roundedRectangle&gt;104 : "cornerWidth" : 10,
105 : "cornerHeight" : 10
106 : }
107 : }
96 : </pre>108 : </pre>
97 : </li>109 : </li>
98 : <li> circle: 110 : <li> circle:
99 : <pre class="brush: xml">111 : <pre class="brush: json">
100 : &lt;img:circle&gt;112 : {
101 : &lt;img:origin&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:origin&gt;113 : "circle" :
102 : &lt;img:perimeter&gt;5&lt;/img:perimeter&gt;114 : {
103 : &lt;/img:circle&gt;115 : "origin" : [ 50, 50 ],
116 : "radius" : 5
117 : }
118 : }
104 : </pre>119 : </pre>
105 : </li>120 : </li>
106 : <li> ellipse: 121 : <li> ellipse:
107 : <pre class="brush: xml">122 : <pre class="brush: json">
108 : &lt;img:ellipse&gt;123 : {
109 : &lt;img:origin&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:origin&gt;124 : "ellipse" :
110 : &lt;img:perimeterX&gt;30&lt;/img:perimeterX&gt;&lt;img:perimeterY&gt;20&lt;/img:perimeterY&gt;125 : {
111 : &lt;/img:ellipse&gt;126 : "origin" : [ 50, 50 ],
127 : "radiusX" : 30,
128 : "radiusY" : 20
129 : }
130 : }
112 : </pre>131 : </pre>
113 : </li>132 : </li>
114 : <li> arc: 133 : <li> arc:
115 : <pre class="brush: xml">134 : <pre class="brush: json">
116 : &lt;img:arc&gt;135 : {
117 : &lt;img:origin&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:origin&gt;136 : "arc" :
118 : &lt;img:perimeterX&gt;10&lt;/img:perimeterX&gt;&lt;img:perimeterY&gt;20&lt;/img:perimeterY&gt;137 : {
119 : &lt;img:startDegrees&gt;180&lt;/img:startDegrees&gt;&lt;img:endDegrees&gt;270&lt;/img:endDegrees&gt;138 : "origin" : [ 50, 50 ],
120 : &lt;/img:arc&gt;139 : "radiusX" : 10,
140 : "radiusY" : 20,
141 : "startDegrees" : 180,
142 : "endDegrees" : 270
143 : }
144 : }
121 : </pre>145 : </pre>
122 : </li>146 : </li>
123 : <li> polygon: 147 : <li> polygon:
124 : <pre class="brush: xml">148 : <pre class="brush: json">
125 : &lt;img:polygon&gt;149 : {
126 : &lt;img:point&gt;&lt;img:x&gt;10&lt;/img:x&gt;&lt;img:y&gt;10&lt;/img:y&gt;&lt;/img:point&gt;150 : "polygon" :
127 : &lt;img:point&gt;&lt;img:x&gt;40&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/img:point&gt;151 : {
128 : &lt;img:point&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;30&lt;/img:y&gt;&lt;/img:point&gt;152 : "points" : [ [10, 10], [30, 10], [30, 30] ]
129 : &lt;/img:polygon&gt;153 : }
154 : }
130 : </pre>155 : </pre>
131 : </li>156 : </li>
132 : <li> text: 157 : <li> text:
133 : <pre class="brush: xml">158 : <pre class="brush: json">
134 : &lt;img:text&gt;159 : {
135 : &lt;img:origin&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:origin&gt;160 : "text" :
136 : &lt;img:text&gt;Hello Zorba&lt;/img:text&gt;&lt;img:font&gt;&lt;/img:font&gt;&lt;img:font-size&gt;12&lt;/img:font-size&gt;161 : {
137 : &lt;/img:text&gt;162 : "origin" : [ 50, 50 ],
163 : "text" : "Hello World!",
164 : "font" : "Arial",
165 : "font-size" : 12
166 : }
167 : }
138 : </pre>168 : </pre>
139 : </li>169 : </li>
140 : </ul>170 : </ul>
141 : 171 : <p/>
142 : Optionally, each of the shape elements can contain elements to define the stroke with, stroke color, fill color, and anti-aliasing.172 : <p>Optionally, each of the shape elements can contain elements to define the stroke with, stroke color, fill color, and anti-aliasing.</p>
143 : E.g.:173 : <p>E.g.:</p>
144 : <p>174 : <p>
145 : <pre class="brush: xml">175 : <pre class="brush: json">
146 : &lt;img:rectangle&gt;176 : {
147 : &lt;img:strokeWidth&gt;5&lt;/img:strokeWidth&gt;177 : "polygon" :
148 : &lt;img:strokeColor&gt;#00AF00&lt;/img:strokeColor&gt;178 : {
149 : &lt;img:fillColor&gt;#A10000&lt;/img:fillColor&gt;179 : "strokeWidth" : 3,
150 : &lt;img:antiAliasing&gt;true&lt;/img:antiAliasing&gt;180 : "strokeColor" : "#FF0000",
151 : &lt;img:upperLeft&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:upperLeft&gt;181 : "fillColor" : "#00FF00",
152 : &lt;img:lowerRight&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:lowerRight&gt;182 : "antiAliasing" : fn:true(),
153 : &lt;/img:rectangle&gt;183 : "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
184 : }
185 : }
154 : </pre>186 : </pre>
155 : </p>187 : </p>
156 : 188 :
157 : @param $image the passed image189 : @param $image the passed image
158 : @param $shapes the shapes190 : @param $shapes the shapes
159 : @return image with additional shapes 191 : @return image with additional shapes
160 : @error ierr:IM001 the passed image is invalid.192 : @error ierr:INVALID_IMAGE the passed image is invalid.
161 : @error err:FORG0001 one of the passed shape elements is invalid. 193 : @error err::XPTY0004 empty sequence not allowed.
194 : @error err:FORG0001 one of the passed shape objects is invalid.
162 : @example test/Queries/image/paint_different_lines.xq195 : @example test/Queries/image/paint_different_lines.xq
163 : @example test/Queries/image/paint_polyline.xq196 : @example test/Queries/image/paint_polyline.xq
164 : @example test/Queries/image/paint_stroked_polyline.xq197 : @example test/Queries/image/paint_stroked_polyline.xq
@@ -167,10 +200,10 @@
167 : @example test/Queries/image/paint_circles.xq200 : @example test/Queries/image/paint_circles.xq
168 : @example test/Queries/image/paint_text.xq201 : @example test/Queries/image/paint_text.xq
169 :)202 :)
170declare function paint:paint($image as xs:base64Binary, $shapes as element()*) as xs:base64Binary {203declare function paint:paint($image as xs:base64Binary, $shapes as object()*) as xs:base64Binary {
171 204 (: missing json validation :)
172 paint:paint-impl($image, for $x in $shapes return validate{$x})205 paint:paint-impl($image, for $x in $shapes return $x)
173};206};
174207
175declare %private function paint:paint-impl($image as xs:base64Binary, $shapes as element(*, img:paintableType)*) as xs:base64Binary external; 208declare %private function paint:paint-impl($image as xs:base64Binary, $shapes as object()*) as xs:base64Binary external;
176209
177210
=== renamed directory 'src/com/zorba-xquery/www/modules/image/paint.xq.src' => 'src/paint.xq.src'
=== modified file 'src/paint.xq.src/paint.cpp'
--- src/com/zorba-xquery/www/modules/image/paint.xq.src/paint.cpp 2013-06-21 03:28:34 +0000
+++ src/paint.xq.src/paint.cpp 2013-10-23 04:15:35 +0000
@@ -67,87 +67,96 @@
67}67}
6868
69bool69bool
70PaintImplFunction::getCommonValues(Iterator_t& aChildIterator, 70PaintImplFunction::getCommonValues(Item& aObject,
71 Item& aLastItemFound,
72 double* aStrokeWidth, 71 double* aStrokeWidth,
73 std::string& aStrokeColor, 72 std::string& aStrokeColor,
74 std::string& aFillColor) const {73 std::string& aFillColor) const {
75
76 bool lFoundStrokeWidth = false;74 bool lFoundStrokeWidth = false;
77 bool lFoundStrokeColor = false;75 bool lFoundStrokeColor = false;
78 bool lFoundFillColor = false;76 bool lFoundFillColor = false;
77 bool lFoundAntialising = false;
79 // fill in default values78 // fill in default values
80 *aStrokeWidth = 1;79 *aStrokeWidth = 1;
81 aStrokeColor = "#000000";80 aStrokeColor = "#000000";
82 aFillColor = "#FFFFFF";81 aFillColor = "#FFFFFF";
83 bool lAntiAliasing = false;82 bool lAntiAliasing = false;
84 83
85 aChildIterator->next(aLastItemFound);84 //we check for the 4 common objects inside the shapes object value
86 // we just check through the first four elements85 Iterator_t lKeys = aObject.getObjectKeys();
87 for (int i = 0; i < 4; ++i) {86 Item lKey;
88 Item lNodeName; 87 lKeys->open();
89 aLastItemFound.getNodeName(lNodeName);88 while (lKeys->next(lKey))
90 String lName = lNodeName.getStringValue(); 89 {
91 90 String lStrKey = lKey.getStringValue();
92 if (!lFoundStrokeWidth && fn::ends_with(lName,"Width")) {91 if (!lFoundStrokeWidth && fn::ends_with(lStrKey, "eWidth"))
93 *aStrokeWidth = getDoubleValue(aLastItemFound); 92 {
93 Item lValue = aObject.getObjectValue(lStrKey);
94 *aStrokeWidth = getDoubleValue(lValue);
94 lFoundStrokeWidth = true;95 lFoundStrokeWidth = true;
95 aChildIterator->next(aLastItemFound);96 }
96 } else if (!lFoundStrokeColor && fn::ends_with(lName,"eColor")) {97 else if (!lFoundStrokeColor && fn::ends_with(lStrKey, "eColor"))
97 aStrokeColor = aLastItemFound.getStringValue().c_str();98 {
99 Item lValue = aObject.getObjectValue(lStrKey);
100 aStrokeColor = lValue.getStringValue().c_str();
98 lFoundStrokeColor = true;101 lFoundStrokeColor = true;
99 aChildIterator->next(aLastItemFound);102 }
100 if (i < 1) { i = 1; }103 else if (!lFoundFillColor && fn::ends_with(lStrKey, "Color"))
101 } else if (!lFoundFillColor && fn::ends_with(lName,"Color")) {104 {
102 aFillColor = aLastItemFound.getStringValue().c_str();105 Item lValue = aObject.getObjectValue(lStrKey);
106 aFillColor = lValue.getStringValue().c_str();
103 lFoundFillColor = true;107 lFoundFillColor = true;
104 aChildIterator->next(aLastItemFound);108 }
105 if (i < 2) { i = 2; }109 else if (!lFoundAntialising && fn::ends_with(lStrKey, "ing"))
106 } else if (fn::ends_with(lName,"ing")) {110 {
107 String lAntiAliasingString = aLastItemFound.getStringValue();111 Item lValue = aObject.getObjectValue(lStrKey);
108 if (fn::ends_with(lAntiAliasingString,"ue")) {112 String lAntialisingString = lValue.getStringValue();
113 if (fn::ends_with(lAntialisingString, "ue"))
114 {
109 lAntiAliasing = true;115 lAntiAliasing = true;
110 } else {116 }
117 else
118 {
111 lAntiAliasing = false;119 lAntiAliasing = false;
112 } 120 }
113 121 }
114 // iterate to next and break122 }
115 aChildIterator->next(aLastItemFound); 123 lKeys->close();
116 break;
117 }
118 124
119 }
120 return lAntiAliasing;125 return lAntiAliasing;
121} 126}
122
123127
124void128void
125PaintImplFunction::applyShape(Magick::Blob& aBlob, Item& aShape) const {129PaintImplFunction::applyShape(Magick::Blob& aBlob, Item& aShape) const {
126 Item lNodeName;130 Iterator_t lObjIter = aShape.getObjectKeys();
127 aShape.getNodeName(lNodeName);131 Item lKey;
128 String lName = lNodeName.getStringValue();132 lObjIter->open();
129 // removing the uri prefix133 while ( lObjIter->next(lKey) )
130 if (fn::ends_with(lName,"line")) {134 {
131 applyLine(aBlob, aShape);135 String lStrKey = lKey.getStringValue();
132 } else if (fn::ends_with(lName,"dPolyLine")) {136 Item lValue = aShape.getObjectValue(lStrKey);
133 applyStrokedPolyLine(aBlob, aShape);137 if (fn::ends_with(lStrKey, "line")) {
134 } else if (fn::ends_with(lName,"Line")) {138 applyLine(aBlob, lValue);
135 applyPolyLine(aBlob, aShape);139 } else if (fn::ends_with(lStrKey, "dPolyLine")) {
136 } else if (fn::ends_with(lName,"rectangle")) {140 applyStrokedPolyLine(aBlob, lValue);
137 applyRectangle(aBlob, aShape);141 } else if (fn::ends_with(lStrKey, "Line")) {
138 } else if (fn::ends_with(lName,"gle")) {142 applyPolyLine(aBlob, lValue);
139 applyRoundedRectangle(aBlob, aShape);143 } else if (fn::ends_with(lStrKey,"rectangle")) {
140 } else if (fn::ends_with(lName,"cle")) {144 applyRectangle(aBlob, lValue);
141 applyCircle(aBlob, aShape);145 } else if (fn::ends_with(lStrKey, "gle")) {
142 } else if (fn::ends_with(lName,"se")) {146 applyRoundedRectangle(aBlob, lValue);
143 applyEllipse(aBlob, aShape);147 } else if (fn::ends_with(lStrKey, "cle")) {
144 } else if (fn::ends_with(lName,"c")) {148 applyCircle(aBlob, lValue);
145 applyArc(aBlob, aShape);149 } else if (fn::ends_with(lStrKey, "se")) {
146 } else if (fn::ends_with(lName,"n")) {150 applyEllipse(aBlob, lValue);
147 applyPolygon(aBlob, aShape);151 } else if (fn::ends_with(lStrKey, "c")) {
148 } else if (fn::ends_with(lName,"t")) {152 applyArc(aBlob, lValue);
149 applyText(aBlob, aShape);153 } else if (fn::ends_with(lStrKey, "n")) {
154 applyPolygon(aBlob, lValue);
155 } else if (fn::ends_with(lStrKey, "t")) {
156 applyText(aBlob, lValue);
150 } 157 }
158 }
159 lObjIter->close();
151}160}
152161
153162
@@ -163,46 +172,27 @@
163172
164void173void
165PaintImplFunction::getDoublesFromPoint(Item& aPoint, double aPointValues[2]) const {174PaintImplFunction::getDoublesFromPoint(Item& aPoint, double aPointValues[2]) const {
166 Item lXItem, lYItem, lX, lY;175 Item lX, lY;
167176 lX = aPoint.getArrayValue(1);
168 Iterator_t lPointChildren = aPoint.getChildren();177 lY = aPoint.getArrayValue(2);
169 lPointChildren->open();
170 lPointChildren->next(lXItem);
171 Iterator_t lXItemIterator = lXItem.getChildren();
172 lXItemIterator->open();
173 lXItemIterator->next(lX);
174 lXItemIterator->close();
175
176 lPointChildren->next(lYItem);
177 Iterator_t lYItemIterator = lYItem.getChildren();
178 lYItemIterator->open();
179 lYItemIterator->next(lY);
180 lYItemIterator->close();
181 lPointChildren->close();
182
183 aPointValues[0] = getDoubleValue(lX);178 aPointValues[0] = getDoubleValue(lX);
184 aPointValues[1] = getDoubleValue(lY);179 aPointValues[1] = getDoubleValue(lY);
185
186}180}
187181
188
189void 182void
190PaintImplFunction::applyLine(Magick::Blob& aBlob, Item& aLine) const {183PaintImplFunction::applyLine(Magick::Blob& aBlob, Item& aLine) const {
191 Item lStartPoint, lEndPoint;184 Item lStartPoint, lEndPoint;
192 Iterator_t lChildren = aLine.getChildren();
193 lChildren->open();
194 double lStrokeWidth = 0;185 double lStrokeWidth = 0;
195 std::string lStrokeColor = "";186 std::string lStrokeColor = "";
196 std::string lFillColor = "";187 std::string lFillColor = "";
197 bool lAntiAliasing; 188 bool lAntiAliasing;
198 // lStartPoint will contain the item of the start point after this operation
199 lAntiAliasing = getCommonValues(lChildren, lStartPoint, &lStrokeWidth, lStrokeColor, lFillColor);
200
201 lChildren->next(lEndPoint);
202 lChildren->close();
203
204 double lFirst[2];189 double lFirst[2];
205 double lSecond[2];190 double lSecond[2];
191
192 // set common values from JSON
193 lAntiAliasing = getCommonValues(aLine, &lStrokeWidth, lStrokeColor, lFillColor);
194 lStartPoint = aLine.getObjectValue("start");
195 lEndPoint = aLine.getObjectValue("end");
206 getDoublesFromPoint(lStartPoint, lFirst);196 getDoublesFromPoint(lStartPoint, lFirst);
207 getDoublesFromPoint(lEndPoint, lSecond);197 getDoublesFromPoint(lEndPoint, lSecond);
208 double lXValues[2] = {lFirst[0], lSecond[0]};198 double lXValues[2] = {lFirst[0], lSecond[0]};
@@ -217,41 +207,34 @@
217207
218void208void
219PaintImplFunction::applyPolyLine(Magick::Blob& aBlob, Item& aLine) const {209PaintImplFunction::applyPolyLine(Magick::Blob& aBlob, Item& aLine) const {
220 Item lFirstPoint;
221 Iterator_t lChildren = aLine.getChildren();
222 lChildren->open();
223 double lStrokeWidth = 0; 210 double lStrokeWidth = 0;
224 std::string lStrokeColor = "";211 std::string lStrokeColor = "";
225 std::string lFillColor = "";212 std::string lFillColor = "";
226 bool lAntiAliasing;213 bool lAntiAliasing;
227
228 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
229
230 std::vector<double> lXValues;214 std::vector<double> lXValues;
231 std::vector<double> lYValues;215 std::vector<double> lYValues;
216 double lTempPoint[2];
217 int lSize = 1;
232218
233 double lFirst[2];219 lAntiAliasing = getCommonValues(aLine, &lStrokeWidth, lStrokeColor, lFillColor);
234 getDoublesFromPoint(lFirstPoint, lFirst);220
235 lXValues.push_back(lFirst[0]);221 Item lPoints = aLine.getObjectValue("points");
236 lYValues.push_back(lFirst[1]);222 lSize = lPoints.getArraySize();
237 Item lPoint;223 for (int i = 1; i <= lSize; i++)
238 int lCounter = 1;224 {
239 while(lChildren->next(lPoint)) {225 Item lPoint = lPoints.getArrayValue(i);
240 lCounter++;226 getDoublesFromPoint(lPoint, lTempPoint);
241 double lPointValues[2];227 lXValues.push_back(lTempPoint[0]);
242 getDoublesFromPoint(lPoint, lPointValues);228 lYValues.push_back(lTempPoint[1]);
243 lXValues.push_back(lPointValues[0]);
244 lYValues.push_back(lPointValues[1]);
245 }229 }
246 lChildren->close();
247 230
248 long lBlobLength = (long) aBlob.length();231 long lBlobLength = (long) aBlob.length();
249 double* lXValuesArray = new double[lCounter];232 double* lXValuesArray = new double[lSize];
250 double* lYValuesArray = new double[lCounter];233 double* lYValuesArray = new double[lSize];
251 std::memcpy(lXValuesArray, &lXValues[0], lCounter*sizeof(lXValues[0]));234 std::memcpy(lXValuesArray, &lXValues[0], lSize*sizeof(lXValues[0]));
252 std::memcpy(lYValuesArray, &lYValues[0], lCounter*sizeof(lYValues[0]));235 std::memcpy(lYValuesArray, &lYValues[0], lSize*sizeof(lYValues[0]));
253 236
254 void * lBlobPointer = DrawPolyLine(aBlob.data(), &lBlobLength, &lXValuesArray[0], &lYValuesArray[0], lCounter, lStrokeColor, lStrokeWidth, lAntiAliasing, NULL, 0);237 void * lBlobPointer = DrawPolyLine(aBlob.data(), &lBlobLength, &lXValuesArray[0], &lYValuesArray[0], lSize, lStrokeColor, lStrokeWidth, lAntiAliasing, NULL, 0);
255 238
256 delete[] lXValuesArray;239 delete[] lXValuesArray;
257 delete[] lYValuesArray;240 delete[] lYValuesArray;
@@ -260,59 +243,47 @@
260 // now read the blob back into an image to pass it back as encoded string 243 // now read the blob back into an image to pass it back as encoded string
261 aBlob = lBlobWithPolyLine;244 aBlob = lBlobWithPolyLine;
262 245
263
264}246}
265247
266void248void
267PaintImplFunction::applyStrokedPolyLine(Magick::Blob& aBlob, Item& aLine) const {249PaintImplFunction::applyStrokedPolyLine(Magick::Blob& aBlob, Item& aLine) const {
268 Item lFirstPoint;250 Item lFirstPoint;
269 Iterator_t lChildren = aLine.getChildren();
270 lChildren->open();
271 double lStrokeWidth = 0; 251 double lStrokeWidth = 0;
272 std::string lStrokeColor = "";252 std::string lStrokeColor = "";
273 std::string lFillColor = "";253 std::string lFillColor = "";
274 bool lAntiAliasing;254 bool lAntiAliasing;
275 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
276 std::vector<double> lXValues;255 std::vector<double> lXValues;
277 std::vector<double> lYValues;256 std::vector<double> lYValues;
278257 double lTempPoint[2];
279 double lFirst[2];
280 getDoublesFromPoint(lFirstPoint, lFirst);
281 lXValues.push_back(lFirst[0]);
282 lYValues.push_back(lFirst[1]);
283 Item lPoint;
284 int lCounter = 1;
285 while(lChildren->next(lPoint)) {
286 // make sure that we aren't reading in the gap length as point
287 if (lCounter >= 3) {
288 Item lNodeName;
289 lPoint.getNodeName(lNodeName);
290 String lName = lNodeName.getStringValue();
291 if (!fn::ends_with(lName,"oint")) {
292 break;
293 }
294 }
295 lCounter++;
296 double lPointValues[2];
297 getDoublesFromPoint(lPoint, lPointValues);
298 lXValues.push_back(lPointValues[0]);
299 lYValues.push_back(lPointValues[1]);
300 }
301 // lPoint now contains the strokeLength
302 double lStrokeArray[2];258 double lStrokeArray[2];
303 lStrokeArray[0] = getDoubleValue(lPoint); 259 int lSize = 1;
304 lChildren->next(lPoint);
305 lStrokeArray[1] = getDoubleValue(lPoint);
306 lChildren->close();
307260
261 lAntiAliasing = getCommonValues(aLine, &lStrokeWidth, lStrokeColor, lFillColor);
262
263 Item lPoints = aLine.getObjectValue("points");
264 lSize = lPoints.getArraySize();
265 for (int i = 1; i <= lSize; i++)
266 {
267 Item lPoint = lPoints.getArrayValue(i);
268 getDoublesFromPoint(lPoint, lTempPoint);
269 lXValues.push_back(lTempPoint[0]);
270 lYValues.push_back(lTempPoint[1]);
271 }
272 //get stroke length
273 Item lStrokeLength = aLine.getObjectValue("strokeLength");
274 lStrokeArray[0] = getDoubleValue(lStrokeLength);
275 Item lGapLength = aLine.getObjectValue("gapLength");
276 lStrokeArray[1] = getDoubleValue(lGapLength);
277
278
308 long lBlobLength = (long) aBlob.length();279 long lBlobLength = (long) aBlob.length();
309 280
310 double* lXValuesArray = new double[lCounter];281 double* lXValuesArray = new double[lSize];
311 double* lYValuesArray = new double[lCounter];282 double* lYValuesArray = new double[lSize];
312 memcpy(lXValuesArray, &lXValues[0], lCounter*sizeof(lXValues[0]));283 memcpy(lXValuesArray, &lXValues[0], lSize*sizeof(lXValues[0]));
313 memcpy(lYValuesArray, &lYValues[0], lCounter*sizeof(lYValues[0]));284 memcpy(lYValuesArray, &lYValues[0], lSize*sizeof(lYValues[0]));
314 285
315 void * lBlobPointer = DrawPolyLine(aBlob.data(), &lBlobLength, &lXValuesArray[0], &lYValuesArray[0], lCounter, lStrokeColor, lStrokeWidth, lAntiAliasing, lStrokeArray, 2);286 void * lBlobPointer = DrawPolyLine(aBlob.data(), &lBlobLength, &lXValuesArray[0], &lYValuesArray[0], lSize, lStrokeColor, lStrokeWidth, lAntiAliasing, lStrokeArray, 2);
316 287
317 delete[] lXValuesArray;288 delete[] lXValuesArray;
318 delete[] lYValuesArray;289 delete[] lYValuesArray;
@@ -325,51 +296,49 @@
325296
326void 297void
327PaintImplFunction::applyRectangle(Magick::Blob& aBlob, Item& aRectangle) const {298PaintImplFunction::applyRectangle(Magick::Blob& aBlob, Item& aRectangle) const {
328 Item lFirstPoint;
329 Iterator_t lChildren = aRectangle.getChildren();
330 lChildren->open();
331 double lStrokeWidth = 0; 299 double lStrokeWidth = 0;
332 std::string lStrokeColor = "";300 std::string lStrokeColor = "";
333 std::string lFillColor = "";301 std::string lFillColor = "";
334 bool lAntiAliasing;302 bool lAntiAliasing;
335 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
336 // now lFirstPoint contains the upper left corner of this rectangle
337 double lUpperLeft[2];303 double lUpperLeft[2];
338 getDoublesFromPoint(lFirstPoint, lUpperLeft);
339 lChildren->next(lFirstPoint);
340 lChildren->close();
341 double lLowerRight[2];304 double lLowerRight[2];
342 getDoublesFromPoint(lFirstPoint, lLowerRight);305
306 lAntiAliasing = getCommonValues(aRectangle, &lStrokeWidth, lStrokeColor, lFillColor);
307 Item lUpperLeftItem = aRectangle.getObjectValue("upperLeft");
308 getDoublesFromPoint(lUpperLeftItem, lUpperLeft);
309 Item lLowerRightItem = aRectangle.getObjectValue("lowerRight");
310 getDoublesFromPoint(lLowerRightItem, lLowerRight);
311
312
343 long lBlobLength = (long) aBlob.length();313 long lBlobLength = (long) aBlob.length();
344 void * lBlobPointer = DrawRoundedRect(aBlob.data(), &lBlobLength, lUpperLeft[0], lUpperLeft[1], lLowerRight[0], lLowerRight[1], 0, 0, lStrokeColor, lFillColor, lStrokeWidth, lAntiAliasing);314 void * lBlobPointer = DrawRoundedRect(aBlob.data(), &lBlobLength, lUpperLeft[0], lUpperLeft[1], lLowerRight[0], lLowerRight[1], 0, 0, lStrokeColor, lFillColor, lStrokeWidth, lAntiAliasing);
345 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);315 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);
346 // now read the blob back into an image to pass it back as encoded string 316 // now read the blob back into an image to pass it back as encoded string
347 aBlob = lBlobWithPolyLine;317 aBlob = lBlobWithPolyLine;
348
349}318}
350319
351void 320void
352PaintImplFunction::applyRoundedRectangle(Magick::Blob& aBlob, Item& aRectangle) const {321PaintImplFunction::applyRoundedRectangle(Magick::Blob& aBlob, Item& aRectangle) const {
353 Item lFirstPoint;322 Item lItem;
354 Iterator_t lChildren = aRectangle.getChildren();
355 lChildren->open();
356 double lStrokeWidth = 0; 323 double lStrokeWidth = 0;
357 std::string lStrokeColor = "";324 std::string lStrokeColor = "";
358 std::string lFillColor = "";325 std::string lFillColor = "";
359 bool lAntiAliasing;326 bool lAntiAliasing;
360 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
361 // now lFirstPoint contains the upper left corner of this rectangle
362 double lUpperLeft[2];327 double lUpperLeft[2];
363 getDoublesFromPoint(lFirstPoint, lUpperLeft);
364 lChildren->next(lFirstPoint);
365 double lLowerRight[2];328 double lLowerRight[2];
366 getDoublesFromPoint(lFirstPoint, lLowerRight);329 double lCornerWidth;
367 Item lCorner;330 double lCornerHeight;
368 lChildren->next(lCorner);331
369 double lCornerWidth = getDoubleValue(lCorner);332 lAntiAliasing = getCommonValues(aRectangle, &lStrokeWidth, lStrokeColor, lFillColor);
370 lChildren->next(lCorner);333 lItem = aRectangle.getObjectValue("upperLeft");
371 double lCornerHeight = getDoubleValue(lCorner);334 getDoublesFromPoint(lItem, lUpperLeft);
372 335 lItem = aRectangle.getObjectValue("lowerRight");
336 getDoublesFromPoint(lItem, lLowerRight);
337 lItem = aRectangle.getObjectValue("cornerWidth");
338 lCornerWidth = getDoubleValue(lItem);
339 lItem = aRectangle.getObjectValue("cornerHeight");
340 lCornerHeight = getDoubleValue(lItem);
341
373 long lBlobLength = (long) aBlob.length();342 long lBlobLength = (long) aBlob.length();
374 void * lBlobPointer = DrawRoundedRect(aBlob.data(), &lBlobLength, lUpperLeft[0], lUpperLeft[1], lLowerRight[0], lLowerRight[1], lCornerWidth, lCornerHeight, lStrokeColor, lFillColor, lStrokeWidth, lAntiAliasing);343 void * lBlobPointer = DrawRoundedRect(aBlob.data(), &lBlobLength, lUpperLeft[0], lUpperLeft[1], lLowerRight[0], lLowerRight[1], lCornerWidth, lCornerHeight, lStrokeColor, lFillColor, lStrokeWidth, lAntiAliasing);
375 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);344 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);
@@ -380,21 +349,20 @@
380349
381void 350void
382PaintImplFunction::applyCircle(Magick::Blob& aBlob, Item& aCircle) const {351PaintImplFunction::applyCircle(Magick::Blob& aBlob, Item& aCircle) const {
383 Item lFirstPoint;352 double lStrokeWidth = 0;
384 Iterator_t lChildren = aCircle.getChildren();
385 lChildren->open();
386 double lStrokeWidth = 0;
387 std::string lStrokeColor = "";353 std::string lStrokeColor = "";
388 std::string lFillColor = "";354 std::string lFillColor = "";
389 bool lAntiAliasing;355 bool lAntiAliasing;
390 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
391
392 double lOriginCoordinates[2];356 double lOriginCoordinates[2];
393 getDoublesFromPoint(lFirstPoint, lOriginCoordinates);357 Item lItem;
394 Item lPeremeterItem;358 double lRadius;
395 lChildren->next(lPeremeterItem);359
396 double lPeremeter = getDoubleValue(lPeremeterItem); 360 lAntiAliasing = getCommonValues(aCircle, &lStrokeWidth, lStrokeColor, lFillColor);
397 lChildren->close();361 lItem = aCircle.getObjectValue("origin");
362 getDoublesFromPoint(lItem, lOriginCoordinates);
363 lItem = aCircle.getObjectValue("radius");
364 lRadius = getDoubleValue(lItem);
365
398 Magick::Image lImage(aBlob);366 Magick::Image lImage(aBlob);
399 lImage.strokeAntiAlias(lAntiAliasing);367 lImage.strokeAntiAlias(lAntiAliasing);
400 lImage.strokeWidth(lStrokeWidth);368 lImage.strokeWidth(lStrokeWidth);
@@ -404,32 +372,31 @@
404 ImageFunction::getColorFromString(lFillColor.c_str(), lFillColorForMagick);372 ImageFunction::getColorFromString(lFillColor.c_str(), lFillColorForMagick);
405 lImage.strokeColor(lStrokeColorForMagick);373 lImage.strokeColor(lStrokeColorForMagick);
406 lImage.fillColor(lFillColorForMagick);374 lImage.fillColor(lFillColorForMagick);
407 lImage.draw(Magick::DrawableEllipse(lOriginCoordinates[0], lOriginCoordinates[1], lPeremeter, lPeremeter, 0, 360));375 lImage.draw(Magick::DrawableEllipse(lOriginCoordinates[0], lOriginCoordinates[1], lRadius, lRadius, 0, 360));
408 Magick::Blob lBlob;376 Magick::Blob lBlob;
409 lImage.write(&lBlob);377 lImage.write(&lBlob);
410 aBlob = lBlob;378 aBlob = lBlob;
411
412}379}
413380
414void 381void
415PaintImplFunction::applyEllipse(Magick::Blob& aBlob, Item& aCircle) const {382PaintImplFunction::applyEllipse(Magick::Blob& aBlob, Item& aCircle) const {
416 Item lFirstPoint;383 double lStrokeWidth = 0;
417 Iterator_t lChildren = aCircle.getChildren();
418 lChildren->open();
419 double lStrokeWidth = 0;
420 std::string lStrokeColor = "";384 std::string lStrokeColor = "";
421 std::string lFillColor = "";385 std::string lFillColor = "";
422 bool lAntiAliasing;386 bool lAntiAliasing;
423 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);387 Item lItem;
424
425 double lOriginCoordinates[2];388 double lOriginCoordinates[2];
426 getDoublesFromPoint(lFirstPoint, lOriginCoordinates);389 double lRadiusX;
427 Item lPeremeterItem;390 double lRadiusY;
428 lChildren->next(lPeremeterItem);391
429 double lPeremeterX = getDoubleValue(lPeremeterItem);392 lAntiAliasing = getCommonValues(aCircle, &lStrokeWidth, lStrokeColor, lFillColor);
430 lChildren->next(lPeremeterItem);393 lItem = aCircle.getObjectValue("origin");
431 double lPeremeterY = getDoubleValue(lPeremeterItem);394 getDoublesFromPoint(lItem, lOriginCoordinates);
432 lChildren->close();395 lItem = aCircle.getObjectValue("radiusX");
396 lRadiusX = getDoubleValue(lItem);
397 lItem = aCircle.getObjectValue("radiusY");
398 lRadiusY = getDoubleValue(lItem);
399
433 Magick::Image lImage(aBlob);400 Magick::Image lImage(aBlob);
434 lImage.strokeAntiAlias(lAntiAliasing);401 lImage.strokeAntiAlias(lAntiAliasing);
435 lImage.strokeWidth(lStrokeWidth);402 lImage.strokeWidth(lStrokeWidth);
@@ -439,7 +406,7 @@
439 ImageFunction::getColorFromString(lFillColor.c_str(), lFillColorForMagick);406 ImageFunction::getColorFromString(lFillColor.c_str(), lFillColorForMagick);
440 lImage.strokeColor(lStrokeColorForMagick);407 lImage.strokeColor(lStrokeColorForMagick);
441 lImage.fillColor(lFillColorForMagick);408 lImage.fillColor(lFillColorForMagick);
442 lImage.draw(Magick::DrawableEllipse(lOriginCoordinates[0], lOriginCoordinates[1], lPeremeterX, lPeremeterY, 0, 360));409 lImage.draw(Magick::DrawableEllipse(lOriginCoordinates[0], lOriginCoordinates[1], lRadiusX, lRadiusY, 0, 360));
443 Magick::Blob lBlob;410 Magick::Blob lBlob;
444 lImage.write(&lBlob);411 lImage.write(&lBlob);
445 aBlob = lBlob;412 aBlob = lBlob;
@@ -447,29 +414,26 @@
447414
448void 415void
449PaintImplFunction::applyArc(Magick::Blob& aBlob, Item& aCircle) const {416PaintImplFunction::applyArc(Magick::Blob& aBlob, Item& aCircle) const {
450 Item lFirstPoint;417 double lStrokeWidth = 0;
451 Iterator_t lChildren = aCircle.getChildren();
452 lChildren->open();
453 double lStrokeWidth = 0;
454 std::string lStrokeColor = "";418 std::string lStrokeColor = "";
455 std::string lFillColor = "";419 std::string lFillColor = "";
456 bool lAntiAliasing;420 bool lAntiAliasing;
457 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
458
459 double lOriginCoordinates[2];421 double lOriginCoordinates[2];
460 getDoublesFromPoint(lFirstPoint, lOriginCoordinates);422 double lRadiusX, lRadiusY, lStartDegrees, lEndDegrees;
461 Item lPeremeterItem;423 Item lItem;
462 lChildren->next(lPeremeterItem);424
463 double lPeremeterX = getDoubleValue(lPeremeterItem);425 lAntiAliasing = getCommonValues(aCircle, &lStrokeWidth, lStrokeColor, lFillColor);
464 lChildren->next(lPeremeterItem);426 lItem = aCircle.getObjectValue("origin");
465 double lPeremeterY = getDoubleValue(lPeremeterItem);427 getDoublesFromPoint(lItem, lOriginCoordinates);
466 Item lDegreesItem;428 lItem = aCircle.getObjectValue("radiusX");
467 lChildren->next(lDegreesItem);429 lRadiusX = getDoubleValue(lItem);
468 double lStartDegrees = getDoubleValue(lDegreesItem);430 lItem = aCircle.getObjectValue("radiusY");
469 lChildren->next(lDegreesItem);431 lRadiusY = getDoubleValue(lItem);
470 double lEndDegrees = getDoubleValue(lDegreesItem);432 lItem = aCircle.getObjectValue("startDegrees");
433 lStartDegrees = getDoubleValue(lItem);
434 lItem = aCircle.getObjectValue("endDegrees");
435 lEndDegrees = getDoubleValue(lItem);
471 436
472 lChildren->close();
473 Magick::Image lImage(aBlob);437 Magick::Image lImage(aBlob);
474 lImage.strokeAntiAlias(lAntiAliasing);438 lImage.strokeAntiAlias(lAntiAliasing);
475 lImage.strokeWidth(lStrokeWidth);439 lImage.strokeWidth(lStrokeWidth);
@@ -479,7 +443,7 @@
479 ImageFunction::getColorFromString(lFillColor.c_str(), lFillColorForMagick);443 ImageFunction::getColorFromString(lFillColor.c_str(), lFillColorForMagick);
480 lImage.strokeColor(lStrokeColorForMagick);444 lImage.strokeColor(lStrokeColorForMagick);
481 lImage.fillColor(lFillColorForMagick);445 lImage.fillColor(lFillColorForMagick);
482 lImage.draw(Magick::DrawableEllipse(lOriginCoordinates[0], lOriginCoordinates[1], lPeremeterX, lPeremeterY, lStartDegrees, lEndDegrees));446 lImage.draw(Magick::DrawableEllipse(lOriginCoordinates[0], lOriginCoordinates[1], lRadiusX, lRadiusY, lStartDegrees, lEndDegrees));
483 Magick::Blob lBlob;447 Magick::Blob lBlob;
484 lImage.write(&lBlob);448 lImage.write(&lBlob);
485 aBlob = lBlob;449 aBlob = lBlob;
@@ -488,42 +452,35 @@
488452
489void 453void
490PaintImplFunction::applyPolygon(Magick::Blob& aBlob, Item& aLine) const {454PaintImplFunction::applyPolygon(Magick::Blob& aBlob, Item& aLine) const {
491 Item lFirstPoint;455 double lStrokeWidth = 0;
492 Iterator_t lChildren = aLine.getChildren();
493 lChildren->open();
494 double lStrokeWidth = 0;
495 std::string lStrokeColor = "";456 std::string lStrokeColor = "";
496 std::string lFillColor = "";457 std::string lFillColor = "";
497 bool lAntiAliasing;458 bool lAntiAliasing;
498
499 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);
500
501 std::vector<double> lXValues;459 std::vector<double> lXValues;
502 std::vector<double> lYValues;460 std::vector<double> lYValues;
503461 double lTempPoint[2];
504 double lFirst[2];462 int lSize = 1;
505 getDoublesFromPoint(lFirstPoint, lFirst);463
506 lXValues.push_back(lFirst[0]);464 lAntiAliasing = getCommonValues(aLine, &lStrokeWidth, lStrokeColor, lFillColor);
507 lYValues.push_back(lFirst[1]);465
508 Item lPoint;466 Item lPoints = aLine.getObjectValue("points");
509 int lCounter = 1;467 lSize = lPoints.getArraySize();
510 while(lChildren->next(lPoint)) {468 for (int i = 1; i <= lSize; i++)
511 lCounter++;469 {
512 double lPointValues[2];470 Item lPoint = lPoints.getArrayValue(i);
513 getDoublesFromPoint(lPoint, lPointValues);471 getDoublesFromPoint(lPoint, lTempPoint);
514 lXValues.push_back(lPointValues[0]);472 lXValues.push_back(lTempPoint[0]);
515 lYValues.push_back(lPointValues[1]);473 lYValues.push_back(lTempPoint[1]);
516 }474 }
517 lChildren->close();
518 475
519 long lBlobLength = (long) aBlob.length();476 long lBlobLength = (long) aBlob.length();
520 477
521 double* lXValuesArray = new double[lCounter];478 double* lXValuesArray = new double[lSize];
522 double* lYValuesArray = new double[lCounter];479 double* lYValuesArray = new double[lSize];
523 memcpy(lXValuesArray, &lXValues[0], lCounter*sizeof(lXValues[0]));480 memcpy(lXValuesArray, &lXValues[0], lSize*sizeof(lXValues[0]));
524 memcpy(lYValuesArray, &lYValues[0], lCounter*sizeof(lYValues[0]));481 memcpy(lYValuesArray, &lYValues[0], lSize*sizeof(lYValues[0]));
525 482
526 void * lBlobPointer = DrawPolygon(aBlob.data(), &lBlobLength, &lXValuesArray[0], &lYValuesArray[0], lCounter, lStrokeColor, lFillColor, lStrokeWidth, lAntiAliasing);483 void * lBlobPointer = DrawPolygon(aBlob.data(), &lBlobLength, &lXValuesArray[0], &lYValuesArray[0], lSize, lStrokeColor, lFillColor, lStrokeWidth, lAntiAliasing);
527 484
528 delete[] lXValuesArray;485 delete[] lXValuesArray;
529 delete[] lYValuesArray;486 delete[] lYValuesArray;
@@ -531,47 +488,34 @@
531 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);488 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);
532 // now read the blob back into an image to pass it back as encoded string 489 // now read the blob back into an image to pass it back as encoded string
533 aBlob = lBlobWithPolyLine;490 aBlob = lBlobWithPolyLine;
534
535
536}491}
537492
538void 493void
539PaintImplFunction::applyText(Magick::Blob& aBlob, Item& aText) const {494PaintImplFunction::applyText(Magick::Blob& aBlob, Item& aText) const {
540 Item lFirstPoint;
541 Iterator_t lChildren = aText.getChildren();
542 lChildren->open();
543 double lStrokeWidth = 0; 495 double lStrokeWidth = 0;
544 std::string lStrokeColor = "";496 std::string lStrokeColor = "";
545 std::string lFillColor = "";497 std::string lFillColor = "";
546 bool lAntiAliasing;498 bool lAntiAliasing;
547499 double lOriginCoordinates[2];
548 lAntiAliasing = getCommonValues(lChildren, lFirstPoint, &lStrokeWidth, lStrokeColor, lFillColor);500 Item lItem;
549 501 String lText, lFontFamily;
550502 double lFontSize;
551 double lFirst[2];503
552 getDoublesFromPoint(lFirstPoint, lFirst);504 lAntiAliasing = getCommonValues(aText, &lStrokeWidth, lStrokeColor, lFillColor);
553505 lItem = aText.getObjectValue("origin");
554 Item lTextItem;506 getDoublesFromPoint(lItem, lOriginCoordinates);
555 lChildren->next(lTextItem);507 lItem = aText.getObjectValue("text");
556 String lText = lTextItem.getStringValue();508 lText = lItem.getStringValue();
557 Item lFontFamilyItem;509 lItem = aText.getObjectValue("font");
558 lChildren->next(lFontFamilyItem);510 lFontFamily = lItem.getStringValue();
559 String lFontFamily = lFontFamilyItem.getStringValue();511 lItem = aText.getObjectValue("fontSize");
560 Item lFontSizeItem;512 lFontSize = getDoubleValue(lItem);
561 lChildren->next(lFontSizeItem);
562 double lFontSize = getDoubleValue(lFontSizeItem);
563
564 lChildren->close();
565 513
566
567 long lBlobLength = (long) aBlob.length();514 long lBlobLength = (long) aBlob.length();
568 void * lBlobPointer = DrawText(aBlob.data(), &lBlobLength, lText.c_str() , lFirst[0], lFirst[1], lFontFamily.c_str(), lFontSize, lStrokeColor.c_str());515 void * lBlobPointer = DrawText(aBlob.data(), &lBlobLength, lText.c_str() , lOriginCoordinates[0], lOriginCoordinates[1], lFontFamily.c_str(), lFontSize, lStrokeColor.c_str());
569 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);516 Magick::Blob lBlobWithPolyLine(lBlobPointer, lBlobLength);
570 // now read the blob back into an image to pass it back as encoded string 517 // now read the blob back into an image to pass it back as encoded string
571 aBlob = lBlobWithPolyLine;518 aBlob = lBlobWithPolyLine;
572
573
574
575}519}
576520
577521
578522
=== modified file 'src/paint.xq.src/paint.h'
--- src/com/zorba-xquery/www/modules/image/paint.xq.src/paint.h 2011-10-06 08:18:47 +0000
+++ src/paint.xq.src/paint.h 2013-10-23 04:15:35 +0000
@@ -79,11 +79,10 @@
79 applyText(Magick::Blob& aBlob, Item& aShape) const; 79 applyText(Magick::Blob& aBlob, Item& aShape) const;
8080
81 virtual bool81 virtual bool
82 getCommonValues(Iterator_t& aChildIterator, 82 getCommonValues(Item& lObjectValue,
83 Item& aLastItemFound,
84 double* aStrokeWidth, 83 double* aStrokeWidth,
85 std::string& aStrokeColor, 84 std::string& aStrokeColor,
86 std::string& aFillColor) const; 85 std::string& aFillColor) const;
8786
8887
89 double88 double
9089
=== modified file 'src/paint.xq.src/paint_module.h'
--- src/com/zorba-xquery/www/modules/image/paint.xq.src/paint_module.h 2011-10-06 08:18:47 +0000
+++ src/paint.xq.src/paint_module.h 2013-10-23 04:15:35 +0000
@@ -34,7 +34,7 @@
34public:34public:
35 35
36 virtual String36 virtual String
37 getURI() const { return "http://www.zorba-xquery.com/modules/image/paint"; }37 getURI() const { return "http://zorba.io/modules/image/paint"; }
38 38
39 virtual ExternalFunction*39 virtual ExternalFunction*
40 getExternalFunction(const String& aLocalname);40 getExternalFunction(const String& aLocalname);
4141
=== modified file 'test/Queries/image/animation.xq'
--- test/Queries/image/animation.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/animation.xq 2013-10-23 04:15:35 +0000
@@ -4,9 +4,9 @@
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace file = 'http://expath.org/ns/file';6import module namespace file = 'http://expath.org/ns/file';
7import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';7import module namespace basic = 'http://zorba.io/modules/image/basic';
8import module namespace ani = 'http://www.zorba-xquery.com/modules/image/animation';8import module namespace ani = 'http://zorba.io/modules/image/animation';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
1313
=== modified file 'test/Queries/image/animation_create.xq'
--- test/Queries/image/animation_create.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/animation_create.xq 2013-10-23 04:15:35 +0000
@@ -5,7 +5,7 @@
5 : to disk using file:write-binary(a_path, $animatedGif), send it in an email etc.5 : to disk using file:write-binary(a_path, $animatedGif), send it in an email etc.
6 :)6 :)
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace animation = 'http://www.zorba-xquery.com/modules/image/animation';8import module namespace animation = 'http://zorba.io/modules/image/animation';
99
10declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");10declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1111
1212
=== modified file 'test/Queries/image/animation_create_morphed.xq'
--- test/Queries/image/animation_create_morphed.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/animation_create_morphed.xq 2013-10-23 04:15:35 +0000
@@ -5,7 +5,7 @@
5 : to disk using file:write-binary(a_path, $animatedGif), send it in an email etc.5 : to disk using file:write-binary(a_path, $animatedGif), send it in an email etc.
6 :)6 :)
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace animation = 'http://www.zorba-xquery.com/modules/image/animation';8import module namespace animation = 'http://zorba.io/modules/image/animation';
99
10declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");10declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1111
1212
=== modified file 'test/Queries/image/basic.xq'
--- test/Queries/image/basic.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/basic.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
88
9declare namespace an = "http://zorba.io/annotations";9declare namespace an = "http://zorba.io/annotations";
1010
=== modified file 'test/Queries/image/basic_compress.xq'
--- test/Queries/image/basic_compress.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_compress.xq 2013-10-23 04:15:35 +0000
@@ -4,7 +4,7 @@
4 : to disk using file:write-binary(a_path, basic:compress($compressed-bird, xs:unsignedInt(2))), send it in an email etc.4 : to disk using file:write-binary(a_path, basic:compress($compressed-bird, xs:unsignedInt(2))), send it in an email etc.
5 :)5 :)
6import module namespace file = 'http://expath.org/ns/file'; 6import module namespace file = 'http://expath.org/ns/file';
7import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; 7import module namespace basic = 'http://zorba.io/modules/image/basic';
88
9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1010
1111
=== modified file 'test/Queries/image/basic_convert.xq'
--- test/Queries/image/basic_convert.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_convert.xq 2013-10-23 04:15:35 +0000
@@ -4,7 +4,7 @@
4 : to disk using file:write-binary(a_path, basic:compress($gif-bird, xs:unsignedInt(2))), send it in an email etc.4 : to disk using file:write-binary(a_path, basic:compress($gif-bird, xs:unsignedInt(2))), send it in an email etc.
5 :)5 :)
6import module namespace file = 'http://expath.org/ns/file'; 6import module namespace file = 'http://expath.org/ns/file';
7import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; 7import module namespace basic = 'http://zorba.io/modules/image/basic';
88
9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1010
1111
=== modified file 'test/Queries/image/basic_create.xq'
--- test/Queries/image/basic_create.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_create.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it 3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it
4 : to disk using file:write-binary(a_path, $new-image)), send it in an email etc.4 : to disk using file:write-binary(a_path, $new-image)), send it in an email etc.
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
77
8let $new-image as xs:base64Binary := basic:create(xs:unsignedInt(100), xs:unsignedInt(50), "GIF") 8let $new-image as xs:base64Binary := basic:create(xs:unsignedInt(100), xs:unsignedInt(50), "GIF")
9return not(empty($new-image))9return not(empty($new-image))
1010
=== modified file 'test/Queries/image/basic_equals.xq'
--- test/Queries/image/basic_equals.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_equals.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : are not equal. 3 : are not equal.
4 :)4 :)
5import module namespace file = 'http://expath.org/ns/file';5import module namespace file = 'http://expath.org/ns/file';
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
77
8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
99
1010
=== modified file 'test/Queries/image/basic_exif.xq'
--- test/Queries/image/basic_exif.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_exif.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : Trying to read out the value of an non-existing exif tag will result in an empty sequence. 3 : Trying to read out the value of an non-existing exif tag will result in an empty sequence.
4 :)4 :)
5import module namespace file = 'http://expath.org/ns/file';5import module namespace file = 'http://expath.org/ns/file';
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
77
8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
99
1010
=== modified file 'test/Queries/image/basic_height.xq'
--- test/Queries/image/basic_height.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_height.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : The basic:height function returns the height in pixels (as xs:unsignedInt). 3 : The basic:height function returns the height in pixels (as xs:unsignedInt).
4 :)4 :)
5import module namespace file = 'http://expath.org/ns/file'; 5import module namespace file = 'http://expath.org/ns/file';
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; 6import module namespace basic = 'http://zorba.io/modules/image/basic';
77
8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
99
1010
=== modified file 'test/Queries/image/basic_svg.xq'
--- test/Queries/image/basic_svg.xq 2012-10-29 07:53:55 +0000
+++ test/Queries/image/basic_svg.xq 2013-10-23 04:15:35 +0000
@@ -4,7 +4,7 @@
4 : to disk using file:write-binary(a_path, basic:compress($jpeg-bird, xs:unsignedInt(2))), send it in an email etc.4 : to disk using file:write-binary(a_path, basic:compress($jpeg-bird, xs:unsignedInt(2))), send it in an email etc.
5 :)5 :)
6import module namespace file = 'http://expath.org/ns/file';6import module namespace file = 'http://expath.org/ns/file';
7import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';7import module namespace basic = 'http://zorba.io/modules/image/basic';
88
9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1010
1111
=== modified file 'test/Queries/image/basic_type.xq'
--- test/Queries/image/basic_type.xq 2011-08-04 04:09:00 +0000
+++ test/Queries/image/basic_type.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : The basic:width function returns the width in pixels (as xs:unsignedInt).3 : The basic:width function returns the width in pixels (as xs:unsignedInt).
4 :)4 :)
5import module namespace file = 'http://expath.org/ns/file';5import module namespace file = 'http://expath.org/ns/file';
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
77
8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
99
1010
=== modified file 'test/Queries/image/basic_width.xq'
--- test/Queries/image/basic_width.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/basic_width.xq 2013-10-23 04:15:35 +0000
@@ -3,7 +3,7 @@
3 : The basic:width function returns the width in pixels (as xs:unsignedInt).3 : The basic:width function returns the width in pixels (as xs:unsignedInt).
4 :)4 :)
5import module namespace file = 'http://expath.org/ns/file';5import module namespace file = 'http://expath.org/ns/file';
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
77
8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");8declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
99
1010
=== modified file 'test/Queries/image/manipulation_1.xq'
--- test/Queries/image/manipulation_1.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/manipulation_1.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';8import module namespace man = 'http://zorba.io/modules/image/manipulation';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
1313
=== modified file 'test/Queries/image/manipulation_2.xq'
--- test/Queries/image/manipulation_2.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/manipulation_2.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';8import module namespace man = 'http://zorba.io/modules/image/manipulation';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
1313
=== modified file 'test/Queries/image/manipulation_3.xq'
--- test/Queries/image/manipulation_3.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/manipulation_3.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';8import module namespace man = 'http://zorba.io/modules/image/manipulation';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
1313
=== modified file 'test/Queries/image/manipulation_4.xq'
--- test/Queries/image/manipulation_4.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/manipulation_4.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';8import module namespace man = 'http://zorba.io/modules/image/manipulation';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
1313
=== modified file 'test/Queries/image/manipulation_5.xq'
--- test/Queries/image/manipulation_5.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/manipulation_5.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace man = 'http://www.zorba-xquery.com/modules/image/manipulation';8import module namespace man = 'http://zorba.io/modules/image/manipulation';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
1313
=== modified file 'test/Queries/image/manipulation_add_noise.xq'
--- test/Queries/image/manipulation_add_noise.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_add_noise.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $noise-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $noise-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_blur.xq'
--- test/Queries/image/manipulation_blur.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_blur.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $blurred-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $blurred-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_charcoal.xq'
--- test/Queries/image/manipulation_charcoal.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_charcoal.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $charcoaled-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $charcoaled-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_chop.xq'
--- test/Queries/image/manipulation_chop.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_chop.xq 2013-10-23 04:15:35 +0000
@@ -7,7 +7,7 @@
7 : to disk using file:write-binary(a_path, $chopped-image), send it in an email etc.7 : to disk using file:write-binary(a_path, $chopped-image), send it in an email etc.
8 :)8 :)
9import module namespace file = 'http://expath.org/ns/file';9import module namespace file = 'http://expath.org/ns/file';
10import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';10import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1111
12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1313
1414
=== modified file 'test/Queries/image/manipulation_contrast.xq'
--- test/Queries/image/manipulation_contrast.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_contrast.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $contrasted-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $contrasted-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_crop.xq'
--- test/Queries/image/manipulation_crop.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_crop.xq 2013-10-23 04:15:35 +0000
@@ -7,7 +7,7 @@
7 : to disk using file:write-binary(a_path, $cropped-image), send it in an email etc.7 : to disk using file:write-binary(a_path, $cropped-image), send it in an email etc.
8 :)8 :)
9import module namespace file = 'http://expath.org/ns/file';9import module namespace file = 'http://expath.org/ns/file';
10import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';10import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1111
12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1313
1414
=== modified file 'test/Queries/image/manipulation_despeckle.xq'
--- test/Queries/image/manipulation_despeckle.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_despeckle.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $despeckled-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $despeckled-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_edge.xq'
--- test/Queries/image/manipulation_edge.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_edge.xq 2013-10-23 04:15:35 +0000
@@ -7,7 +7,7 @@
7 : to disk using file:write-binary(a_path, $edged-image), send it in an email etc.7 : to disk using file:write-binary(a_path, $edged-image), send it in an email etc.
8 :)8 :)
9import module namespace file = 'http://expath.org/ns/file';9import module namespace file = 'http://expath.org/ns/file';
10import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';10import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1111
12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1313
1414
=== modified file 'test/Queries/image/manipulation_emboss.xq'
--- test/Queries/image/manipulation_emboss.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_emboss.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $embossed-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $embossed-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_enhance.xq'
--- test/Queries/image/manipulation_enhance.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_enhance.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write-binary(a_path, $enhanced-image), send it in an email etc.6 : to disk using file:write-binary(a_path, $enhanced-image), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_equalize.xq'
--- test/Queries/image/manipulation_equalize.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_equalize.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $enhanced-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $enhanced-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_erase.xq'
--- test/Queries/image/manipulation_erase.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_erase.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $erased-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $erased-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_flip.xq'
--- test/Queries/image/manipulation_flip.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_flip.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $flip-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $flip-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_flop.xq'
--- test/Queries/image/manipulation_flop.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_flop.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $flop-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $flop-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_gamma.xq'
--- test/Queries/image/manipulation_gamma.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_gamma.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $gamma-corrected-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $gamma-corrected-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_gamma2.xq'
--- test/Queries/image/manipulation_gamma2.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_gamma2.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $gamma-corrected-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $gamma-corrected-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_implode.xq'
--- test/Queries/image/manipulation_implode.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_implode.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $imploded-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $imploded-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_oil_paint.xq'
--- test/Queries/image/manipulation_oil_paint.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_oil_paint.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $oil-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $oil-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_overlay.xq'
--- test/Queries/image/manipulation_overlay.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_overlay.xq 2013-10-23 04:15:35 +0000
@@ -5,8 +5,8 @@
5 : to disk using file:write(a_path, $overlayed-image, <method>binary</method>), send it in an email etc.5 : to disk using file:write(a_path, $overlayed-image, <method>binary</method>), send it in an email etc.
6 :)6 :)
7import module namespace file = 'http://expath.org/ns/file'; 7import module namespace file = 'http://expath.org/ns/file';
8import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation'; 8import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
9import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';9import module namespace basic = 'http://zorba.io/modules/image/basic';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_reduce_noise.xq'
--- test/Queries/image/manipulation_reduce_noise.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_reduce_noise.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $less-noisy-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $less-noisy-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_resize.xq'
--- test/Queries/image/manipulation_resize.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_resize.xq 2013-10-23 04:15:35 +0000
@@ -4,7 +4,7 @@
4 : to disk using file:write(a_path, $resized-image, <method>binary</method>), send it in an email etc.4 : to disk using file:write(a_path, $resized-image, <method>binary</method>), send it in an email etc.
5 :)5 :)
6import module namespace file = 'http://expath.org/ns/file'; 6import module namespace file = 'http://expath.org/ns/file';
7import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation'; 7import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
88
9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1010
1111
=== modified file 'test/Queries/image/manipulation_rotate.xq'
--- test/Queries/image/manipulation_rotate.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_rotate.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $rotated-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $rotated-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_solarize.xq'
--- test/Queries/image/manipulation_solarize.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_solarize.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $solarized-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $solarized-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_stereo.xq'
--- test/Queries/image/manipulation_stereo.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_stereo.xq 2013-10-23 04:15:35 +0000
@@ -7,7 +7,7 @@
7 : to disk using file:write(a_path, $stereo-image, <method>binary</method>), send it in an email etc.7 : to disk using file:write(a_path, $stereo-image, <method>binary</method>), send it in an email etc.
8 :)8 :)
9import module namespace file = 'http://expath.org/ns/file';9import module namespace file = 'http://expath.org/ns/file';
10import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';10import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1111
12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");12declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1313
1414
=== modified file 'test/Queries/image/manipulation_sub_image.xq'
--- test/Queries/image/manipulation_sub_image.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_sub_image.xq 2013-10-23 04:15:35 +0000
@@ -5,8 +5,8 @@
5 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.5 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.
6 :)6 :)
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';8import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
9import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';9import module namespace basic = 'http://zorba.io/modules/image/basic';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_swirl.xq'
--- test/Queries/image/manipulation_swirl.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_swirl.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $swirled-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $swirled-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_transparent.xq'
--- test/Queries/image/manipulation_transparent.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_transparent.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $transparent-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $transparent-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_trim.xq'
--- test/Queries/image/manipulation_trim.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_trim.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $trimmed-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $trimmed-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_watermark.xq'
--- test/Queries/image/manipulation_watermark.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_watermark.xq 2013-10-23 04:15:35 +0000
@@ -6,7 +6,7 @@
6 : to disk using file:write(a_path, $watermarked-image, <method>binary</method>), send it in an email etc.6 : to disk using file:write(a_path, $watermarked-image, <method>binary</method>), send it in an email etc.
7 :)7 :)
8import module namespace file = 'http://expath.org/ns/file';8import module namespace file = 'http://expath.org/ns/file';
9import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation';9import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_zoom.xq'
--- test/Queries/image/manipulation_zoom.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_zoom.xq 2013-10-23 04:15:35 +0000
@@ -4,7 +4,7 @@
4 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.4 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.
5 :)5 :)
6import module namespace file = 'http://expath.org/ns/file'; 6import module namespace file = 'http://expath.org/ns/file';
7import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation'; 7import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
88
9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 9declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1010
1111
=== modified file 'test/Queries/image/manipulation_zoom_height.xq'
--- test/Queries/image/manipulation_zoom_height.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_zoom_height.xq 2013-10-23 04:15:35 +0000
@@ -5,8 +5,8 @@
5 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.5 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.
6 :)6 :)
7import module namespace file = 'http://expath.org/ns/file'; 7import module namespace file = 'http://expath.org/ns/file';
8import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation'; 8import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
9import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';9import module namespace basic = 'http://zorba.io/modules/image/basic';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/manipulation_zoom_width.xq'
--- test/Queries/image/manipulation_zoom_width.xq 2011-10-06 08:18:47 +0000
+++ test/Queries/image/manipulation_zoom_width.xq 2013-10-23 04:15:35 +0000
@@ -5,8 +5,8 @@
5 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.5 : to disk using file:write(a_path, $zoomed-image, <method>binary</method>), send it in an email etc.
6 :)6 :)
7import module namespace file = 'http://expath.org/ns/file'; 7import module namespace file = 'http://expath.org/ns/file';
8import module namespace manipulation = 'http://www.zorba-xquery.com/modules/image/manipulation'; 8import module namespace manipulation = 'http://zorba.io/modules/image/manipulation';
9import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';9import module namespace basic = 'http://zorba.io/modules/image/basic';
1010
11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/"); 11declare variable $local:image-dir := fn:concat(file:dir-name(fn:static-base-uri()), "/images/");
1212
1313
=== modified file 'test/Queries/image/paint_1.xq'
--- test/Queries/image/paint_1.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/paint_1.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 :3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';8import module namespace paint = 'http://zorba.io/modules/image/paint';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
@@ -38,36 +38,77 @@
38(:~38(:~
39 : @return true if the man:draw-line function works.39 : @return true if the man:draw-line function works.
40 :)40 :)
41declare %an:nondeterministic function local:test-draw-line() as xs:boolean {41declare %an:nondeterministic function local:test-draw-line() as xs:boolean {
42 let $draw := paint:paint($local:gif, <image:line><image:start><image:x>-20</image:x><image:y>-20</image:y></image:start><image:end><image:x>80</image:x><image:y>80</image:y></image:end></image:line>) 42 let $draw := paint:paint($local:gif,
43 {
44 "line" : {
45 "start" : [ -20, -20 ],
46 "end" : [ 80, 80 ]
47 }
48 })
43 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/line.gif"))49 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/line.gif"))
44 return basic:equals($draw, $draw-ref)50 return basic:equals($draw, $draw-ref)
45};51};
4652
47declare %an:nondeterministic function local:test-draw-line-color-red() {53declare %an:nondeterministic function local:test-draw-line-color-red() {
48 let $draw := paint:paint($local:gif, <image:line><image:strokeColor>#6F0000</image:strokeColor><image:start><image:x>0</image:x><image:y>0</image:y></image:start><image:end><image:x>80</image:x><image:y>80</image:y></image:end></image:line>) 54 let $draw := paint:paint($local:gif,
55 {
56 "line" : {
57 "strokeColor" : "#6F0000",
58 "start" : [ 0, 0 ],
59 "end" : [ 80, 80 ]
60 }
61 })
49 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/redLine.gif"))62 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/redLine.gif"))
50 return basic:equals($draw, $draw-ref)63 return basic:equals($draw, $draw-ref)
5164
52};65};
5366
54declare %an:nondeterministic function local:test-draw-line-color-green() {67declare %an:nondeterministic function local:test-draw-line-color-green() {
55 let $draw := paint:paint($local:gif, <image:line><image:strokeColor>#006F00</image:strokeColor><image:start><image:x>0</image:x><image:y>0</image:y></image:start><image:end><image:x>80</image:x><image:y>80</image:y></image:end></image:line>)68 let $draw := paint:paint($local:gif,
5669 {
70 "line" : {
71 "strokeColor" : "#006F00",
72 "start" : [ 0, 0 ],
73 "end" : [ 80, 80 ]
74 }
75 })
57 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/greenLine.gif"))76 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/greenLine.gif"))
58 return basic:equals($draw, $draw-ref)77 return basic:equals($draw, $draw-ref)
5978
60};79};
6180
62declare %an:nondeterministic function local:test-draw-line-color-blue() {81declare %an:nondeterministic function local:test-draw-line-color-blue() {
63 let $draw := paint:paint($local:gif, <image:line><image:strokeColor>#00006F</image:strokeColor><image:start><image:x>0</image:x><image:y>0</image:y></image:start><image:end><image:x>80</image:x><image:y>80</image:y></image:end></image:line>) 82 let $draw := paint:paint($local:gif,
83 {
84 "line" : {
85 "strokeColor" : "#00006F",
86 "start" : [ 0, 0 ],
87 "end" : [ 80, 80 ]
88 }
89 })
64 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/blueLine.gif"))90 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/blueLine.gif"))
65 return basic:equals($draw, $draw-ref)91 return basic:equals($draw, $draw-ref)
6692
67};93};
6894
69declare %an:nondeterministic function local:test-stroke-width() {95declare %an:nondeterministic function local:test-stroke-width() {
70 let $draw := paint:paint($local:gif, (<image:line><image:strokeWidth>10</image:strokeWidth><image:strokeColor>#000000</image:strokeColor><image:start><image:x>0</image:x><image:y>0</image:y></image:start><image:end><image:x>80</image:x><image:y>80</image:y></image:end></image:line>,<image:line><image:strokeColor>#FF00FF</image:strokeColor><image:start><image:x>30</image:x><image:y>0</image:y></image:start><image:end><image:x>70</image:x><image:y>90</image:y></image:end></image:line>))96 let $draw := paint:paint($local:gif,
97 ({
98 "line" : {
99 "strokeWidth" : 10,
100 "strokeColor" : "#000000",
101 "start" : [ 0, 0 ],
102 "end" : [ 80, 80 ]
103 }
104 },
105 {
106 "line" : {
107 "strokeColor" : "#FF00FF",
108 "start" : [ 30, 0 ],
109 "end" : [ 70, 90 ]
110 }
111 }))
71 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/wideLine.gif"))112 let $draw-ref := file:read-binary(concat($local:image-dir,"paint/wideLine.gif"))
72 return basic:equals($draw, $draw-ref)113 return basic:equals($draw, $draw-ref)
73114
@@ -76,7 +117,7 @@
76117
77118
78119
79declare %an:nondeterministic %an:sequential function local:main() as xs:string* {120declare %an:nondeterministic function local:main() as xs:string* {
80121
81 let $a := local:test-draw-line()122 let $a := local:test-draw-line()
82 return123 return
83124
=== modified file 'test/Queries/image/paint_2.xq'
--- test/Queries/image/paint_2.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/paint_2.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';8import module namespace paint = 'http://zorba.io/modules/image/paint';
9import schema namespace img = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace img = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
@@ -37,14 +37,25 @@
3737
38declare %an:nondeterministic function local:test-draw-poly-line() as xs:boolean 38declare %an:nondeterministic function local:test-draw-poly-line() as xs:boolean
39{39{
40 let $draw := paint:paint($local:gif, <img:polyLine><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point><img:point><img:x>200</img:x><img:y>200</img:y></img:point></img:polyLine>)40 let $draw := paint:paint($local:gif,
41 {
42 "polyLine" : {
43 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ], [ 200, 200 ] ]
44 }
45 })
41 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLine.gif"))46 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLine.gif"))
42 return basic:equals($draw, $draw-ref)47 return basic:equals($draw, $draw-ref)
43};48};
4449
45declare %an:nondeterministic function local:test-draw-poly-line-anti-aliased() as xs:boolean50declare %an:nondeterministic function local:test-draw-poly-line-anti-aliased() as xs:boolean
46{51{
47 let $draw := paint:paint($local:gif, <img:polyLine><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point></img:polyLine>)52 let $draw := paint:paint($local:gif,
53 {
54 "polyLine" : {
55 "antiAliasing" : fn:true(),
56 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
57 }
58 })
48 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineAntiAliased.gif"))59 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineAntiAliased.gif"))
49 return basic:equals($draw, $draw-ref)60 return basic:equals($draw, $draw-ref)
50};61};
@@ -54,27 +65,40 @@
54 : @return true if the man:draw-poly-line function works.65 : @return true if the man:draw-poly-line function works.
55 :)66 :)
56declare %an:nondeterministic function local:test-draw-poly-line-red() as xs:boolean 67declare %an:nondeterministic function local:test-draw-poly-line-red() as xs:boolean
57{68{
58 let $draw := paint:paint($local:gif, <img:polyLine><img:strokeColor>#FF0000</img:strokeColor><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point></img:polyLine>)69 let $draw := paint:paint($local:gif,
59 70 {
60 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineRed.gif"))71 "polyLine" : {
61 return basic:equals($draw, $draw-ref)72 "strokeColor" : "#FF0000",
73 "antiAliasing" : fn:true(),
74 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
75 }
76 })
77 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineRed.gif"))
78 return basic:equals($draw, $draw-ref)
62};79};
6380
6481
65(:~82(:~
66 : @return true if the man:draw-poly-line function works.83 : @return true if the man:draw-poly-line function works.
67 :)84 :)
68declare %an:nondeterministic function local:test-draw-poly-line-wide() as xs:boolean {85declare %an:nondeterministic function local:test-draw-poly-line-wide() as xs:boolean
69 let $draw := paint:paint($local:gif, <img:polyLine><img:strokeWidth>5</img:strokeWidth><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point></img:polyLine>)86{
70 87 let $draw := paint:paint($local:gif,
71 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineWide.gif"))88 {
72 return basic:equals($draw, $draw-ref)89 "polyLine" : {
90 "strokeWidth" : 5,
91 "antiAliasing" : fn:true(),
92 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
93 }
94 })
95 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineWide.gif"))
96 return basic:equals($draw, $draw-ref)
73};97};
7498
7599
76100
77declare %an:nondeterministic %an:sequential function local:main() as xs:string* {101declare %an:nondeterministic function local:main() as xs:string* {
78102
79103
80 let $a := local:test-draw-poly-line()104 let $a := local:test-draw-poly-line()
81105
=== modified file 'test/Queries/image/paint_3.xq'
--- test/Queries/image/paint_3.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/paint_3.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';8import module namespace paint = 'http://zorba.io/modules/image/paint';
9import schema namespace img = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace img = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
@@ -39,7 +39,14 @@
39 : @return true if the man:draw-stroked-poly-line function works.39 : @return true if the man:draw-stroked-poly-line function works.
40 :)40 :)
41declare %an:nondeterministic function local:test-draw-stroked-poly-line() as xs:boolean {41declare %an:nondeterministic function local:test-draw-stroked-poly-line() as xs:boolean {
42 let $draw := paint:paint($local:gif, <img:strokedPolyLine><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point><img:strokeLength>5</img:strokeLength><img:gapLength>2</img:gapLength></img:strokedPolyLine>)42 let $draw := paint:paint($local:gif,
43 {
44 "strokedPolyLine" : {
45 "points" : [ [10,10], [40,80], [50,30] ],
46 "strokeLength" : 5,
47 "gapLength" : 2
48 }
49 })
43 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStroked.gif"))50 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStroked.gif"))
44 return basic:equals($draw, $draw-ref)51 return basic:equals($draw, $draw-ref)
45};52};
@@ -49,7 +56,15 @@
49 : @return true if the man:draw-stroked-poly-line function works.56 : @return true if the man:draw-stroked-poly-line function works.
50 :)57 :)
51declare %an:nondeterministic function local:test-draw-stroked-poly-line-blue() as xs:boolean {58declare %an:nondeterministic function local:test-draw-stroked-poly-line-blue() as xs:boolean {
52 let $draw := paint:paint($local:gif, <img:strokedPolyLine><img:strokeColor>#0000FF</img:strokeColor><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point><img:strokeLength>5</img:strokeLength><img:gapLength>2</img:gapLength></img:strokedPolyLine>)59 let $draw := paint:paint($local:gif,
60 {
61 "strokedPolyLine" : {
62 "strokeColor" : "#0000FF",
63 "points" : [ [10,10], [40,80], [50,30] ],
64 "strokeLength" : 5,
65 "gapLength" : 2
66 }
67 })
53 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStrokedBlue.gif"))68 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStrokedBlue.gif"))
54 return basic:equals($draw, $draw-ref)69 return basic:equals($draw, $draw-ref)
55};70};
@@ -58,7 +73,15 @@
58 : @return true if the man:draw-stroked-poly-line function works.73 : @return true if the man:draw-stroked-poly-line function works.
59 :)74 :)
60declare %an:nondeterministic function local:test-draw-stroked-poly-line-wide() as xs:boolean {75declare %an:nondeterministic function local:test-draw-stroked-poly-line-wide() as xs:boolean {
61 let $draw := paint:paint($local:gif, <img:strokedPolyLine><img:strokeWidth>4</img:strokeWidth><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point><img:strokeLength>5</img:strokeLength><img:gapLength>2</img:gapLength></img:strokedPolyLine>)76 let $draw := paint:paint($local:gif,
77 {
78 "strokedPolyLine" : {
79 "strokeWidth" : 4,
80 "points" : [ [10,10], [40,80], [50,30] ],
81 "strokeLength" : 5,
82 "gapLength" : 2
83 }
84 })
62 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStrokedWide.gif"))85 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStrokedWide.gif"))
63 return basic:equals($draw, $draw-ref)86 return basic:equals($draw, $draw-ref)
64};87};
@@ -67,12 +90,20 @@
67 : @return true if the man:draw-stroked-poly-line function works.90 : @return true if the man:draw-stroked-poly-line function works.
68 :)91 :)
69declare %an:nondeterministic function local:test-draw-stroked-poly-line-anti-aliased() as xs:boolean {92declare %an:nondeterministic function local:test-draw-stroked-poly-line-anti-aliased() as xs:boolean {
70 let $draw := paint:paint($local:gif, <img:strokedPolyLine><img:antiAliasing>true</img:antiAliasing><img:point><img:x>10</img:x><img:y>10</img:y></img:point><img:point><img:x>40</img:x><img:y>80</img:y></img:point><img:point><img:x>50</img:x><img:y>30</img:y></img:point><img:strokeLength>5</img:strokeLength><img:gapLength>2</img:gapLength></img:strokedPolyLine>)93 let $draw := paint:paint($local:gif,
94 {
95 "strokedPolyLine" : {
96 "antiAliasing" : fn:true(),
97 "points" : [ [10,10], [40,80], [50,30] ],
98 "strokeLength" : 5,
99 "gapLength" : 2
100 }
101 })
71 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStrokedAntiAliased.gif"))102 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polyLineStrokedAntiAliased.gif"))
72 return basic:equals($draw, $draw-ref)103 return basic:equals($draw, $draw-ref)
73};104};
74105
75declare %an:nondeterministic %an:sequential function local:main() as xs:string* {106declare %an:nondeterministic function local:main() as xs:string* {
76107
77 let $a := local:test-draw-stroked-poly-line()108 let $a := local:test-draw-stroked-poly-line()
78 return109 return
79110
=== modified file 'test/Queries/image/paint_4.xq'
--- test/Queries/image/paint_4.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/paint_4.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';8import module namespace paint = 'http://zorba.io/modules/image/paint';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
@@ -39,7 +39,13 @@
39 : @return true if the man:draw-rectangle function works.39 : @return true if the man:draw-rectangle function works.
40 :)40 :)
41declare %an:nondeterministic function local:test-draw-rectangle() as xs:boolean {41declare %an:nondeterministic function local:test-draw-rectangle() as xs:boolean {
42 let $draw := paint:paint($local:gif, <image:rectangle><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight></image:rectangle>)42 let $draw := paint:paint($local:gif,
43 {
44 "rectangle" : {
45 "upperLeft" : [ 20, 20 ],
46 "lowerRight" : [ 50, 50 ]
47 }
48 })
43 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangle.gif"))49 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangle.gif"))
44 return basic:equals($draw, $draw-ref)50 return basic:equals($draw, $draw-ref)
45};51};
@@ -48,7 +54,14 @@
48 : @return true if the man:draw-rectangle function works.54 : @return true if the man:draw-rectangle function works.
49 :)55 :)
50declare %an:nondeterministic function local:test-draw-rectangle-green() as xs:boolean {56declare %an:nondeterministic function local:test-draw-rectangle-green() as xs:boolean {
51 let $draw := paint:paint($local:gif, <image:rectangle><image:strokeColor>#00AF00</image:strokeColor><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight></image:rectangle>)57 let $draw := paint:paint($local:gif,
58 {
59 "rectangle" : {
60 "strokeColor" : "#00AF00",
61 "upperLeft" : [ 20, 20 ],
62 "lowerRight" : [ 50, 50 ]
63 }
64 })
52 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleGreen.gif"))65 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleGreen.gif"))
53 return basic:equals($draw, $draw-ref)66 return basic:equals($draw, $draw-ref)
54};67};
@@ -58,7 +71,15 @@
58 : @return true if the man:draw-rectangle function works.71 : @return true if the man:draw-rectangle function works.
59 :)72 :)
60declare %an:nondeterministic function local:test-draw-rectangle-green-red() as xs:boolean {73declare %an:nondeterministic function local:test-draw-rectangle-green-red() as xs:boolean {
61 let $draw := paint:paint($local:gif, <image:rectangle><image:strokeColor>#00AF00</image:strokeColor><image:fillColor>#A10000</image:fillColor><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight></image:rectangle>)74 let $draw := paint:paint($local:gif,
75 {
76 "rectangle" : {
77 "strokeColor" : "#00AF00",
78 "fillColor" : "#A10000",
79 "upperLeft" : [ 20, 20 ],
80 "lowerRight" : [ 50, 50 ]
81 }
82 })
62 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleGreenRed.gif"))83 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleGreenRed.gif"))
63 return basic:equals($draw, $draw-ref)84 return basic:equals($draw, $draw-ref)
64};85};
@@ -68,7 +89,17 @@
68 : @return true if the man:draw-rectangle function works.89 : @return true if the man:draw-rectangle function works.
69 :)90 :)
70declare %an:nondeterministic function local:test-draw-rectangle-anti-aliased() as xs:boolean {91declare %an:nondeterministic function local:test-draw-rectangle-anti-aliased() as xs:boolean {
71 let $draw := paint:paint($local:gif, <image:rectangle><image:strokeWidth>5</image:strokeWidth><image:strokeColor>#00AF00</image:strokeColor><image:fillColor>#A10000</image:fillColor><image:antiAliasing>true</image:antiAliasing><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight></image:rectangle>)92 let $draw := paint:paint($local:gif,
93 {
94 "rectangle" : {
95 "strokeWidth" : 5,
96 "strokeColor" : "#00AF00",
97 "fillColor" : "#A10000",
98 "antiAliasing" : fn:true(),
99 "upperLeft" : [ 20, 20 ],
100 "lowerRight" : [ 50, 50 ]
101 }
102 })
72 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleAntiAliased.gif"))103 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleAntiAliased.gif"))
73 return basic:equals($draw, $draw-ref)104 return basic:equals($draw, $draw-ref)
74};105};
@@ -77,7 +108,15 @@
77 : @return true if the man:draw-rounded-rectangle function works.108 : @return true if the man:draw-rounded-rectangle function works.
78 :)109 :)
79declare %an:nondeterministic function local:test-draw-rounded-rectangle() as xs:boolean {110declare %an:nondeterministic function local:test-draw-rounded-rectangle() as xs:boolean {
80 let $draw := paint:paint($local:gif, <image:roundedRectangle><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight><image:cornerWidth>10</image:cornerWidth><image:cornerHeight>10</image:cornerHeight></image:roundedRectangle>)111 let $draw := paint:paint($local:gif,
112 {
113 "roundedRectangle" : {
114 "upperLeft" : [ 20, 20 ],
115 "lowerRight" : [ 50, 50 ],
116 "cornerWidth" : 10,
117 "cornerHeight" : 10
118 }
119 })
81 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRounded.gif"))120 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRounded.gif"))
82 return basic:equals($draw, $draw-ref)121 return basic:equals($draw, $draw-ref)
83};122};
@@ -86,7 +125,16 @@
86 : @return true if the man:draw-rounded-rectangle function works.125 : @return true if the man:draw-rounded-rectangle function works.
87 :)126 :)
88declare %an:nondeterministic function local:test-draw-rounded-rectangle-blue() as xs:boolean {127declare %an:nondeterministic function local:test-draw-rounded-rectangle-blue() as xs:boolean {
89 let $draw := paint:paint($local:gif, <image:roundedRectangle><image:strokeColor>#0000FF</image:strokeColor><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight><image:cornerWidth>10</image:cornerWidth><image:cornerHeight>10</image:cornerHeight></image:roundedRectangle>)128 let $draw := paint:paint($local:gif,
129 {
130 "roundedRectangle" : {
131 "strokeColor" : "#0000FF",
132 "upperLeft" : [ 20, 20 ],
133 "lowerRight" : [ 50, 50 ],
134 "cornerWidth" : 10,
135 "cornerHeight" : 10
136 }
137 })
90 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRoundedBlue.gif"))138 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRoundedBlue.gif"))
91 return basic:equals($draw, $draw-ref)139 return basic:equals($draw, $draw-ref)
92};140};
@@ -96,7 +144,17 @@
96 : @return true if the man:draw-rounded-rectangle function works.144 : @return true if the man:draw-rounded-rectangle function works.
97 :)145 :)
98declare %an:nondeterministic function local:test-draw-rounded-rectangle-blue-green() as xs:boolean {146declare %an:nondeterministic function local:test-draw-rounded-rectangle-blue-green() as xs:boolean {
99 let $draw := paint:paint($local:gif, <image:roundedRectangle><image:strokeColor>#0000FF</image:strokeColor><image:fillColor>#00FF00</image:fillColor><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight><image:cornerWidth>10</image:cornerWidth><image:cornerHeight>10</image:cornerHeight></image:roundedRectangle>)147 let $draw := paint:paint($local:gif,
148 {
149 "roundedRectangle" : {
150 "strokeColor" : "#0000FF",
151 "fillColor" : "#00FF00",
152 "upperLeft" : [ 20, 20 ],
153 "lowerRight" : [ 50, 50 ],
154 "cornerWidth" : 10,
155 "cornerHeight" : 10
156 }
157 })
100 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRoundedBlueGreen.gif"))158 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRoundedBlueGreen.gif"))
101 return basic:equals($draw, $draw-ref)159 return basic:equals($draw, $draw-ref)
102};160};
@@ -106,13 +164,24 @@
106 : @return true if the man:draw-rounded-rectangle function works.164 : @return true if the man:draw-rounded-rectangle function works.
107 :)165 :)
108declare %an:nondeterministic function local:test-draw-rounded-rectangle-anti-aliased() as xs:boolean {166declare %an:nondeterministic function local:test-draw-rounded-rectangle-anti-aliased() as xs:boolean {
109 let $draw := paint:paint($local:gif, <image:roundedRectangle><image:strokeColor>#0000FF</image:strokeColor><image:fillColor>#00FF00</image:fillColor><image:antiAliasing>true</image:antiAliasing><image:upperLeft><image:x>20</image:x><image:y>20</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>50</image:y></image:lowerRight><image:cornerWidth>10</image:cornerWidth><image:cornerHeight>10</image:cornerHeight></image:roundedRectangle>)167 let $draw := paint:paint($local:gif,
168 {
169 "roundedRectangle" : {
170 "strokeColor" : "#0000FF",
171 "fillColor" : "#00FF00",
172 "antiAliased" : fn:true(),
173 "upperLeft" : [ 20, 20 ],
174 "lowerRight" : [ 50, 50 ],
175 "cornerWidth" : 10,
176 "cornerHeight" : 10
177 }
178 })
110 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRoundedAntiAliased.gif"))179 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/rectangleRoundedAntiAliased.gif"))
111 return basic:equals($draw, $draw-ref)180 return basic:equals($draw, $draw-ref)
112};181};
113182
114183
115declare %an:nondeterministic %an:sequential function local:main() as xs:string* {184declare %an:nondeterministic function local:main() as xs:string* {
116185
117 let $a := local:test-draw-rectangle()186 let $a := local:test-draw-rectangle()
118 return187 return
119188
=== modified file 'test/Queries/image/paint_5.xq'
--- test/Queries/image/paint_5.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/paint_5.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';8import module namespace paint = 'http://zorba.io/modules/image/paint';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
@@ -40,7 +40,12 @@
40 : @return true if the man:draw-circle function works.40 : @return true if the man:draw-circle function works.
41 :)41 :)
42declare %an:nondeterministic function local:test-draw-circle() as xs:boolean {42declare %an:nondeterministic function local:test-draw-circle() as xs:boolean {
43 let $draw := paint:paint($local:jpg, <image:circle><image:origin><image:x>20</image:x><image:y>20</image:y></image:origin><image:perimeter>5</image:perimeter></image:circle>)43 let $draw := paint:paint($local:jpg, {
44 "circle" : {
45 "origin" : [ 20, 20 ],
46 "radius" : 5
47 }
48 })
44 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/circle.jpg"))49 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/circle.jpg"))
45 return basic:equals($draw, $draw-ref)50 return basic:equals($draw, $draw-ref)
46};51};
@@ -50,7 +55,13 @@
50 : @return true if the man:draw-ellipse function works.55 : @return true if the man:draw-ellipse function works.
51 :)56 :)
52declare %an:nondeterministic function local:test-draw-ellipse() as xs:boolean {57declare %an:nondeterministic function local:test-draw-ellipse() as xs:boolean {
53 let $draw := paint:paint($local:jpg, <image:ellipse><image:origin><image:x>50</image:x><image:y>50</image:y></image:origin><image:perimeterX>30</image:perimeterX><image:perimeterY>20</image:perimeterY></image:ellipse>)58 let $draw := paint:paint($local:jpg, {
59 "ellipse" : {
60 "origin" : [ 50, 50 ],
61 "radiusX" : 30,
62 "radiusY" : 20
63 }
64 })
54 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/ellipse.jpg"))65 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/ellipse.jpg"))
55 return basic:equals($draw, $draw-ref)66 return basic:equals($draw, $draw-ref)
56};67};
@@ -59,7 +70,15 @@
59 : @return true if the man:draw-arc function works.70 : @return true if the man:draw-arc function works.
60 :)71 :)
61declare %an:nondeterministic function local:test-draw-arc() as xs:boolean {72declare %an:nondeterministic function local:test-draw-arc() as xs:boolean {
62 let $draw := paint:paint($local:jpg, <image:arc><image:origin><image:x>50</image:x><image:y>50</image:y></image:origin><image:perimeterX>10</image:perimeterX><image:perimeterY>20</image:perimeterY><image:startDegrees>180</image:startDegrees><image:endDegrees>270</image:endDegrees></image:arc>)73 let $draw := paint:paint($local:jpg, {
74 "arc" : {
75 "origin" : [ 50, 50 ],
76 "radiusX" : 10,
77 "radiusY" : 20,
78 "startDegrees" : 180,
79 "endDegrees" : 270
80 }
81 })
63 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arc.jpg"))82 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arc.jpg"))
64 return basic:equals($draw, $draw-ref)83 return basic:equals($draw, $draw-ref)
65};84};
@@ -68,7 +87,16 @@
68 : @return true if the man:draw-arc function works.87 : @return true if the man:draw-arc function works.
69 :)88 :)
70declare %an:nondeterministic function local:test-draw-red-arc() as xs:boolean {89declare %an:nondeterministic function local:test-draw-red-arc() as xs:boolean {
71 let $draw := paint:paint($local:jpg, <image:arc><image:strokeColor>#FF0000</image:strokeColor><image:origin><image:x>50</image:x><image:y>50</image:y></image:origin><image:perimeterX>10</image:perimeterX><image:perimeterY>20</image:perimeterY><image:startDegrees>180</image:startDegrees><image:endDegrees>270</image:endDegrees></image:arc>)90 let $draw := paint:paint($local:jpg, {
91 "arc" : {
92 "strokeColor" : "#FF0000",
93 "origin" : [ 50, 50 ],
94 "radiusX" : 10,
95 "radiusY" : 20,
96 "startDegrees" : 180,
97 "endDegrees" : 270
98 }
99 })
72 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcRed.jpg"))100 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcRed.jpg"))
73 return basic:equals($draw, $draw-ref)101 return basic:equals($draw, $draw-ref)
74};102};
@@ -77,7 +105,17 @@
77 : @return true if the man:draw-arc function works.105 : @return true if the man:draw-arc function works.
78 :)106 :)
79declare %an:nondeterministic function local:test-draw-red-green-arc() as xs:boolean {107declare %an:nondeterministic function local:test-draw-red-green-arc() as xs:boolean {
80 let $draw := paint:paint($local:jpg, <image:arc><image:strokeColor>#FF0000</image:strokeColor><image:fillColor>#00AF00</image:fillColor><image:origin><image:x>50</image:x><image:y>50</image:y></image:origin><image:perimeterX>10</image:perimeterX><image:perimeterY>20</image:perimeterY><image:startDegrees>180</image:startDegrees><image:endDegrees>270</image:endDegrees></image:arc>)108 let $draw := paint:paint($local:jpg, {
109 "arc" : {
110 "strokeColor" : "#FF0000",
111 "fillColor" : "#00AF00",
112 "origin" : [ 50, 50 ],
113 "radiusX" : 10,
114 "radiusY" : 20,
115 "startDegrees" : 180,
116 "endDegrees" : 270
117 }
118 })
81 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcRedGreen.jpg"))119 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcRedGreen.jpg"))
82 return basic:equals($draw, $draw-ref)120 return basic:equals($draw, $draw-ref)
83};121};
@@ -86,7 +124,18 @@
86 : @return true if the man:draw-arc function works.124 : @return true if the man:draw-arc function works.
87 :)125 :)
88declare %an:nondeterministic function local:test-draw-wide-arc() as xs:boolean {126declare %an:nondeterministic function local:test-draw-wide-arc() as xs:boolean {
89 let $draw := paint:paint($local:jpg, <image:arc><image:strokeWidth>5</image:strokeWidth><image:strokeColor>#FF0000</image:strokeColor><image:fillColor>#00AF00</image:fillColor><image:origin><image:x>50</image:x><image:y>50</image:y></image:origin><image:perimeterX>10</image:perimeterX><image:perimeterY>20</image:perimeterY><image:startDegrees>180</image:startDegrees><image:endDegrees>270</image:endDegrees></image:arc>)127 let $draw := paint:paint($local:jpg, {
128 "arc" : {
129 "strokeWidth" : 5,
130 "strokeColor" : "#FF0000",
131 "fillColor" : "#00AF00",
132 "origin" : [ 50, 50 ],
133 "radiusX" : 10,
134 "radiusY" : 20,
135 "startDegrees" : 180,
136 "endDegrees" : 270
137 }
138 })
90 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcWide.jpg"))139 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcWide.jpg"))
91 return basic:equals($draw, $draw-ref)140 return basic:equals($draw, $draw-ref)
92};141};
@@ -97,7 +146,19 @@
97 : @return true if the man:draw-arc function works.146 : @return true if the man:draw-arc function works.
98 :)147 :)
99declare %an:nondeterministic function local:test-draw-anti-aliased-arc() as xs:boolean {148declare %an:nondeterministic function local:test-draw-anti-aliased-arc() as xs:boolean {
100 let $draw := paint:paint($local:jpg, <image:arc><image:strokeWidth>5</image:strokeWidth><image:strokeColor>#FF0000</image:strokeColor><image:fillColor>#00AF00</image:fillColor><image:antiAliasing>true</image:antiAliasing><image:origin><image:x>50</image:x><image:y>50</image:y></image:origin><image:perimeterX>10</image:perimeterX><image:perimeterY>20</image:perimeterY><image:startDegrees>180</image:startDegrees><image:endDegrees>270</image:endDegrees></image:arc>)149 let $draw := paint:paint($local:jpg, {
150 "arc" : {
151 "strokeWidth" : 5,
152 "strokeColor" : "#FF0000",
153 "fillColor" : "#00AF00",
154 "antiAliasing" : fn:true(),
155 "origin" : [ 50, 50 ],
156 "radiusX" : 10,
157 "radiusY" : 20,
158 "startDegrees" : 180,
159 "endDegrees" : 270
160 }
161 })
101 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcAntiAliased.jpg"))162 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/arcAntiAliased.jpg"))
102 return basic:equals($draw, $draw-ref)163 return basic:equals($draw, $draw-ref)
103};164};
@@ -106,7 +167,7 @@
106167
107168
108169
109declare %an:nondeterministic %an:sequential function local:main() as xs:string* {170declare %an:nondeterministic function local:main() as xs:string* {
110171
111 let $a := local:test-draw-circle()172 let $a := local:test-draw-circle()
112 return173 return
113174
=== modified file 'test/Queries/image/paint_6.xq'
--- test/Queries/image/paint_6.xq 2013-08-09 09:37:05 +0000
+++ test/Queries/image/paint_6.xq 2013-10-23 04:15:35 +0000
@@ -3,10 +3,10 @@
3 : 3 :
4 : @author Daniel Thomas4 : @author Daniel Thomas
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace file = 'http://expath.org/ns/file';7import module namespace file = 'http://expath.org/ns/file';
8import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';8import module namespace paint = 'http://zorba.io/modules/image/paint';
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11declare namespace an = "http://zorba.io/annotations";11declare namespace an = "http://zorba.io/annotations";
1212
@@ -37,7 +37,12 @@
37 : @return true if the man:draw-polygon function works.37 : @return true if the man:draw-polygon function works.
38 :)38 :)
39declare %an:nondeterministic function local:test-draw-polygon() as xs:boolean {39declare %an:nondeterministic function local:test-draw-polygon() as xs:boolean {
40 let $draw := paint:paint($local:jpg, <image:polygon><image:point><image:x>10</image:x><image:y>10</image:y></image:point><image:point><image:x>40</image:x><image:y>80</image:y></image:point><image:point><image:x>50</image:x><image:y>30</image:y></image:point></image:polygon>)40 let $draw := paint:paint($local:jpg,
41 {
42 "polygon" : {
43 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
44 }
45 })
41 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygon.jpg"))46 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygon.jpg"))
42 return basic:equals($draw, $draw-ref)47 return basic:equals($draw, $draw-ref)
43};48};
@@ -46,7 +51,13 @@
46 : @return true if the man:draw-polygon function works.51 : @return true if the man:draw-polygon function works.
47 :)52 :)
48declare %an:nondeterministic function local:test-draw-polygon-red() as xs:boolean {53declare %an:nondeterministic function local:test-draw-polygon-red() as xs:boolean {
49 let $draw := paint:paint($local:jpg, <image:polygon><image:strokeColor>#FF0000</image:strokeColor><image:point><image:x>10</image:x><image:y>10</image:y></image:point><image:point><image:x>40</image:x><image:y>80</image:y></image:point><image:point><image:x>50</image:x><image:y>30</image:y></image:point></image:polygon>)54 let $draw := paint:paint($local:jpg,
55 {
56 "polygon" : {
57 "strokeColor" : "#FF0000",
58 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
59 }
60 })
50 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonRed.jpg"))61 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonRed.jpg"))
51 return basic:equals($draw, $draw-ref)62 return basic:equals($draw, $draw-ref)
52};63};
@@ -55,7 +66,14 @@
55 : @return true if the man:draw-polygon function works.66 : @return true if the man:draw-polygon function works.
56 :)67 :)
57declare %an:nondeterministic function local:test-draw-polygon-red-green() as xs:boolean {68declare %an:nondeterministic function local:test-draw-polygon-red-green() as xs:boolean {
58 let $draw := paint:paint($local:jpg, <image:polygon><image:strokeColor>#FF0000</image:strokeColor><image:fillColor>#00FF00</image:fillColor><image:point><image:x>10</image:x><image:y>10</image:y></image:point><image:point><image:x>40</image:x><image:y>80</image:y></image:point><image:point><image:x>50</image:x><image:y>30</image:y></image:point></image:polygon>)69 let $draw := paint:paint($local:jpg,
70 {
71 "polygon" : {
72 "strokeColor" : "#FF0000",
73 "fillColor" : "#00FF00",
74 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
75 }
76 })
59 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonRedGreen.jpg"))77 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonRedGreen.jpg"))
60 return basic:equals($draw, $draw-ref)78 return basic:equals($draw, $draw-ref)
61};79};
@@ -64,7 +82,15 @@
64 : @return true if the man:draw-polygon function works.82 : @return true if the man:draw-polygon function works.
65 :)83 :)
66declare %an:nondeterministic function local:test-draw-polygon-wide() as xs:boolean {84declare %an:nondeterministic function local:test-draw-polygon-wide() as xs:boolean {
67 let $draw := paint:paint($local:jpg, <image:polygon><image:strokeWidth>3</image:strokeWidth><image:strokeColor>#FF0000</image:strokeColor><image:fillColor>#00FF00</image:fillColor><image:point><image:x>10</image:x><image:y>10</image:y></image:point><image:point><image:x>40</image:x><image:y>80</image:y></image:point><image:point><image:x>50</image:x><image:y>30</image:y></image:point></image:polygon>)85 let $draw := paint:paint($local:jpg,
86 {
87 "polygon" : {
88 "strokeWidth" : 3,
89 "strokeColor" : "#FF0000",
90 "fillColor" : "#00FF00",
91 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
92 }
93 })
68 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonWide.jpg"))94 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonWide.jpg"))
69 return basic:equals($draw, $draw-ref)95 return basic:equals($draw, $draw-ref)
70};96};
@@ -74,7 +100,16 @@
74 : @return true if the man:draw-polygon function works.100 : @return true if the man:draw-polygon function works.
75 :)101 :)
76declare %an:nondeterministic function local:test-draw-polygon-anti-aliased() as xs:boolean {102declare %an:nondeterministic function local:test-draw-polygon-anti-aliased() as xs:boolean {
77 let $draw := paint:paint($local:jpg, <image:polygon><image:strokeWidth>3</image:strokeWidth><image:strokeColor>#FF0000</image:strokeColor><image:fillColor>#00FF00</image:fillColor><image:antiAliasing>true</image:antiAliasing><image:point><image:x>10</image:x><image:y>10</image:y></image:point><image:point><image:x>40</image:x><image:y>80</image:y></image:point><image:point><image:x>50</image:x><image:y>30</image:y></image:point></image:polygon>)103 let $draw := paint:paint($local:jpg,
104 {
105 "polygon" : {
106 "strokeWidth" : 3,
107 "strokeColor" : "#FF0000",
108 "fillColor" : "#00FF00",
109 "antiAliasing" : fn:true(),
110 "points" : [ [ 10, 10 ], [ 40, 80 ], [ 50, 30 ] ]
111 }
112 })
78 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonAntiAliased.jpg"))113 let $draw-ref := file:read-binary(concat($local:image-dir, "paint/polygonAntiAliased.jpg"))
79 return basic:equals($draw, $draw-ref)114 return basic:equals($draw, $draw-ref)
80};115};
81116
=== modified file 'test/Queries/image/paint_circles.xq'
--- test/Queries/image/paint_circles.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_circles.xq 2013-10-23 04:15:35 +0000
@@ -3,34 +3,58 @@
3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it 3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it
4 : to disk using file:write(a_path, $image-with-circles, <method>binary</method>), send it in an email etc.4 : to disk using file:write(a_path, $image-with-circles, <method>binary</method>), send it in an email etc.
5 : 5 :
6 : Actually, as the paint function accepts sequences of shapes, it would have been possible to paint all circles, ellipses and arcs with one single command6 : Actually, as the paint function accepts sequences of shapes, it would have been possible to paint all circles, ellipses and arcs with one single command
7 : paint:paint($new-image, (<image:circle><image:origin><image:x>20</image:x><image:y>20</image:y></image:origin><image:perimeter>20</image:perimeter></image:circle>,
8 : <image:ellipse><image:origin><image:x>40</image:x><image:y>70</image:y></image:origin><image:perimeterX>20</image:perimeterX><image:perimeterY>10</image:perimeterY></image:ellipse>,
9 : <image:arc><image:origin><image:x>70</image:x><image:y>35</image:y></image:origin><image:perimeterX>15</image:perimeterX><image:perimeterY>25</image:perimeterY><image:startDegrees>90</image:startDegrees><image:endDegrees>180</image:endDegrees></image:arc>,
10 : <image:circle><image:fillColor>#0000FF</image:fillColor><image:origin><image:x>80</image:x><image:y>20</image:y></image:origin><image:perimeter>20</image:perimeter></image:circle>))
11 :
12 : However, here it is done with several function calls to make it more clear what exactly is painted.7 : However, here it is done with several function calls to make it more clear what exactly is painted.
13 :8 :
14 :)9 :)
15import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';10import module namespace basic = 'http://zorba.io/modules/image/basic';
16import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';11import module namespace paint = 'http://zorba.io/modules/image/paint';
17import module namespace file = 'http://expath.org/ns/file';12import module namespace file = 'http://expath.org/ns/file';
1813
19import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';14import schema namespace image = 'http://zorba.io/modules/image/image';
2015
21let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")16let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")
2217
23(: paint a simple circle with origin in (20, 20) and a perimeter of 20px to the image :)18(: paint a simple circle with origin in (20, 20) and a perimeter of 20px to the image :)
24let $image-with-circle := paint:paint($new-image, <image:circle><image:origin><image:x>20</image:x><image:y>20</image:y></image:origin><image:perimeter>20</image:perimeter></image:circle>)19let $image-with-circle := paint:paint($new-image,
20{
21 "circle" : {
22 "origin" : [ 20, 20 ],
23 "radius" : 20
24 }
25})
2526
26(: paint an ellipse to the image :)27(: paint an ellipse to the image :)
27let $image-with-circles := paint:paint($image-with-circle, <image:ellipse><image:origin><image:x>40</image:x><image:y>70</image:y></image:origin><image:perimeterX>20</image:perimeterX><image:perimeterY>10</image:perimeterY></image:ellipse>)28let $image-with-circles := paint:paint($image-with-circle,
29{
30 "ellipse" : {
31 "origin" : [ 40, 70 ],
32 "radiusX" : 20,
33 "radiusY" : 10
34 }
35})
2836
29(: paint an arc from 90 to 180 degrees to the image :)37(: paint an arc from 90 to 180 degrees to the image :)
30let $image-with-circles := paint:paint($image-with-circles, <image:arc><image:origin><image:x>70</image:x><image:y>35</image:y></image:origin><image:perimeterX>15</image:perimeterX><image:perimeterY>25</image:perimeterY><image:startDegrees>90</image:startDegrees><image:endDegrees>180</image:endDegrees></image:arc>)38let $image-with-circles := paint:paint($image-with-circles,
39{
40 "arc" : {
41 "origin" : [ 70, 35 ],
42 "radiusX" : 15,
43 "radiusY" : 25,
44 "startDegrees" : 90,
45 "endDegrees" : 180
46 }
47})
3148
32(: paint a blue circle with black contour onto the image :)49(: paint a blue circle with black contour onto the image :)
33let $image-with-circles := paint:paint($image-with-circles, <image:circle><image:fillColor>#0000FF</image:fillColor><image:origin><image:x>80</image:x><image:y>20</image:y></image:origin><image:perimeter>20</image:perimeter></image:circle>)50let $image-with-circles := paint:paint($image-with-circles,
51{
52 "circle" : {
53 "fillColor" : "#0000FF",
54 "origin" : [ 80, 20 ],
55 "radius" : 20
56 }
57})
3458
3559
36return not(empty($image-with-circles)) 60return not(empty($image-with-circles))
3761
=== modified file 'test/Queries/image/paint_different_lines.xq'
--- test/Queries/image/paint_different_lines.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_different_lines.xq 2013-10-23 04:15:35 +0000
@@ -10,20 +10,50 @@
10 :10 :
11 : However, to show exactly what is painted it was done with several function calls in this example (which is much less performant).11 : However, to show exactly what is painted it was done with several function calls in this example (which is much less performant).
12 :)12 :)
13import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; 13import module namespace basic = 'http://zorba.io/modules/image/basic';
14import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';14import module namespace paint = 'http://zorba.io/modules/image/paint';
1515
16import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';16import schema namespace image = 'http://zorba.io/modules/image/image';
1717
18let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")18let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")
19(: paint a simple line from (10, 0) to (10, 100) :)19(: paint a simple line from (10, 0) to (10, 100) :)
20let $image-with-1-line := paint:paint($new-image, <image:line><image:start><image:x>10</image:x><image:y>0</image:y></image:start><image:end><image:x>10</image:x><image:y>100</image:y></image:end></image:line>)20let $image-with-1-line := paint:paint($new-image,
21{
22 "line" : {
23 "start" : [10,0],
24 "end" : [10,100]
25 }
26})
21(: paint a simple red line from (30, 0) to (30, 100) :)27(: paint a simple red line from (30, 0) to (30, 100) :)
22let $image-with-2-line := paint:paint($image-with-1-line, <image:line><image:strokeColor>#FF0000</image:strokeColor><image:start><image:x>30</image:x><image:y>0</image:y></image:start><image:end><image:x>30</image:x><image:y>100</image:y></image:end></image:line>)28let $image-with-2-line := paint:paint($image-with-1-line,
29{
30 "line" : {
31 "strokeColor" : "#FF0000",
32 "start" : [30,0],
33 "end" : [30,100]
34 }
35})
23(: paint a simple red anti-aliased line from (50, 0) to (50, 100) :)36(: paint a simple red anti-aliased line from (50, 0) to (50, 100) :)
24let $image-with-3-line := paint:paint($image-with-2-line, <image:line><image:strokeColor>#FF0000</image:strokeColor><image:antiAliasing>true</image:antiAliasing><image:start><image:x>50</image:x><image:y>0</image:y></image:start><image:end><image:x>50</image:x><image:y>100</image:y></image:end></image:line>)37let $image-with-3-line := paint:paint($image-with-2-line,
38{
39 "line" : {
40 "strokeColor" : "#FF0000",
41 "antiAliasing" : fn:true(),
42 "start" : [50,0],
43 "end" : [50,100]
44 }
45})
25(: paint a simple red wide anti-aliased line from (70, 0) to (70, 100) :)46(: paint a simple red wide anti-aliased line from (70, 0) to (70, 100) :)
26let $image-with-4-line := paint:paint($image-with-3-line, <image:line><image:strokeWidth>10</image:strokeWidth><image:strokeColor>#FF0000</image:strokeColor><image:antiAliasing>true</image:antiAliasing><image:start><image:x>70</image:x><image:y>0</image:y></image:start><image:end><image:x>70</image:x><image:y>100</image:y></image:end></image:line>)47let $image-with-4-line := paint:paint($image-with-3-line,
48{
49 "line" : {
50 "strokeWidth" : 10,
51 "strokeColor" : "#FF0000",
52 "antiAliasing" : fn:true(),
53 "start" : [70,0],
54 "end" : [70,100]
55 }
56})
2757
28return not(empty($image-with-4-line))58return not(empty($image-with-4-line))
2959
3060
=== modified file 'test/Queries/image/paint_polygon.xq'
--- test/Queries/image/paint_polygon.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_polygon.xq 2013-10-23 04:15:35 +0000
@@ -3,15 +3,20 @@
3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it 3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it
4 : to disk using file:write(a_path, $image-with-polygon, <method>binary</method>), send it in an email etc.4 : to disk using file:write(a_path, $image-with-polygon, <method>binary</method>), send it in an email etc.
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; 6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';7import module namespace paint = 'http://zorba.io/modules/image/paint';
88
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")11let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")
1212
13(: paint an anti-aliased polyline which goes through the points (0,0) (30, 70), (20, 18), (89, 33) :)13(: paint an anti-aliased polyline which goes through the points (0,0) (30, 70), (20, 18), (89, 33) :)
14let $image-with-polygon := paint:paint($new-image, <image:polygon><image:antiAliasing>true</image:antiAliasing><image:point><image:x>0</image:x><image:y>0</image:y></image:point><image:point><image:x>30</image:x><image:y>70</image:y></image:point><image:point><image:x>20</image:x><image:y>18</image:y></image:point><image:point><image:x>89</image:x><image:y>33</image:y></image:point></image:polygon>)14let $image-with-polygon := paint:paint($new-image, {
15 "polyLine" : {
16 "antiAliasing" : fn:true(),
17 "points" : [ [ 0, 0 ], [ 30, 70 ], [ 20, 18 ], [ 89, 33 ] ]
18 }
19})
1520
16return not(empty($image-with-polygon)) 21return not(empty($image-with-polygon))
1722
1823
=== modified file 'test/Queries/image/paint_polyline.xq'
--- test/Queries/image/paint_polyline.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_polyline.xq 2013-10-23 04:15:35 +0000
@@ -3,15 +3,20 @@
3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it 3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it
4 : to disk using file:write(a_path, $image-with-polyline, <method>binary</method>), send it in an email etc.4 : to disk using file:write(a_path, $image-with-polyline, <method>binary</method>), send it in an email etc.
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; 6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';7import module namespace paint = 'http://zorba.io/modules/image/paint';
88
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")11let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")
1212
13(: paint an anti-aliased polyline which goes through the points (0,0) (30, 70), (20, 18), (89, 33) :)13(: paint an anti-aliased polyline which goes through the points (0,0) (30, 70), (20, 18), (89, 33) :)
14let $image-with-polyline := paint:paint($new-image, <image:polyLine><image:antiAliasing>true</image:antiAliasing><image:point><image:x>0</image:x><image:y>0</image:y></image:point><image:point><image:x>30</image:x><image:y>70</image:y></image:point><image:point><image:x>20</image:x><image:y>18</image:y></image:point><image:point><image:x>89</image:x><image:y>33</image:y></image:point></image:polyLine>)14let $image-with-polyline := paint:paint($new-image, {
15 "polyLine" : {
16 "antiAliasing" : fn:true(),
17 "points" : [ [ 0, 0 ], [ 30, 70 ], [ 20, 18 ], [ 89, 33 ] ]
18 }
19})
1520
16return not(empty($image-with-polyline)) 21return not(empty($image-with-polyline))
1722
1823
=== modified file 'test/Queries/image/paint_rectangles.xq'
--- test/Queries/image/paint_rectangles.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_rectangles.xq 2013-10-23 04:15:35 +0000
@@ -12,20 +12,42 @@
12 :12 :
13 : However, to make clear what exaclty is painted it was done with several function calls in this example (which is less performant).13 : However, to make clear what exaclty is painted it was done with several function calls in this example (which is less performant).
14 :)14 :)
15import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';15import module namespace basic = 'http://zorba.io/modules/image/basic';
16import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';16import module namespace paint = 'http://zorba.io/modules/image/paint';
1717
18import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';18import schema namespace image = 'http://zorba.io/modules/image/image';
1919
20let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")20let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")
2121
22(: paint a simple rectangle to the image :) 22(: paint a simple rectangle to the image :)
23let $image-with-rectangle := paint:paint($new-image, <image:rectangle><image:upperLeft><image:x>10</image:x><image:y>10</image:y></image:upperLeft><image:lowerRight><image:x>20</image:x><image:y>20</image:y></image:lowerRight></image:rectangle>) 23let $image-with-rectangle := paint:paint($new-image,
24{
25 "rectangle" : {
26 "upperLeft" : [10,10],
27 "lowerRight" : [20,20]
28 }
29})
2430
25(: paint a rounded rectangle to the image with a corner width of 10px and a corner height of 10 px :) 31(: paint a rounded rectangle to the image with a corner width of 10px and a corner height of 10 px :)
26let $image-with-rectangles := paint:paint($image-with-rectangle, <image:roundedRectangle><image:upperLeft><image:x>30</image:x><image:y>30</image:y></image:upperLeft><image:lowerRight><image:x>50</image:x><image:y>60</image:y></image:lowerRight><image:cornerWidth>10</image:cornerWidth><image:cornerHeight>10</image:cornerHeight></image:roundedRectangle>)32let $image-with-rectangles := paint:paint($image-with-rectangle,
33{
34 "roundedRectangle" : {
35 "upperLeft" : [30,30],
36 "lowerRight" : [50,60],
37 "cornerWidth" : 10,
38 "cornerHeight" : 10
39 }
40})
2741
28(: paint a rectangle with green contour which is filled with red to the image :) 42(: paint a rectangle with green contour which is filled with red to the image :)
29let $image-with-rectangles := paint:paint($image-with-rectangles, <image:rectangle><image:strokeColor>#00FF00</image:strokeColor><image:fillColor>#FF0000</image:fillColor><image:upperLeft><image:x>75</image:x><image:y>10</image:y></image:upperLeft><image:lowerRight><image:x>95</image:x><image:y>50</image:y></image:lowerRight></image:rectangle>)43let $image-with-rectangles := paint:paint($image-with-rectangles,
44{
45 "rectangle" : {
46 "strokeColor" : "#00FF00",
47 "fillColor" : "#FF0000",
48 "upperLeft" : [75,10],
49 "lowerRight" : [95,50]
50 }
51})
3052
31return not(empty($image-with-rectangles)) 53return not(empty($image-with-rectangles))
3254
=== modified file 'test/Queries/image/paint_stroked_polyline.xq'
--- test/Queries/image/paint_stroked_polyline.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_stroked_polyline.xq 2013-10-23 04:15:35 +0000
@@ -3,14 +3,21 @@
3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it 3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it
4 : to disk using file:write(a_path, $image-with-polyline, <method>binary</method>), send it in an email etc.4 : to disk using file:write(a_path, $image-with-polyline, <method>binary</method>), send it in an email etc.
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic';6import module namespace basic = 'http://zorba.io/modules/image/basic';
7import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint';7import module namespace paint = 'http://zorba.io/modules/image/paint';
88
9import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';9import schema namespace image = 'http://zorba.io/modules/image/image';
1010
11let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")11let $new-image := basic:create(xs:unsignedInt(100), xs:unsignedInt(100), "GIF")
12(: paint an anti-aliased polyline with stoke length 2 and gap length 1 which goes through the points (0,0) (30, 70), (20, 18), (89, 33) :)12(: paint an anti-aliased polyline with stoke length 2 and gap length 1 which goes through the points (0,0) (30, 70), (20, 18), (89, 33) :)
13let $image-with-polyline := paint:paint($new-image, <image:strokedPolyLine><image:antiAliasing>true</image:antiAliasing><image:point><image:x>0</image:x><image:y>0</image:y></image:point><image:point><image:x>30</image:x><image:y>70</image:y></image:point><image:point><image:x>20</image:x><image:y>18</image:y></image:point><image:point><image:x>89</image:x><image:y>33</image:y></image:point><image:strokeLength>2</image:strokeLength><image:gapLength>5</image:gapLength></image:strokedPolyLine>)13let $image-with-polyline := paint:paint($new-image,
14{
15 "strokedPolyLine" : {
16 "points" : [ [ 0, 0 ], [ 30, 70 ], [ 20, 18 ], [ 89, 33 ] ],
17 "strokeLength" : 2,
18 "gapLength" : 5
19 }
20})
1421
15return not(empty($image-with-polyline)) 22return not(empty($image-with-polyline))
1623
1724
=== modified file 'test/Queries/image/paint_text.xq'
--- test/Queries/image/paint_text.xq 2011-08-07 00:38:36 +0000
+++ test/Queries/image/paint_text.xq 2013-10-23 04:15:35 +0000
@@ -3,13 +3,21 @@
3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it 3 : As it is, the example just asserts that the resulting xs:base64Binary is not empty, in a real application one could further process the image, or write it
4 : to disk using file:write-binary(a_path, $image-with-text), send it in an email etc.4 : to disk using file:write-binary(a_path, $image-with-text), send it in an email etc.
5 :)5 :)
6import module namespace basic = 'http://www.zorba-xquery.com/modules/image/basic'; import module namespace paint = 'http://www.zorba-xquery.com/modules/image/paint'; 6import module namespace basic = 'http://zorba.io/modules/image/basic'; import module namespace paint = 'http://zorba.io/modules/image/paint';
7import schema namespace image = 'http://www.zorba-xquery.com/modules/image/image';7import schema namespace image = 'http://zorba.io/modules/image/image';
88
9let $new-image := basic:create(xs:unsignedInt(200), xs:unsignedInt(100), "GIF")9let $new-image := basic:create(xs:unsignedInt(200), xs:unsignedInt(100), "GIF")
1010
11(: write a really important message to the image :)11(: write a really important message to the image :)
1212
13let $image-with-text := paint:paint($new-image, <image:text><image:origin><image:x>10</image:x><image:y>40</image:y></image:origin><image:text>Zorba really rocks!</image:text><image:font>Arial</image:font><image:font-size>12</image:font-size></image:text>)13let $image-with-text := paint:paint($new-image,
14{
15 "text" : {
16 "origin" : [ 10, 40 ],
17 "text" : "Zorba really rocks!",
18 "font" : "Arial",
19 "fontSize" : 12
20 }
21})
1422
15return not(empty($image-with-text)) 23return not(empty($image-with-text))

Subscribers

People subscribed via source and target branches

to all changes: