diff options
author | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-12-27 13:06:36 +0200 |
---|---|---|
committer | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-12-27 13:06:36 +0200 |
commit | a9baa55456aff95e7797dbe1f9b19d2afb5034e1 (patch) | |
tree | 0ba8d0f606b632231796bd8f65b4c6d02d591d16 |
Initial commit
403 files changed, 19758 insertions, 0 deletions
diff --git a/doc/doc.pri b/doc/doc.pri new file mode 100644 index 0000000..ab61372 --- /dev/null +++ b/doc/doc.pri @@ -0,0 +1,8 @@ +OTHER_FILES += $$PWD/qtgraphicaleffects.qdocconf + +docs_target.target = docs +docs_target.commands = qdoc3 $$PWD/qtgraphicaleffects.qdocconf + +QMAKE_EXTRA_TARGETS = docs_target +QMAKE_CLEAN += "-r $$PWD/html" + diff --git a/doc/qtgraphicaleffects.qdocconf b/doc/qtgraphicaleffects.qdocconf new file mode 100644 index 0000000..20e82fc --- /dev/null +++ b/doc/qtgraphicaleffects.qdocconf @@ -0,0 +1,64 @@ +# Name of the project. +project = QtGraphicalEffects + +# Directories in which to search for files to document. +# Paths are relative to the location of this file. +exampledirs += ./src +#headerdirs += ./src ../src +imagedirs += ./src/images +sourcedirs += ./src + +# The following parameters are for creating a qhp file, the qhelpgenerator +# program can convert the qhp file into a qch file which can be opened in +# Qt Assistant and/or Qt Creator. + +# Defines the name of the project. You cannot use operators (+, =, -) in +# the name. Properties for this project are set using a qhp.<projectname>.property +# format. +qhp.projects = QtGraphicalEffects + +# Sets the name of the output qhp file. +qhp.QtGraphicalEffects.file = QtGraphicalEffects.qhp + +# Namespace for the output file. This namespace is used to distinguish between +# different documentation files in Creator/Assistant. The namespace ends with +# a version being a number containing a major, minor and revision element. +# E.g. version 1.0 becomes 100. +qhp.QtGraphicalEffects.namespace = QtGraphicalEffects.100 + +# Title for the package, will be the main title for the package in +# Assistant/Creator. +qhp.QtGraphicalEffects.indexTitle = Qt Graphical Effects Reference Documentation + +# Extra files to add to the output which are not linked to from anywhere +# using a qdoc \l command. +qhp.QtGraphicalEffects.extraFiles = style/style.css +# index.html + +# Only updtae the name of the project for the next variables. +qhp.QtGraphicalEffects.virtualFolder = qdoc +qhp.QtGraphicalEffects.subprojects = classes +qhp.QtGraphicalEffects.subprojects.classes.title = Classes +qhp.QtGraphicalEffects.subprojects.classes.selectors = class fake:headerfile +qhp.QtGraphicalEffects.subprojects.classes.sortPages = true + + + + +# Do NOT change the variables after this line unless you know what you are doing. + +outputdir = html +outputformats = HTML + +examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml" +examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng" +headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" +sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" + +HTML.nobreadcrumbs = "true" + +HTML.templatedir = . +HTML.stylesheets = style/style.css + +HTML.headerstyles = " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n" +HTML.endheader = "</head>\n" diff --git a/doc/src/images/Blend_bug_and_butterfly.png b/doc/src/images/Blend_bug_and_butterfly.png Binary files differnew file mode 100755 index 0000000..1e3f09f --- /dev/null +++ b/doc/src/images/Blend_bug_and_butterfly.png diff --git a/doc/src/images/Blend_mode1.png b/doc/src/images/Blend_mode1.png Binary files differnew file mode 100644 index 0000000..4ac773d --- /dev/null +++ b/doc/src/images/Blend_mode1.png diff --git a/doc/src/images/Blend_mode2.png b/doc/src/images/Blend_mode2.png Binary files differnew file mode 100644 index 0000000..0cd57eb --- /dev/null +++ b/doc/src/images/Blend_mode2.png diff --git a/doc/src/images/Blend_mode3.png b/doc/src/images/Blend_mode3.png Binary files differnew file mode 100644 index 0000000..11b0b55 --- /dev/null +++ b/doc/src/images/Blend_mode3.png diff --git a/doc/src/images/Blend_mode4.png b/doc/src/images/Blend_mode4.png Binary files differnew file mode 100644 index 0000000..ed1aba9 --- /dev/null +++ b/doc/src/images/Blend_mode4.png diff --git a/doc/src/images/Blend_mode5.png b/doc/src/images/Blend_mode5.png Binary files differnew file mode 100644 index 0000000..282725b --- /dev/null +++ b/doc/src/images/Blend_mode5.png diff --git a/doc/src/images/Blend_mode6.png b/doc/src/images/Blend_mode6.png Binary files differnew file mode 100644 index 0000000..cea329b --- /dev/null +++ b/doc/src/images/Blend_mode6.png diff --git a/doc/src/images/Blend_mode7.png b/doc/src/images/Blend_mode7.png Binary files differnew file mode 100644 index 0000000..25cd7b0 --- /dev/null +++ b/doc/src/images/Blend_mode7.png diff --git a/doc/src/images/Blend_mode8.png b/doc/src/images/Blend_mode8.png Binary files differnew file mode 100644 index 0000000..80cb192 --- /dev/null +++ b/doc/src/images/Blend_mode8.png diff --git a/doc/src/images/Blend_mode9.png b/doc/src/images/Blend_mode9.png Binary files differnew file mode 100644 index 0000000..be97d63 --- /dev/null +++ b/doc/src/images/Blend_mode9.png diff --git a/doc/src/images/BrightnessContrast_brightness1.png b/doc/src/images/BrightnessContrast_brightness1.png Binary files differnew file mode 100644 index 0000000..98a9d25 --- /dev/null +++ b/doc/src/images/BrightnessContrast_brightness1.png diff --git a/doc/src/images/BrightnessContrast_brightness2.png b/doc/src/images/BrightnessContrast_brightness2.png Binary files differnew file mode 100644 index 0000000..8683c0a --- /dev/null +++ b/doc/src/images/BrightnessContrast_brightness2.png diff --git a/doc/src/images/BrightnessContrast_brightness3.png b/doc/src/images/BrightnessContrast_brightness3.png Binary files differnew file mode 100644 index 0000000..8d0cbb9 --- /dev/null +++ b/doc/src/images/BrightnessContrast_brightness3.png diff --git a/doc/src/images/BrightnessContrast_bug.png b/doc/src/images/BrightnessContrast_bug.png Binary files differnew file mode 100755 index 0000000..7881007 --- /dev/null +++ b/doc/src/images/BrightnessContrast_bug.png diff --git a/doc/src/images/BrightnessContrast_contrast1.png b/doc/src/images/BrightnessContrast_contrast1.png Binary files differnew file mode 100644 index 0000000..908cc0f --- /dev/null +++ b/doc/src/images/BrightnessContrast_contrast1.png diff --git a/doc/src/images/BrightnessContrast_contrast2.png b/doc/src/images/BrightnessContrast_contrast2.png Binary files differnew file mode 100644 index 0000000..8683c0a --- /dev/null +++ b/doc/src/images/BrightnessContrast_contrast2.png diff --git a/doc/src/images/BrightnessContrast_contrast3.png b/doc/src/images/BrightnessContrast_contrast3.png Binary files differnew file mode 100644 index 0000000..2fc89dc --- /dev/null +++ b/doc/src/images/BrightnessContrast_contrast3.png diff --git a/doc/src/images/BrightnessContrast_contrast_graph.png b/doc/src/images/BrightnessContrast_contrast_graph.png Binary files differnew file mode 100755 index 0000000..67b3d7b --- /dev/null +++ b/doc/src/images/BrightnessContrast_contrast_graph.png diff --git a/doc/src/images/ColorOverlay_butterfly.png b/doc/src/images/ColorOverlay_butterfly.png Binary files differnew file mode 100755 index 0000000..59e4873 --- /dev/null +++ b/doc/src/images/ColorOverlay_butterfly.png diff --git a/doc/src/images/ColorOverlay_color1.png b/doc/src/images/ColorOverlay_color1.png Binary files differnew file mode 100644 index 0000000..26ce6fe --- /dev/null +++ b/doc/src/images/ColorOverlay_color1.png diff --git a/doc/src/images/ColorOverlay_color2.png b/doc/src/images/ColorOverlay_color2.png Binary files differnew file mode 100644 index 0000000..b7d6006 --- /dev/null +++ b/doc/src/images/ColorOverlay_color2.png diff --git a/doc/src/images/ColorOverlay_color3.png b/doc/src/images/ColorOverlay_color3.png Binary files differnew file mode 100644 index 0000000..929d0f4 --- /dev/null +++ b/doc/src/images/ColorOverlay_color3.png diff --git a/doc/src/images/Colorize_bug.png b/doc/src/images/Colorize_bug.png Binary files differnew file mode 100755 index 0000000..7f2d318 --- /dev/null +++ b/doc/src/images/Colorize_bug.png diff --git a/doc/src/images/Colorize_hue1.png b/doc/src/images/Colorize_hue1.png Binary files differnew file mode 100644 index 0000000..b5cf01d --- /dev/null +++ b/doc/src/images/Colorize_hue1.png diff --git a/doc/src/images/Colorize_hue2.png b/doc/src/images/Colorize_hue2.png Binary files differnew file mode 100644 index 0000000..23c8348 --- /dev/null +++ b/doc/src/images/Colorize_hue2.png diff --git a/doc/src/images/Colorize_hue3.png b/doc/src/images/Colorize_hue3.png Binary files differnew file mode 100644 index 0000000..5b7ec44 --- /dev/null +++ b/doc/src/images/Colorize_hue3.png diff --git a/doc/src/images/Colorize_hue_scale.png b/doc/src/images/Colorize_hue_scale.png Binary files differnew file mode 100755 index 0000000..2eb9bc4 --- /dev/null +++ b/doc/src/images/Colorize_hue_scale.png diff --git a/doc/src/images/Colorize_lightness1.png b/doc/src/images/Colorize_lightness1.png Binary files differnew file mode 100644 index 0000000..b40eb49 --- /dev/null +++ b/doc/src/images/Colorize_lightness1.png diff --git a/doc/src/images/Colorize_lightness2.png b/doc/src/images/Colorize_lightness2.png Binary files differnew file mode 100644 index 0000000..100c718 --- /dev/null +++ b/doc/src/images/Colorize_lightness2.png diff --git a/doc/src/images/Colorize_lightness3.png b/doc/src/images/Colorize_lightness3.png Binary files differnew file mode 100644 index 0000000..2e1e50c --- /dev/null +++ b/doc/src/images/Colorize_lightness3.png diff --git a/doc/src/images/Colorize_saturation1.png b/doc/src/images/Colorize_saturation1.png Binary files differnew file mode 100644 index 0000000..de755e7 --- /dev/null +++ b/doc/src/images/Colorize_saturation1.png diff --git a/doc/src/images/Colorize_saturation2.png b/doc/src/images/Colorize_saturation2.png Binary files differnew file mode 100644 index 0000000..059a5ac --- /dev/null +++ b/doc/src/images/Colorize_saturation2.png diff --git a/doc/src/images/Colorize_saturation3.png b/doc/src/images/Colorize_saturation3.png Binary files differnew file mode 100644 index 0000000..100c718 --- /dev/null +++ b/doc/src/images/Colorize_saturation3.png diff --git a/doc/src/images/ConicalGradient.png b/doc/src/images/ConicalGradient.png Binary files differnew file mode 100755 index 0000000..2c9c97a --- /dev/null +++ b/doc/src/images/ConicalGradient.png diff --git a/doc/src/images/ConicalGradient_angle1.png b/doc/src/images/ConicalGradient_angle1.png Binary files differnew file mode 100644 index 0000000..c29f72a --- /dev/null +++ b/doc/src/images/ConicalGradient_angle1.png diff --git a/doc/src/images/ConicalGradient_angle2.png b/doc/src/images/ConicalGradient_angle2.png Binary files differnew file mode 100644 index 0000000..d77f438 --- /dev/null +++ b/doc/src/images/ConicalGradient_angle2.png diff --git a/doc/src/images/ConicalGradient_angle3.png b/doc/src/images/ConicalGradient_angle3.png Binary files differnew file mode 100644 index 0000000..7c7b165 --- /dev/null +++ b/doc/src/images/ConicalGradient_angle3.png diff --git a/doc/src/images/ConicalGradient_gradient1.png b/doc/src/images/ConicalGradient_gradient1.png Binary files differnew file mode 100644 index 0000000..34676bf --- /dev/null +++ b/doc/src/images/ConicalGradient_gradient1.png diff --git a/doc/src/images/ConicalGradient_gradient2.png b/doc/src/images/ConicalGradient_gradient2.png Binary files differnew file mode 100644 index 0000000..819915f --- /dev/null +++ b/doc/src/images/ConicalGradient_gradient2.png diff --git a/doc/src/images/ConicalGradient_gradient3.png b/doc/src/images/ConicalGradient_gradient3.png Binary files differnew file mode 100644 index 0000000..f53a65d --- /dev/null +++ b/doc/src/images/ConicalGradient_gradient3.png diff --git a/doc/src/images/ConicalGradient_horizontalOffset1.png b/doc/src/images/ConicalGradient_horizontalOffset1.png Binary files differnew file mode 100644 index 0000000..abd767e --- /dev/null +++ b/doc/src/images/ConicalGradient_horizontalOffset1.png diff --git a/doc/src/images/ConicalGradient_horizontalOffset2.png b/doc/src/images/ConicalGradient_horizontalOffset2.png Binary files differnew file mode 100644 index 0000000..c29f72a --- /dev/null +++ b/doc/src/images/ConicalGradient_horizontalOffset2.png diff --git a/doc/src/images/ConicalGradient_horizontalOffset3.png b/doc/src/images/ConicalGradient_horizontalOffset3.png Binary files differnew file mode 100644 index 0000000..9052e45 --- /dev/null +++ b/doc/src/images/ConicalGradient_horizontalOffset3.png diff --git a/doc/src/images/ConicalGradient_maskSource1.png b/doc/src/images/ConicalGradient_maskSource1.png Binary files differnew file mode 100644 index 0000000..c29f72a --- /dev/null +++ b/doc/src/images/ConicalGradient_maskSource1.png diff --git a/doc/src/images/ConicalGradient_maskSource2.png b/doc/src/images/ConicalGradient_maskSource2.png Binary files differnew file mode 100644 index 0000000..4c6e25d --- /dev/null +++ b/doc/src/images/ConicalGradient_maskSource2.png diff --git a/doc/src/images/Desaturate_bug.png b/doc/src/images/Desaturate_bug.png Binary files differnew file mode 100755 index 0000000..1f684df --- /dev/null +++ b/doc/src/images/Desaturate_bug.png diff --git a/doc/src/images/Desaturate_desaturation1.png b/doc/src/images/Desaturate_desaturation1.png Binary files differnew file mode 100644 index 0000000..ac3d2aa --- /dev/null +++ b/doc/src/images/Desaturate_desaturation1.png diff --git a/doc/src/images/Desaturate_desaturation2.png b/doc/src/images/Desaturate_desaturation2.png Binary files differnew file mode 100644 index 0000000..f3d8415 --- /dev/null +++ b/doc/src/images/Desaturate_desaturation2.png diff --git a/doc/src/images/Desaturate_desaturation3.png b/doc/src/images/Desaturate_desaturation3.png Binary files differnew file mode 100644 index 0000000..91f7a6d --- /dev/null +++ b/doc/src/images/Desaturate_desaturation3.png diff --git a/doc/src/images/DirectionalBlur_angle1.png b/doc/src/images/DirectionalBlur_angle1.png Binary files differnew file mode 100644 index 0000000..d47da79 --- /dev/null +++ b/doc/src/images/DirectionalBlur_angle1.png diff --git a/doc/src/images/DirectionalBlur_angle2.png b/doc/src/images/DirectionalBlur_angle2.png Binary files differnew file mode 100644 index 0000000..3865ae8 --- /dev/null +++ b/doc/src/images/DirectionalBlur_angle2.png diff --git a/doc/src/images/DirectionalBlur_angle3.png b/doc/src/images/DirectionalBlur_angle3.png Binary files differnew file mode 100644 index 0000000..df89ce2 --- /dev/null +++ b/doc/src/images/DirectionalBlur_angle3.png diff --git a/doc/src/images/DirectionalBlur_butterfly.png b/doc/src/images/DirectionalBlur_butterfly.png Binary files differnew file mode 100755 index 0000000..8b6adff --- /dev/null +++ b/doc/src/images/DirectionalBlur_butterfly.png diff --git a/doc/src/images/DirectionalBlur_length1.png b/doc/src/images/DirectionalBlur_length1.png Binary files differnew file mode 100644 index 0000000..ac3d2aa --- /dev/null +++ b/doc/src/images/DirectionalBlur_length1.png diff --git a/doc/src/images/DirectionalBlur_length2.png b/doc/src/images/DirectionalBlur_length2.png Binary files differnew file mode 100644 index 0000000..d47da79 --- /dev/null +++ b/doc/src/images/DirectionalBlur_length2.png diff --git a/doc/src/images/DirectionalBlur_length3.png b/doc/src/images/DirectionalBlur_length3.png Binary files differnew file mode 100644 index 0000000..43f84b8 --- /dev/null +++ b/doc/src/images/DirectionalBlur_length3.png diff --git a/doc/src/images/Displace_bug.png b/doc/src/images/Displace_bug.png Binary files differnew file mode 100755 index 0000000..23611e0 --- /dev/null +++ b/doc/src/images/Displace_bug.png diff --git a/doc/src/images/Displace_displacement1.png b/doc/src/images/Displace_displacement1.png Binary files differnew file mode 100644 index 0000000..f11c08e --- /dev/null +++ b/doc/src/images/Displace_displacement1.png diff --git a/doc/src/images/Displace_displacement2.png b/doc/src/images/Displace_displacement2.png Binary files differnew file mode 100644 index 0000000..bba8754 --- /dev/null +++ b/doc/src/images/Displace_displacement2.png diff --git a/doc/src/images/Displace_displacement3.png b/doc/src/images/Displace_displacement3.png Binary files differnew file mode 100644 index 0000000..5931388 --- /dev/null +++ b/doc/src/images/Displace_displacement3.png diff --git a/doc/src/images/Displace_map.png b/doc/src/images/Displace_map.png Binary files differnew file mode 100755 index 0000000..d9eeb6c --- /dev/null +++ b/doc/src/images/Displace_map.png diff --git a/doc/src/images/DropShadow_butterfly.png b/doc/src/images/DropShadow_butterfly.png Binary files differnew file mode 100755 index 0000000..67f18d1 --- /dev/null +++ b/doc/src/images/DropShadow_butterfly.png diff --git a/doc/src/images/DropShadow_color1.png b/doc/src/images/DropShadow_color1.png Binary files differnew file mode 100644 index 0000000..a5945d4 --- /dev/null +++ b/doc/src/images/DropShadow_color1.png diff --git a/doc/src/images/DropShadow_color2.png b/doc/src/images/DropShadow_color2.png Binary files differnew file mode 100644 index 0000000..6e5a16e --- /dev/null +++ b/doc/src/images/DropShadow_color2.png diff --git a/doc/src/images/DropShadow_color3.png b/doc/src/images/DropShadow_color3.png Binary files differnew file mode 100644 index 0000000..042ada6 --- /dev/null +++ b/doc/src/images/DropShadow_color3.png diff --git a/doc/src/images/DropShadow_horizontalOffset1.png b/doc/src/images/DropShadow_horizontalOffset1.png Binary files differnew file mode 100644 index 0000000..901780d --- /dev/null +++ b/doc/src/images/DropShadow_horizontalOffset1.png diff --git a/doc/src/images/DropShadow_horizontalOffset2.png b/doc/src/images/DropShadow_horizontalOffset2.png Binary files differnew file mode 100644 index 0000000..87ebf93 --- /dev/null +++ b/doc/src/images/DropShadow_horizontalOffset2.png diff --git a/doc/src/images/DropShadow_horizontalOffset3.png b/doc/src/images/DropShadow_horizontalOffset3.png Binary files differnew file mode 100644 index 0000000..1f56467 --- /dev/null +++ b/doc/src/images/DropShadow_horizontalOffset3.png diff --git a/doc/src/images/DropShadow_radius1.png b/doc/src/images/DropShadow_radius1.png Binary files differnew file mode 100644 index 0000000..2dd234b --- /dev/null +++ b/doc/src/images/DropShadow_radius1.png diff --git a/doc/src/images/DropShadow_radius2.png b/doc/src/images/DropShadow_radius2.png Binary files differnew file mode 100644 index 0000000..50fdd15 --- /dev/null +++ b/doc/src/images/DropShadow_radius2.png diff --git a/doc/src/images/DropShadow_radius3.png b/doc/src/images/DropShadow_radius3.png Binary files differnew file mode 100644 index 0000000..e7daa02 --- /dev/null +++ b/doc/src/images/DropShadow_radius3.png diff --git a/doc/src/images/DropShadow_spread1.png b/doc/src/images/DropShadow_spread1.png Binary files differnew file mode 100644 index 0000000..fa9ca85 --- /dev/null +++ b/doc/src/images/DropShadow_spread1.png diff --git a/doc/src/images/DropShadow_spread2.png b/doc/src/images/DropShadow_spread2.png Binary files differnew file mode 100644 index 0000000..0a9024f --- /dev/null +++ b/doc/src/images/DropShadow_spread2.png diff --git a/doc/src/images/DropShadow_spread3.png b/doc/src/images/DropShadow_spread3.png Binary files differnew file mode 100644 index 0000000..4f50544 --- /dev/null +++ b/doc/src/images/DropShadow_spread3.png diff --git a/doc/src/images/FastBlur_blur1.png b/doc/src/images/FastBlur_blur1.png Binary files differnew file mode 100644 index 0000000..43816e9 --- /dev/null +++ b/doc/src/images/FastBlur_blur1.png diff --git a/doc/src/images/FastBlur_blur2.png b/doc/src/images/FastBlur_blur2.png Binary files differnew file mode 100644 index 0000000..239bee7 --- /dev/null +++ b/doc/src/images/FastBlur_blur2.png diff --git a/doc/src/images/FastBlur_blur3.png b/doc/src/images/FastBlur_blur3.png Binary files differnew file mode 100644 index 0000000..6c66780 --- /dev/null +++ b/doc/src/images/FastBlur_blur3.png diff --git a/doc/src/images/FastBlur_bug.png b/doc/src/images/FastBlur_bug.png Binary files differnew file mode 100755 index 0000000..05d5e8d --- /dev/null +++ b/doc/src/images/FastBlur_bug.png diff --git a/doc/src/images/FastBlur_transparentBorder1.png b/doc/src/images/FastBlur_transparentBorder1.png Binary files differnew file mode 100644 index 0000000..6c66780 --- /dev/null +++ b/doc/src/images/FastBlur_transparentBorder1.png diff --git a/doc/src/images/FastBlur_transparentBorder2.png b/doc/src/images/FastBlur_transparentBorder2.png Binary files differnew file mode 100644 index 0000000..9f0d293 --- /dev/null +++ b/doc/src/images/FastBlur_transparentBorder2.png diff --git a/doc/src/images/FastDropShadow_blur1.png b/doc/src/images/FastDropShadow_blur1.png Binary files differnew file mode 100644 index 0000000..f3a8a0f --- /dev/null +++ b/doc/src/images/FastDropShadow_blur1.png diff --git a/doc/src/images/FastDropShadow_blur2.png b/doc/src/images/FastDropShadow_blur2.png Binary files differnew file mode 100644 index 0000000..7b42977 --- /dev/null +++ b/doc/src/images/FastDropShadow_blur2.png diff --git a/doc/src/images/FastDropShadow_blur3.png b/doc/src/images/FastDropShadow_blur3.png Binary files differnew file mode 100644 index 0000000..3dd7284 --- /dev/null +++ b/doc/src/images/FastDropShadow_blur3.png diff --git a/doc/src/images/FastDropShadow_butterfly.png b/doc/src/images/FastDropShadow_butterfly.png Binary files differnew file mode 100755 index 0000000..1c6fec2 --- /dev/null +++ b/doc/src/images/FastDropShadow_butterfly.png diff --git a/doc/src/images/FastDropShadow_color1.png b/doc/src/images/FastDropShadow_color1.png Binary files differnew file mode 100644 index 0000000..134ace8 --- /dev/null +++ b/doc/src/images/FastDropShadow_color1.png diff --git a/doc/src/images/FastDropShadow_color2.png b/doc/src/images/FastDropShadow_color2.png Binary files differnew file mode 100644 index 0000000..5bd6dd5 --- /dev/null +++ b/doc/src/images/FastDropShadow_color2.png diff --git a/doc/src/images/FastDropShadow_color3.png b/doc/src/images/FastDropShadow_color3.png Binary files differnew file mode 100644 index 0000000..2ef2d25 --- /dev/null +++ b/doc/src/images/FastDropShadow_color3.png diff --git a/doc/src/images/FastDropShadow_horizontalOffset1.png b/doc/src/images/FastDropShadow_horizontalOffset1.png Binary files differnew file mode 100644 index 0000000..85228a7 --- /dev/null +++ b/doc/src/images/FastDropShadow_horizontalOffset1.png diff --git a/doc/src/images/FastDropShadow_horizontalOffset2.png b/doc/src/images/FastDropShadow_horizontalOffset2.png Binary files differnew file mode 100644 index 0000000..4186134 --- /dev/null +++ b/doc/src/images/FastDropShadow_horizontalOffset2.png diff --git a/doc/src/images/FastDropShadow_horizontalOffset3.png b/doc/src/images/FastDropShadow_horizontalOffset3.png Binary files differnew file mode 100644 index 0000000..378b655 --- /dev/null +++ b/doc/src/images/FastDropShadow_horizontalOffset3.png diff --git a/doc/src/images/FastDropShadow_spread1.png b/doc/src/images/FastDropShadow_spread1.png Binary files differnew file mode 100644 index 0000000..7b42977 --- /dev/null +++ b/doc/src/images/FastDropShadow_spread1.png diff --git a/doc/src/images/FastDropShadow_spread2.png b/doc/src/images/FastDropShadow_spread2.png Binary files differnew file mode 100644 index 0000000..9193561 --- /dev/null +++ b/doc/src/images/FastDropShadow_spread2.png diff --git a/doc/src/images/FastDropShadow_spread3.png b/doc/src/images/FastDropShadow_spread3.png Binary files differnew file mode 100644 index 0000000..b284c81 --- /dev/null +++ b/doc/src/images/FastDropShadow_spread3.png diff --git a/doc/src/images/FastGlow_blur1.png b/doc/src/images/FastGlow_blur1.png Binary files differnew file mode 100644 index 0000000..dc85cb9 --- /dev/null +++ b/doc/src/images/FastGlow_blur1.png diff --git a/doc/src/images/FastGlow_blur2.png b/doc/src/images/FastGlow_blur2.png Binary files differnew file mode 100644 index 0000000..1267373 --- /dev/null +++ b/doc/src/images/FastGlow_blur2.png diff --git a/doc/src/images/FastGlow_blur3.png b/doc/src/images/FastGlow_blur3.png Binary files differnew file mode 100644 index 0000000..5bff5c2 --- /dev/null +++ b/doc/src/images/FastGlow_blur3.png diff --git a/doc/src/images/FastGlow_butterfly.png b/doc/src/images/FastGlow_butterfly.png Binary files differnew file mode 100644 index 0000000..1267373 --- /dev/null +++ b/doc/src/images/FastGlow_butterfly.png diff --git a/doc/src/images/FastGlow_color1.png b/doc/src/images/FastGlow_color1.png Binary files differnew file mode 100644 index 0000000..2ec7fb2 --- /dev/null +++ b/doc/src/images/FastGlow_color1.png diff --git a/doc/src/images/FastGlow_color2.png b/doc/src/images/FastGlow_color2.png Binary files differnew file mode 100644 index 0000000..354a5c7 --- /dev/null +++ b/doc/src/images/FastGlow_color2.png diff --git a/doc/src/images/FastGlow_color3.png b/doc/src/images/FastGlow_color3.png Binary files differnew file mode 100644 index 0000000..638e000 --- /dev/null +++ b/doc/src/images/FastGlow_color3.png diff --git a/doc/src/images/FastGlow_spread1.png b/doc/src/images/FastGlow_spread1.png Binary files differnew file mode 100644 index 0000000..1267373 --- /dev/null +++ b/doc/src/images/FastGlow_spread1.png diff --git a/doc/src/images/FastGlow_spread2.png b/doc/src/images/FastGlow_spread2.png Binary files differnew file mode 100644 index 0000000..3043121 --- /dev/null +++ b/doc/src/images/FastGlow_spread2.png diff --git a/doc/src/images/FastGlow_spread3.png b/doc/src/images/FastGlow_spread3.png Binary files differnew file mode 100644 index 0000000..1b69a15 --- /dev/null +++ b/doc/src/images/FastGlow_spread3.png diff --git a/doc/src/images/GammaAdjust_bug.png b/doc/src/images/GammaAdjust_bug.png Binary files differnew file mode 100755 index 0000000..f496e1f --- /dev/null +++ b/doc/src/images/GammaAdjust_bug.png diff --git a/doc/src/images/GammaAdjust_gamma1.png b/doc/src/images/GammaAdjust_gamma1.png Binary files differnew file mode 100644 index 0000000..7e76d49 --- /dev/null +++ b/doc/src/images/GammaAdjust_gamma1.png diff --git a/doc/src/images/GammaAdjust_gamma1_graph.png b/doc/src/images/GammaAdjust_gamma1_graph.png Binary files differnew file mode 100755 index 0000000..abc940f --- /dev/null +++ b/doc/src/images/GammaAdjust_gamma1_graph.png diff --git a/doc/src/images/GammaAdjust_gamma2.png b/doc/src/images/GammaAdjust_gamma2.png Binary files differnew file mode 100644 index 0000000..8683c0a --- /dev/null +++ b/doc/src/images/GammaAdjust_gamma2.png diff --git a/doc/src/images/GammaAdjust_gamma2_graph.png b/doc/src/images/GammaAdjust_gamma2_graph.png Binary files differnew file mode 100755 index 0000000..9b9c859 --- /dev/null +++ b/doc/src/images/GammaAdjust_gamma2_graph.png diff --git a/doc/src/images/GammaAdjust_gamma3.png b/doc/src/images/GammaAdjust_gamma3.png Binary files differnew file mode 100644 index 0000000..501049c --- /dev/null +++ b/doc/src/images/GammaAdjust_gamma3.png diff --git a/doc/src/images/GammaAdjust_gamma3_graph.png b/doc/src/images/GammaAdjust_gamma3_graph.png Binary files differnew file mode 100755 index 0000000..239d582 --- /dev/null +++ b/doc/src/images/GammaAdjust_gamma3_graph.png diff --git a/doc/src/images/GaussianBlur_bug.png b/doc/src/images/GaussianBlur_bug.png Binary files differnew file mode 100755 index 0000000..262ef0e --- /dev/null +++ b/doc/src/images/GaussianBlur_bug.png diff --git a/doc/src/images/GaussianBlur_deviation1.png b/doc/src/images/GaussianBlur_deviation1.png Binary files differnew file mode 100644 index 0000000..5dcb775 --- /dev/null +++ b/doc/src/images/GaussianBlur_deviation1.png diff --git a/doc/src/images/GaussianBlur_deviation2.png b/doc/src/images/GaussianBlur_deviation2.png Binary files differnew file mode 100644 index 0000000..68ff492 --- /dev/null +++ b/doc/src/images/GaussianBlur_deviation2.png diff --git a/doc/src/images/GaussianBlur_deviation3.png b/doc/src/images/GaussianBlur_deviation3.png Binary files differnew file mode 100644 index 0000000..4823e31 --- /dev/null +++ b/doc/src/images/GaussianBlur_deviation3.png diff --git a/doc/src/images/GaussianBlur_deviation4.png b/doc/src/images/GaussianBlur_deviation4.png Binary files differnew file mode 100755 index 0000000..ba82f8f --- /dev/null +++ b/doc/src/images/GaussianBlur_deviation4.png diff --git a/doc/src/images/GaussianBlur_deviation_graph.png b/doc/src/images/GaussianBlur_deviation_graph.png Binary files differnew file mode 100755 index 0000000..d4a09a5 --- /dev/null +++ b/doc/src/images/GaussianBlur_deviation_graph.png diff --git a/doc/src/images/GaussianBlur_radius1.png b/doc/src/images/GaussianBlur_radius1.png Binary files differnew file mode 100644 index 0000000..ce02060 --- /dev/null +++ b/doc/src/images/GaussianBlur_radius1.png diff --git a/doc/src/images/GaussianBlur_radius2.png b/doc/src/images/GaussianBlur_radius2.png Binary files differnew file mode 100644 index 0000000..3ddd227 --- /dev/null +++ b/doc/src/images/GaussianBlur_radius2.png diff --git a/doc/src/images/GaussianBlur_radius3.png b/doc/src/images/GaussianBlur_radius3.png Binary files differnew file mode 100644 index 0000000..df8f675 --- /dev/null +++ b/doc/src/images/GaussianBlur_radius3.png diff --git a/doc/src/images/GaussianBlur_transparentBorder1.png b/doc/src/images/GaussianBlur_transparentBorder1.png Binary files differnew file mode 100644 index 0000000..7365ccd --- /dev/null +++ b/doc/src/images/GaussianBlur_transparentBorder1.png diff --git a/doc/src/images/GaussianBlur_transparentBorder2.png b/doc/src/images/GaussianBlur_transparentBorder2.png Binary files differnew file mode 100644 index 0000000..e33661c --- /dev/null +++ b/doc/src/images/GaussianBlur_transparentBorder2.png diff --git a/doc/src/images/Glow_butterfly.png b/doc/src/images/Glow_butterfly.png Binary files differnew file mode 100755 index 0000000..f6eb9e3 --- /dev/null +++ b/doc/src/images/Glow_butterfly.png diff --git a/doc/src/images/Glow_color1.png b/doc/src/images/Glow_color1.png Binary files differnew file mode 100644 index 0000000..1a7ec7e --- /dev/null +++ b/doc/src/images/Glow_color1.png diff --git a/doc/src/images/Glow_color2.png b/doc/src/images/Glow_color2.png Binary files differnew file mode 100644 index 0000000..d080e4e --- /dev/null +++ b/doc/src/images/Glow_color2.png diff --git a/doc/src/images/Glow_color3.png b/doc/src/images/Glow_color3.png Binary files differnew file mode 100644 index 0000000..4f938b9 --- /dev/null +++ b/doc/src/images/Glow_color3.png diff --git a/doc/src/images/Glow_radius1.png b/doc/src/images/Glow_radius1.png Binary files differnew file mode 100644 index 0000000..884e591 --- /dev/null +++ b/doc/src/images/Glow_radius1.png diff --git a/doc/src/images/Glow_radius2.png b/doc/src/images/Glow_radius2.png Binary files differnew file mode 100644 index 0000000..cf641fa --- /dev/null +++ b/doc/src/images/Glow_radius2.png diff --git a/doc/src/images/Glow_radius3.png b/doc/src/images/Glow_radius3.png Binary files differnew file mode 100644 index 0000000..c8c59d0 --- /dev/null +++ b/doc/src/images/Glow_radius3.png diff --git a/doc/src/images/Glow_spread1.png b/doc/src/images/Glow_spread1.png Binary files differnew file mode 100644 index 0000000..6751da5 --- /dev/null +++ b/doc/src/images/Glow_spread1.png diff --git a/doc/src/images/Glow_spread2.png b/doc/src/images/Glow_spread2.png Binary files differnew file mode 100644 index 0000000..1a7ec7e --- /dev/null +++ b/doc/src/images/Glow_spread2.png diff --git a/doc/src/images/Glow_spread3.png b/doc/src/images/Glow_spread3.png Binary files differnew file mode 100644 index 0000000..2ac79e7 --- /dev/null +++ b/doc/src/images/Glow_spread3.png diff --git a/doc/src/images/HueSaturation_bug.png b/doc/src/images/HueSaturation_bug.png Binary files differnew file mode 100755 index 0000000..bbdcdc5 --- /dev/null +++ b/doc/src/images/HueSaturation_bug.png diff --git a/doc/src/images/HueSaturation_hue1.png b/doc/src/images/HueSaturation_hue1.png Binary files differnew file mode 100644 index 0000000..a48fbf2 --- /dev/null +++ b/doc/src/images/HueSaturation_hue1.png diff --git a/doc/src/images/HueSaturation_hue2.png b/doc/src/images/HueSaturation_hue2.png Binary files differnew file mode 100644 index 0000000..cbb2883 --- /dev/null +++ b/doc/src/images/HueSaturation_hue2.png diff --git a/doc/src/images/HueSaturation_hue3.png b/doc/src/images/HueSaturation_hue3.png Binary files differnew file mode 100644 index 0000000..01ce35c --- /dev/null +++ b/doc/src/images/HueSaturation_hue3.png diff --git a/doc/src/images/HueSaturation_lightness1.png b/doc/src/images/HueSaturation_lightness1.png Binary files differnew file mode 100644 index 0000000..64cd230 --- /dev/null +++ b/doc/src/images/HueSaturation_lightness1.png diff --git a/doc/src/images/HueSaturation_lightness2.png b/doc/src/images/HueSaturation_lightness2.png Binary files differnew file mode 100644 index 0000000..cbb2883 --- /dev/null +++ b/doc/src/images/HueSaturation_lightness2.png diff --git a/doc/src/images/HueSaturation_lightness3.png b/doc/src/images/HueSaturation_lightness3.png Binary files differnew file mode 100644 index 0000000..037f20f --- /dev/null +++ b/doc/src/images/HueSaturation_lightness3.png diff --git a/doc/src/images/HueSaturation_saturation1.png b/doc/src/images/HueSaturation_saturation1.png Binary files differnew file mode 100644 index 0000000..0ba3ff6 --- /dev/null +++ b/doc/src/images/HueSaturation_saturation1.png diff --git a/doc/src/images/HueSaturation_saturation2.png b/doc/src/images/HueSaturation_saturation2.png Binary files differnew file mode 100644 index 0000000..cbb2883 --- /dev/null +++ b/doc/src/images/HueSaturation_saturation2.png diff --git a/doc/src/images/HueSaturation_saturation3.png b/doc/src/images/HueSaturation_saturation3.png Binary files differnew file mode 100644 index 0000000..f2fb8ed --- /dev/null +++ b/doc/src/images/HueSaturation_saturation3.png diff --git a/doc/src/images/LinearGradient.png b/doc/src/images/LinearGradient.png Binary files differnew file mode 100755 index 0000000..7491f6e --- /dev/null +++ b/doc/src/images/LinearGradient.png diff --git a/doc/src/images/LinearGradient_end1.png b/doc/src/images/LinearGradient_end1.png Binary files differnew file mode 100644 index 0000000..0967b0f --- /dev/null +++ b/doc/src/images/LinearGradient_end1.png diff --git a/doc/src/images/LinearGradient_end2.png b/doc/src/images/LinearGradient_end2.png Binary files differnew file mode 100644 index 0000000..d0cde06 --- /dev/null +++ b/doc/src/images/LinearGradient_end2.png diff --git a/doc/src/images/LinearGradient_end3.png b/doc/src/images/LinearGradient_end3.png Binary files differnew file mode 100644 index 0000000..49e5be2 --- /dev/null +++ b/doc/src/images/LinearGradient_end3.png diff --git a/doc/src/images/LinearGradient_gradient1.png b/doc/src/images/LinearGradient_gradient1.png Binary files differnew file mode 100644 index 0000000..5788562 --- /dev/null +++ b/doc/src/images/LinearGradient_gradient1.png diff --git a/doc/src/images/LinearGradient_gradient2.png b/doc/src/images/LinearGradient_gradient2.png Binary files differnew file mode 100644 index 0000000..21c2809 --- /dev/null +++ b/doc/src/images/LinearGradient_gradient2.png diff --git a/doc/src/images/LinearGradient_gradient3.png b/doc/src/images/LinearGradient_gradient3.png Binary files differnew file mode 100644 index 0000000..3950a09 --- /dev/null +++ b/doc/src/images/LinearGradient_gradient3.png diff --git a/doc/src/images/LinearGradient_maskSource1.png b/doc/src/images/LinearGradient_maskSource1.png Binary files differnew file mode 100644 index 0000000..0967b0f --- /dev/null +++ b/doc/src/images/LinearGradient_maskSource1.png diff --git a/doc/src/images/LinearGradient_maskSource2.png b/doc/src/images/LinearGradient_maskSource2.png Binary files differnew file mode 100644 index 0000000..5f0fcdd --- /dev/null +++ b/doc/src/images/LinearGradient_maskSource2.png diff --git a/doc/src/images/LinearGradient_start1.png b/doc/src/images/LinearGradient_start1.png Binary files differnew file mode 100644 index 0000000..0967b0f --- /dev/null +++ b/doc/src/images/LinearGradient_start1.png diff --git a/doc/src/images/LinearGradient_start2.png b/doc/src/images/LinearGradient_start2.png Binary files differnew file mode 100644 index 0000000..b895154 --- /dev/null +++ b/doc/src/images/LinearGradient_start2.png diff --git a/doc/src/images/LinearGradient_start3.png b/doc/src/images/LinearGradient_start3.png Binary files differnew file mode 100644 index 0000000..ddf06b6 --- /dev/null +++ b/doc/src/images/LinearGradient_start3.png diff --git a/doc/src/images/OpacityMask_bug.png b/doc/src/images/OpacityMask_bug.png Binary files differnew file mode 100644 index 0000000..72a0830 --- /dev/null +++ b/doc/src/images/OpacityMask_bug.png diff --git a/doc/src/images/OpacityMask_mask.png b/doc/src/images/OpacityMask_mask.png Binary files differnew file mode 100644 index 0000000..b8ff7b5 --- /dev/null +++ b/doc/src/images/OpacityMask_mask.png diff --git a/doc/src/images/Original_bug.png b/doc/src/images/Original_bug.png Binary files differnew file mode 100755 index 0000000..9445834 --- /dev/null +++ b/doc/src/images/Original_bug.png diff --git a/doc/src/images/Original_butterfly.png b/doc/src/images/Original_butterfly.png Binary files differnew file mode 100755 index 0000000..ca6a3cf --- /dev/null +++ b/doc/src/images/Original_butterfly.png diff --git a/doc/src/images/Original_butterfly_black.png b/doc/src/images/Original_butterfly_black.png Binary files differnew file mode 100755 index 0000000..e8247b4 --- /dev/null +++ b/doc/src/images/Original_butterfly_black.png diff --git a/doc/src/images/RadialBlur_angle1.png b/doc/src/images/RadialBlur_angle1.png Binary files differnew file mode 100644 index 0000000..ac3d2aa --- /dev/null +++ b/doc/src/images/RadialBlur_angle1.png diff --git a/doc/src/images/RadialBlur_angle2.png b/doc/src/images/RadialBlur_angle2.png Binary files differnew file mode 100644 index 0000000..e340f90 --- /dev/null +++ b/doc/src/images/RadialBlur_angle2.png diff --git a/doc/src/images/RadialBlur_angle3.png b/doc/src/images/RadialBlur_angle3.png Binary files differnew file mode 100644 index 0000000..aedba92 --- /dev/null +++ b/doc/src/images/RadialBlur_angle3.png diff --git a/doc/src/images/RadialBlur_butterfly.png b/doc/src/images/RadialBlur_butterfly.png Binary files differnew file mode 100755 index 0000000..46374a4 --- /dev/null +++ b/doc/src/images/RadialBlur_butterfly.png diff --git a/doc/src/images/RadialBlur_horizontalOffset1.png b/doc/src/images/RadialBlur_horizontalOffset1.png Binary files differnew file mode 100644 index 0000000..41df082 --- /dev/null +++ b/doc/src/images/RadialBlur_horizontalOffset1.png diff --git a/doc/src/images/RadialBlur_horizontalOffset2.png b/doc/src/images/RadialBlur_horizontalOffset2.png Binary files differnew file mode 100644 index 0000000..880f68c --- /dev/null +++ b/doc/src/images/RadialBlur_horizontalOffset2.png diff --git a/doc/src/images/RadialBlur_horizontalOffset3.png b/doc/src/images/RadialBlur_horizontalOffset3.png Binary files differnew file mode 100644 index 0000000..054a535 --- /dev/null +++ b/doc/src/images/RadialBlur_horizontalOffset3.png diff --git a/doc/src/images/RadialGradient.png b/doc/src/images/RadialGradient.png Binary files differnew file mode 100755 index 0000000..c9497e6 --- /dev/null +++ b/doc/src/images/RadialGradient.png diff --git a/doc/src/images/RadialGradient_angle1.png b/doc/src/images/RadialGradient_angle1.png Binary files differnew file mode 100644 index 0000000..f7b1847 --- /dev/null +++ b/doc/src/images/RadialGradient_angle1.png diff --git a/doc/src/images/RadialGradient_angle2.png b/doc/src/images/RadialGradient_angle2.png Binary files differnew file mode 100644 index 0000000..b39243b --- /dev/null +++ b/doc/src/images/RadialGradient_angle2.png diff --git a/doc/src/images/RadialGradient_angle3.png b/doc/src/images/RadialGradient_angle3.png Binary files differnew file mode 100644 index 0000000..fba3fdb --- /dev/null +++ b/doc/src/images/RadialGradient_angle3.png diff --git a/doc/src/images/RadialGradient_default.png b/doc/src/images/RadialGradient_default.png Binary files differnew file mode 100644 index 0000000..58de74d --- /dev/null +++ b/doc/src/images/RadialGradient_default.png diff --git a/doc/src/images/RadialGradient_gradient1.png b/doc/src/images/RadialGradient_gradient1.png Binary files differnew file mode 100644 index 0000000..947ac33 --- /dev/null +++ b/doc/src/images/RadialGradient_gradient1.png diff --git a/doc/src/images/RadialGradient_gradient2.png b/doc/src/images/RadialGradient_gradient2.png Binary files differnew file mode 100644 index 0000000..90b2ce5 --- /dev/null +++ b/doc/src/images/RadialGradient_gradient2.png diff --git a/doc/src/images/RadialGradient_gradient3.png b/doc/src/images/RadialGradient_gradient3.png Binary files differnew file mode 100644 index 0000000..9f97c8e --- /dev/null +++ b/doc/src/images/RadialGradient_gradient3.png diff --git a/doc/src/images/RadialGradient_horizontalOffset1.png b/doc/src/images/RadialGradient_horizontalOffset1.png Binary files differnew file mode 100644 index 0000000..0bf231a --- /dev/null +++ b/doc/src/images/RadialGradient_horizontalOffset1.png diff --git a/doc/src/images/RadialGradient_horizontalOffset2.png b/doc/src/images/RadialGradient_horizontalOffset2.png Binary files differnew file mode 100644 index 0000000..983855f --- /dev/null +++ b/doc/src/images/RadialGradient_horizontalOffset2.png diff --git a/doc/src/images/RadialGradient_horizontalOffset3.png b/doc/src/images/RadialGradient_horizontalOffset3.png Binary files differnew file mode 100644 index 0000000..6cb008b --- /dev/null +++ b/doc/src/images/RadialGradient_horizontalOffset3.png diff --git a/doc/src/images/RadialGradient_horizontalRadius1.png b/doc/src/images/RadialGradient_horizontalRadius1.png Binary files differnew file mode 100644 index 0000000..983855f --- /dev/null +++ b/doc/src/images/RadialGradient_horizontalRadius1.png diff --git a/doc/src/images/RadialGradient_horizontalRadius2.png b/doc/src/images/RadialGradient_horizontalRadius2.png Binary files differnew file mode 100644 index 0000000..f7b1847 --- /dev/null +++ b/doc/src/images/RadialGradient_horizontalRadius2.png diff --git a/doc/src/images/RadialGradient_horizontalRadius3.png b/doc/src/images/RadialGradient_horizontalRadius3.png Binary files differnew file mode 100644 index 0000000..2f8c8f9 --- /dev/null +++ b/doc/src/images/RadialGradient_horizontalRadius3.png diff --git a/doc/src/images/RadialGradient_maskSource1.png b/doc/src/images/RadialGradient_maskSource1.png Binary files differnew file mode 100644 index 0000000..983855f --- /dev/null +++ b/doc/src/images/RadialGradient_maskSource1.png diff --git a/doc/src/images/RadialGradient_maskSource2.png b/doc/src/images/RadialGradient_maskSource2.png Binary files differnew file mode 100644 index 0000000..7748131 --- /dev/null +++ b/doc/src/images/RadialGradient_maskSource2.png diff --git a/doc/src/images/RadialGradient_withmask.png b/doc/src/images/RadialGradient_withmask.png Binary files differnew file mode 100644 index 0000000..b78f26a --- /dev/null +++ b/doc/src/images/RadialGradient_withmask.png diff --git a/doc/src/images/RectangularGlow_applied.png b/doc/src/images/RectangularGlow_applied.png Binary files differnew file mode 100755 index 0000000..19cc7b7 --- /dev/null +++ b/doc/src/images/RectangularGlow_applied.png diff --git a/doc/src/images/RectangularGlow_color1.png b/doc/src/images/RectangularGlow_color1.png Binary files differnew file mode 100644 index 0000000..5fd9857 --- /dev/null +++ b/doc/src/images/RectangularGlow_color1.png diff --git a/doc/src/images/RectangularGlow_color2.png b/doc/src/images/RectangularGlow_color2.png Binary files differnew file mode 100644 index 0000000..e69d5c7 --- /dev/null +++ b/doc/src/images/RectangularGlow_color2.png diff --git a/doc/src/images/RectangularGlow_color3.png b/doc/src/images/RectangularGlow_color3.png Binary files differnew file mode 100644 index 0000000..f5c7fe3 --- /dev/null +++ b/doc/src/images/RectangularGlow_color3.png diff --git a/doc/src/images/RectangularGlow_cornerRadius1.png b/doc/src/images/RectangularGlow_cornerRadius1.png Binary files differnew file mode 100644 index 0000000..9a0a04b --- /dev/null +++ b/doc/src/images/RectangularGlow_cornerRadius1.png diff --git a/doc/src/images/RectangularGlow_cornerRadius2.png b/doc/src/images/RectangularGlow_cornerRadius2.png Binary files differnew file mode 100644 index 0000000..5fd9857 --- /dev/null +++ b/doc/src/images/RectangularGlow_cornerRadius2.png diff --git a/doc/src/images/RectangularGlow_cornerRadius3.png b/doc/src/images/RectangularGlow_cornerRadius3.png Binary files differnew file mode 100644 index 0000000..f12f573 --- /dev/null +++ b/doc/src/images/RectangularGlow_cornerRadius3.png diff --git a/doc/src/images/RectangularGlow_glowRadius1.png b/doc/src/images/RectangularGlow_glowRadius1.png Binary files differnew file mode 100644 index 0000000..e0347a2 --- /dev/null +++ b/doc/src/images/RectangularGlow_glowRadius1.png diff --git a/doc/src/images/RectangularGlow_glowRadius2.png b/doc/src/images/RectangularGlow_glowRadius2.png Binary files differnew file mode 100644 index 0000000..5fd9857 --- /dev/null +++ b/doc/src/images/RectangularGlow_glowRadius2.png diff --git a/doc/src/images/RectangularGlow_glowRadius3.png b/doc/src/images/RectangularGlow_glowRadius3.png Binary files differnew file mode 100644 index 0000000..d354e12 --- /dev/null +++ b/doc/src/images/RectangularGlow_glowRadius3.png diff --git a/doc/src/images/RectangularGlow_original.png b/doc/src/images/RectangularGlow_original.png Binary files differnew file mode 100755 index 0000000..6d07b53 --- /dev/null +++ b/doc/src/images/RectangularGlow_original.png diff --git a/doc/src/images/RectangularGlow_spread1.png b/doc/src/images/RectangularGlow_spread1.png Binary files differnew file mode 100644 index 0000000..5fd9857 --- /dev/null +++ b/doc/src/images/RectangularGlow_spread1.png diff --git a/doc/src/images/RectangularGlow_spread2.png b/doc/src/images/RectangularGlow_spread2.png Binary files differnew file mode 100644 index 0000000..bbc1d81 --- /dev/null +++ b/doc/src/images/RectangularGlow_spread2.png diff --git a/doc/src/images/RectangularGlow_spread3.png b/doc/src/images/RectangularGlow_spread3.png Binary files differnew file mode 100644 index 0000000..48a3ce4 --- /dev/null +++ b/doc/src/images/RectangularGlow_spread3.png diff --git a/doc/src/images/RecursiveBlur_bug.png b/doc/src/images/RecursiveBlur_bug.png Binary files differnew file mode 100755 index 0000000..6caf48e --- /dev/null +++ b/doc/src/images/RecursiveBlur_bug.png diff --git a/doc/src/images/RecursiveBlur_loops1.png b/doc/src/images/RecursiveBlur_loops1.png Binary files differnew file mode 100644 index 0000000..b9ea62e --- /dev/null +++ b/doc/src/images/RecursiveBlur_loops1.png diff --git a/doc/src/images/RecursiveBlur_loops2.png b/doc/src/images/RecursiveBlur_loops2.png Binary files differnew file mode 100644 index 0000000..d710f35 --- /dev/null +++ b/doc/src/images/RecursiveBlur_loops2.png diff --git a/doc/src/images/RecursiveBlur_loops3.png b/doc/src/images/RecursiveBlur_loops3.png Binary files differnew file mode 100644 index 0000000..e1c18e7 --- /dev/null +++ b/doc/src/images/RecursiveBlur_loops3.png diff --git a/doc/src/images/RecursiveBlur_radius1.png b/doc/src/images/RecursiveBlur_radius1.png Binary files differnew file mode 100644 index 0000000..2bf1280 --- /dev/null +++ b/doc/src/images/RecursiveBlur_radius1.png diff --git a/doc/src/images/RecursiveBlur_radius2.png b/doc/src/images/RecursiveBlur_radius2.png Binary files differnew file mode 100644 index 0000000..696f118 --- /dev/null +++ b/doc/src/images/RecursiveBlur_radius2.png diff --git a/doc/src/images/RecursiveBlur_radius3.png b/doc/src/images/RecursiveBlur_radius3.png Binary files differnew file mode 100644 index 0000000..3710011 --- /dev/null +++ b/doc/src/images/RecursiveBlur_radius3.png diff --git a/doc/src/images/RecursiveBlur_transparentBorder1.png b/doc/src/images/RecursiveBlur_transparentBorder1.png Binary files differnew file mode 100644 index 0000000..3710011 --- /dev/null +++ b/doc/src/images/RecursiveBlur_transparentBorder1.png diff --git a/doc/src/images/RecursiveBlur_transparentBorder2.png b/doc/src/images/RecursiveBlur_transparentBorder2.png Binary files differnew file mode 100644 index 0000000..6adbc44 --- /dev/null +++ b/doc/src/images/RecursiveBlur_transparentBorder2.png diff --git a/doc/src/images/ThresholdMask_bug.png b/doc/src/images/ThresholdMask_bug.png Binary files differnew file mode 100755 index 0000000..1839e03 --- /dev/null +++ b/doc/src/images/ThresholdMask_bug.png diff --git a/doc/src/images/ThresholdMask_mask.png b/doc/src/images/ThresholdMask_mask.png Binary files differnew file mode 100644 index 0000000..5f78d26 --- /dev/null +++ b/doc/src/images/ThresholdMask_mask.png diff --git a/doc/src/images/ThresholdMask_spread1.png b/doc/src/images/ThresholdMask_spread1.png Binary files differnew file mode 100644 index 0000000..2288c2f --- /dev/null +++ b/doc/src/images/ThresholdMask_spread1.png diff --git a/doc/src/images/ThresholdMask_spread2.png b/doc/src/images/ThresholdMask_spread2.png Binary files differnew file mode 100644 index 0000000..504702e --- /dev/null +++ b/doc/src/images/ThresholdMask_spread2.png diff --git a/doc/src/images/ThresholdMask_spread3.png b/doc/src/images/ThresholdMask_spread3.png Binary files differnew file mode 100644 index 0000000..db289b1 --- /dev/null +++ b/doc/src/images/ThresholdMask_spread3.png diff --git a/doc/src/images/ThresholdMask_threshold1.png b/doc/src/images/ThresholdMask_threshold1.png Binary files differnew file mode 100644 index 0000000..8683c0a --- /dev/null +++ b/doc/src/images/ThresholdMask_threshold1.png diff --git a/doc/src/images/ThresholdMask_threshold2.png b/doc/src/images/ThresholdMask_threshold2.png Binary files differnew file mode 100644 index 0000000..15f1a1d --- /dev/null +++ b/doc/src/images/ThresholdMask_threshold2.png diff --git a/doc/src/images/ThresholdMask_threshold3.png b/doc/src/images/ThresholdMask_threshold3.png Binary files differnew file mode 100644 index 0000000..e0eb02b --- /dev/null +++ b/doc/src/images/ThresholdMask_threshold3.png diff --git a/doc/src/images/ZoomBlur_butterfly.png b/doc/src/images/ZoomBlur_butterfly.png Binary files differnew file mode 100755 index 0000000..cbffafa --- /dev/null +++ b/doc/src/images/ZoomBlur_butterfly.png diff --git a/doc/src/images/ZoomBlur_horizontalOffset1.png b/doc/src/images/ZoomBlur_horizontalOffset1.png Binary files differnew file mode 100644 index 0000000..dcf326c --- /dev/null +++ b/doc/src/images/ZoomBlur_horizontalOffset1.png diff --git a/doc/src/images/ZoomBlur_horizontalOffset2.png b/doc/src/images/ZoomBlur_horizontalOffset2.png Binary files differnew file mode 100644 index 0000000..3569eff --- /dev/null +++ b/doc/src/images/ZoomBlur_horizontalOffset2.png diff --git a/doc/src/images/ZoomBlur_horizontalOffset3.png b/doc/src/images/ZoomBlur_horizontalOffset3.png Binary files differnew file mode 100644 index 0000000..2b5cf9b --- /dev/null +++ b/doc/src/images/ZoomBlur_horizontalOffset3.png diff --git a/doc/src/images/ZoomBlur_length1.png b/doc/src/images/ZoomBlur_length1.png Binary files differnew file mode 100644 index 0000000..ac3d2aa --- /dev/null +++ b/doc/src/images/ZoomBlur_length1.png diff --git a/doc/src/images/ZoomBlur_length2.png b/doc/src/images/ZoomBlur_length2.png Binary files differnew file mode 100644 index 0000000..3569eff --- /dev/null +++ b/doc/src/images/ZoomBlur_length2.png diff --git a/doc/src/images/ZoomBlur_length3.png b/doc/src/images/ZoomBlur_length3.png Binary files differnew file mode 100644 index 0000000..9ecb813 --- /dev/null +++ b/doc/src/images/ZoomBlur_length3.png diff --git a/doc/src/qtgraphicaleffects-blend.qdoc b/doc/src/qtgraphicaleffects-blend.qdoc new file mode 100644 index 0000000..48a1823 --- /dev/null +++ b/doc/src/qtgraphicaleffects-blend.qdoc @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass Blend + \inqmlmodule QtGraphicalEffects + \brief Merges two source items by using a blend mode. + + Blend mode can be selected with the \l mode property. + + \table + \header + \o backgroundSource + \o foregroundSource + \o Effect applied + \row + \o \image Original_bug.png + \o \image Original_butterfly.png + \o \image Blend_bug_and_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/Blend-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource for backgroundSource (if used) + \o 1.2 MB + \row + \o ShaderEffectSource for foregroundSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Blend::backgroundSource + + This property defines the source item that is going to be the base when \l foregroundSource is blended over it. + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Blend::foregroundSource + + This property defines the item that is going to be blended over the \l backgroundSource. + +*/ + +/*! + \qmlproperty string QtGraphicalEffects::Blend::mode + + This property defines the mode which is used when foregroundSource is blended over backgroundSource. + + \table + \header + \o mode + \o description + \row + \o normal + \o The pixel component values from foregroundSource are written over backgroundSource by using alpha blending. + \row + \o addition + \o The pixel component values from backgroundSource and foregroundSource are added together and written. + \row + \o darken + \o The darkest pixel component value from backgroundSource and foregroundSource is written. + \row + \o difference + \o The absolute pixel component value difference between backgroundSource and foregroundSource is written. + \row + \o divide + \o The pixel component values from backgroundSource is divided by the value from foregroundSource and written. + \row + \o multiply + \o The pixel component values from backgroundSource and foregroundSource are multiplied together and written. + \row + \o lighten + \o The lightest pixel component value from backgroundSource and foregroundSource is written. + \row + \o screen + \o The pixel values from backgroundSource and foregroundSource are negated, then multiplied, negated again, and written. + \row + \o subtract + \o Pixel value from foregroundSource is subracted from backgroundSource and written. + \endtable + + \table + \header + \o Example backgroundSource + \o Example foregroundSource + \row + \o \image Original_bug.png + \o \image Original_butterfly.png + \endtable + + \table + \header + \o Output examples with different mode values + \o + \o + \row + \o \image Blend_mode1.png + \o \image Blend_mode2.png + \o \image Blend_mode3.png + \row + \o \bold { mode: normal } + \o \bold { mode: addition } + \o \bold { mode: darken } + \row + \o \image Blend_mode4.png + \o \image Blend_mode5.png + \o \image Blend_mode6.png + \row + \o \bold { mode: difference } + \o \bold { mode: divide } + \o \bold { mode: lighten } + \row + \o \image Blend_mode7.png + \o \image Blend_mode8.png + \o \image Blend_mode9.png + \row + \o \bold { mode: multiply } + \o \bold { mode: screen } + \o \bold { mode: subtract } + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::Blend::cached + + This property allows the effect output pixels to be cached in order to improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the cache must be updated. + Memory consumption is increased, because an extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect properties are animated. + + By default, the property is set to false. + +*/ diff --git a/doc/src/qtgraphicaleffects-brightnesscontrast.qdoc b/doc/src/qtgraphicaleffects-brightnesscontrast.qdoc new file mode 100644 index 0000000..e7b9aca --- /dev/null +++ b/doc/src/qtgraphicaleffects-brightnesscontrast.qdoc @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass BrightnessContrast + \inqmlmodule QtGraphicalEffects + \brief Adjusts brightness and contrast. + + This effect adjusts the source item colors. + Brightness adjustment changes the perceived luminance of the source item. + Contrast adjustment increases or decreases the color + and brightness variations. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image BrightnessContrast_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/BrightnessContrast-example.qml example + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the memory consumption of the the + source item area in pixels. Enabling the effect cache increases the memory + consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::BrightnessContrast::source + + This property defines the source item that provides the source pixels for + the effect. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::BrightnessContrast::brightness + + This property defines how much the source brightness is increased or + decreased. + + The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 + (no change). + + \table + \header + \o Output examples with different brightness values + \o + \o + \row + \o \image BrightnessContrast_brightness1.png + \o \image BrightnessContrast_brightness2.png + \o \image BrightnessContrast_brightness3.png + \row + \o \bold { brightness: -0.25 } + \o \bold { brightness: 0 } + \o \bold { brightness: 0.5 } + \row + \o \l contrast: 0 + \o \l contrast: 0 + \o \l contrast: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::BrightnessContrast::contrast + + This property defines how much the source contrast is increased or + decreased. The decrease of the contrast is linear, but the increase is + applied with a non-linear curve to allow very high contrast adjustment at + the high end of the value range. + + \table + \header + \o Contrast adjustment curve + \row + \o \image BrightnessContrast_contrast_graph.png + \endtable + + The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 (no change). + + \table + \header + \o Output examples with different contrast values + \o + \o + \row + \o \image BrightnessContrast_contrast1.png + \o \image BrightnessContrast_contrast2.png + \o \image BrightnessContrast_contrast3.png + \row + \o \bold { contrast: -0.5 } + \o \bold { contrast: 0 } + \o \bold { contrast: 0.5 } + \row + \o \l brightness: 0 + \o \l brightness: 0 + \o \l brightness: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::BrightnessContrast::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-colorize.qdoc b/doc/src/qtgraphicaleffects-colorize.qdoc new file mode 100644 index 0000000..3213e54 --- /dev/null +++ b/doc/src/qtgraphicaleffects-colorize.qdoc @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass Colorize + \inqmlmodule QtGraphicalEffects + \brief Sets the color in the HSL color space. + + The effect is similar to what happens when a colorized glass is put on top + of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL) + color space. You can specify a desired value for each property. You can + shift all HSL values with the + \l {QtGraphicalEffects::HueSaturation}{HueSaturation} effect. + + Alternatively, you can use the + \l {QtGraphicalEffects::ColorOverlay}{ColorOverlay} effect to colorize the + source item in the RGBA color space. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image Colorize_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/Colorize-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the memory consumption of the the + source item area in pixels. Enabling the effect cache increases the memory + consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Colorize::source + + This property defines the source item that provides the source pixels for + the effect. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Colorize::hue + + This property defines the hue value which is used to colorize the source. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c 0.0, + which produces a slightly red color. + + \table + \header + \o Allowed hue values + \row + \o \image Colorize_hue_scale.png + \endtable + + \table + \header + \o Output examples with different hue values + \o + \o + \row + \o \image Colorize_hue1.png + \o \image Colorize_hue2.png + \o \image Colorize_hue3.png + \row + \o \bold { hue: 0.2 } + \o \bold { hue: 0.5 } + \o \bold { hue: 0.8 } + \row + \o \l saturation: 1 + \o \l saturation: 1 + \o \l saturation: 1 + \row + \o \l lightness: 0 + \o \l lightness: 0 + \o \l lightness: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Colorize::saturation + + This property defines the saturation value which is used to colorize the + source. + + The value ranges from 0.0 (desaturated) to 1.0 (saturated). By default, the + property is set to \c 1.0 (saturated). + + \table + \header + \o Output examples with different saturation values + \o + \o + \row + \o \image Colorize_saturation1.png + \o \image Colorize_saturation2.png + \o \image Colorize_saturation3.png + \row + \o \bold { saturation: 0 } + \o \bold { saturation: 0.5 } + \o \bold { saturation: 1 } + \row + \o \l hue: 0 + \o \l hue: 0 + \o \l hue: 0 + \row + \o \l lightness: 0 + \o \l lightness: 0 + \o \l lightness: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Colorize::lightness + + This property defines how much the source lightness value is increased or + decreased. + + Unlike hue and saturation properties, lightness does not set the used value, + but it shifts the existing source pixel lightness value. + + The value ranges from -1.0 (decreased) to 1.0 (increased). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \o Output examples with different lightness values + \o + \o + \row + \o \image Colorize_lightness1.png + \o \image Colorize_lightness2.png + \o \image Colorize_lightness3.png + \row + \o \bold { lightness: -0.75 } + \o \bold { lightness: 0 } + \o \bold { lightness: 0.75 } + \row + \o \l hue: 0 + \o \l hue: 0 + \o \l hue: 0 + \row + \o \l saturation: 1 + \o \l saturation: 1 + \o \l saturation: 1 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::Colorize::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-coloroverlay.qdoc b/doc/src/qtgraphicaleffects-coloroverlay.qdoc new file mode 100644 index 0000000..e9a2480 --- /dev/null +++ b/doc/src/qtgraphicaleffects-coloroverlay.qdoc @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass ColorOverlay + \inqmlmodule QtGraphicalEffects + \brief Alters the colors of the source item by applying an overlay color. + + The effect is similar to what happens when a colorized glass is put on top + of a grayscale image. The color for the overlay is given in the RGBA format. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly_black.png + \o \image ColorOverlay_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/ColorOverlay-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect in 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::ColorOverlay::source + + This property defines the source item that provides the source pixels for + the effect. + +*/ + +/*! + \qmlproperty color QtGraphicalEffects::ColorOverlay::color + + This property defines the RGBA color value which is used to colorize the source. + + By default, the property is set to \c "transparent". + + \table + \header + \o Output examples with different color values + \o + \o + \row + \o \image ColorOverlay_color1.png + \o \image ColorOverlay_color2.png + \o \image ColorOverlay_color3.png + \row + \o \bold { color: #80ff0000 } + \o \bold { color: #8000ff00 } + \o \bold { color: #800000ff } + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::Colorize::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-conicalgradient.qdoc b/doc/src/qtgraphicaleffects-conicalgradient.qdoc new file mode 100644 index 0000000..291b51d --- /dev/null +++ b/doc/src/qtgraphicaleffects-conicalgradient.qdoc @@ -0,0 +1,266 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass ConicalGradient + \inqmlmodule QtGraphicalEffects + \brief Draws a conical gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the specified angle and end at 360 degrees larger + angle value. + + \table + \header + \o Effect applied + \row + \o \image ConicalGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/ConicalGradient-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small, the effect uses only 1x256 pixels + image to store the temporary gradient image. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o less than 0.1 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o ShaderEffectSource for maskSource (if used) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty Gradient QtGraphicalEffects::ConicalGradient::gradient + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors are specified as a set of GradientStop child items, each of which + defines a position on the gradient (from 0.0 to 1.0), and a color. + The position of each GradientStop is defined by the position property. + The color is defined by the color property. + + \table + \header + \o Output examples with different gradient values + \o + \o + \row + \o \image ConicalGradient_gradient1.png + \o \image ConicalGradient_gradient2.png + \o \image ConicalGradient_gradient3.png + \row + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } +} + \endcode + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } +} + \endcode + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } +} + \endcode + \row + \o \l angle: 0 + \o \l angle: 0 + \o \l angle: 0 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::ConicalGradient::maskSource + + This property defines the item that is going to be used as the mask. The + mask gets rendered into an intermediate pixel buffer. + The alpha values from the result are used to determine the gradient's pixels + visibility in the display. + The default value for maskSource is undefined, and in that case no mask is + used. + + \table + \header + \o Output examples with different maskSource values + \o + \row + \o \image ConicalGradient_maskSource1.png + \o \image ConicalGradient_maskSource2.png + \row + \o \bold { maskSource: undefined } + \o \bold { maskSource: } + \row + \o \l angle: 0 + \o \l angle: 0 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ConicalGradient::angle + + This property defines the starting angle where the color at the gradient + position of 0.0 is rendered. Colors at larger position values are rendered + into larger angle values and blended seamlessly. Angle values increase + clockwise. + + \table + \header + \o Output examples with different angle values + \o + \o + \row + \o \image ConicalGradient_angle1.png + \o \image ConicalGradient_angle2.png + \o \image ConicalGradient_angle3.png + \row + \o \bold { angle: 0 } + \o \bold { angle: 45 } + \o \bold { angle: 185 } + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ConicalGradient::horizontalOffset + \qmlproperty real QtGraphicalEffects::ConicalGradient::verticalOffset + + The HorizontalOffset and verticalOffset properties define the offset in + pixels for the center point of the gradient compared to the item center. + + The value ranges from -inf to inf. By default, the properties are set to \c 0. + + \table + \header + \o Output examples with different horizontalOffset values + \o + \o + \row + \o \image ConicalGradient_horizontalOffset1.png + \o \image ConicalGradient_horizontalOffset2.png + \o \image ConicalGradient_horizontalOffset3.png + \row + \o \bold { horizontalOffset: -50 } + \o \bold { horizontalOffset: 0 } + \o \bold { horizontalOffset: 50 } + \row + \o \l angle: 0 + \o \l angle: 0 + \o \l angle: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::ConicalGradient::cached + + This property allows the effect output pixels to be cached in order to improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the cache must be updated. + Memory consumption is increased, because an extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-desaturate.qdoc b/doc/src/qtgraphicaleffects-desaturate.qdoc new file mode 100644 index 0000000..f774fd5 --- /dev/null +++ b/doc/src/qtgraphicaleffects-desaturate.qdoc @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass Desaturate + \inqmlmodule QtGraphicalEffects + \brief Reduces the saturation of the colors. + + Desaturated pixel values are calculated as averages of the original RGB + component values of the source item. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image Desaturate_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/Desaturate-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Desaturate::source + + This property defines the source item that provides the source pixels to the + effect. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Desaturate::desaturation + + This property defines how much the source colors are desaturated. + + The value ranges from 0.0 (no change) to 1.0 (desaturated). By default, the + property is set to \c 0.0 (no chnage). + + \table + \header + \o Output examples with different desaturation values + \o + \o + \row + \o \image Desaturate_desaturation1.png + \o \image Desaturate_desaturation2.png + \o \image Desaturate_desaturation3.png + \row + \o \bold { desaturation: 0.0 } + \o \bold { desaturation: 0.5 } + \o \bold { desaturation: 1.0 } + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::Desaturate::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-directionalblur.qdoc b/doc/src/qtgraphicaleffects-directionalblur.qdoc new file mode 100644 index 0000000..dd1954b --- /dev/null +++ b/doc/src/qtgraphicaleffects-directionalblur.qdoc @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass DirectionalBlur + \inqmlmodule QtGraphicalEffects + \brief Applies blur effect to the specified direction. + + Effect creates perceived impression that the source item appears to be + moving in the direction of the blur. Blur is applied to both sides of + each pixel, therefore setting the direction to 0 and 180 provides the + same result. + + Other available motionblur effects are \l {QtGraphicalEffects::ZoomBlur} {ZoomBlur} and + \l {QtGraphicalEffects::RadialBlur} {RadialBlur}. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly.png + \o \image DirectionalBlur_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/DirectionalBlur-example.qml example + + \section1 Memory consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally + creates one ShaderEffectSource item per source. Enabling the effect cache + increases the memory consumption because an extra buffer is allocated for + the effect output. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect (32bpp colors) + \o + \row + \o Effect internal + \o 0.0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::DirectionalBlur::source + + This property defines the source item that is going to be blurred. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DirectionalBlur::length + + This property defines the percieved amount of movement for each pixel. + The movement is divided evenly to both sides of each pixel. + + The quality of the blur depends on \l samples property. If length value is + large, more samples are needed to keep the visual quality at high level. + + The value ranges from 0.0 to inf. + By default the property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different length values + \o + \o + \row + \o \image DirectionalBlur_length1.png + \o \image DirectionalBlur_length2.png + \o \image DirectionalBlur_length3.png + \row + \o \bold { length: 0.0 } + \o \bold { length: 32.0 } + \o \bold { length: 64.0 } + \row + \o \l samples: 32 + \o \l samples: 32 + \o \l samples: 32 + \row + \o \l angle: 0 + \o \l angle: 0 + \o \l angle: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DirectionalBlur::samples + + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DirectionalBlur::angle + + This property defines the direction for the blur. Blur is applied to + both sides of each pixel, therefore setting the direction to 0 and 180 + produces the same result. + + The value ranges from -180.0 to 180.0. + By default the property is set to \c 0.0. + + \table + \header + \o Output examples with different angle values + \o + \o + \row + \o \image DirectionalBlur_angle1.png + \o \image DirectionalBlur_angle2.png + \o \image DirectionalBlur_angle3.png + \row + \o \bold { angle: 0.0 } + \o \bold { angle: 45.0 } + \o \bold { angle: 90.0 } + \row + \o \l samples: 32 + \o \l samples: 32 + \o \l samples: 32 + \row + \o \l length: 32 + \o \l length: 32 + \o \l length: 32 + \endtable + +*/ + + +/*! + \qmlproperty bool QtGraphicalEffects::DirectionalBlur::transparentBorder + + This property defines the blur near the edges of the item, where the pixel + blurring is affected by the pixels just outside the source. + + Setting this property to \c false, interprets the pixels outside the item + according to the OpenGL clamp-to-edge mode. If the source is Image, the pixels + are interpreted according to the Image::fillMode property. If the source is + ShaderEffectSource, the pixels are interpreted according to the + ShaderEffectSource::wrapMode property. + + Setting this property to \c true, interprets the pixels outside the item to + be transparent. This behavior is similar to the OpenGL clamp-to-border + extension. The blur is expanded slightly outside the effect item area. + + By default, the property is set to \c false. + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::DirectionalBlur::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-displace.qdoc b/doc/src/qtgraphicaleffects-displace.qdoc new file mode 100644 index 0000000..003d2e6 --- /dev/null +++ b/doc/src/qtgraphicaleffects-displace.qdoc @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass Displace + \inqmlmodule QtGraphicalEffects + \brief Moves the pixels of the source item according to the given + displacement map. + + \table + \header + \o Source + \o DisplacementSource + \o Effect applied + \row + \o \image Original_bug.png + \o \image Displace_map.png + \o \image Displace_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/Displace-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o ShaderEffectSource for displacement map (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Displace::source + + This property defines the source item for the pixels that are going to be + displaced according to the data from \l displacementSource. + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Displace::displacementSource + + This property defines the item that is going to be used as the displacement + map. The displacementSource item gets rendered into the intermediate pixel + buffer. The red and green component values from the result determine the + displacement of the pixels from the source item. + + The format for the displacement map is similar to the tangent space normal + maps, which can be created with most 3D-modeling tools. Many image + processing tools include the support for generating normal maps. + Alternatively, the displacement map for this effect can also be a QML + element which is colored appropriately. Like any QML element, it can be + animated. It is recommended that the size of the diplacement map matches the + size of the \l source. + + The displace data is interpreted in the RGBA format. For every pixel: the + red channel stores the x-axis displacement, and the green channel stores the + y-axis displacement. Blue and alpha channels are ignored for this effect. + + Assuming that red channel value 1.0 is fully red (0.0 having no red at all), + this effect considers pixel component value 0.5 to cause no displacement at + all. Values above 0.5 shift pixels to the left, values below 0.5 do the + shift to the right. In a similar way, green channel values above 0.5 + displace the pixels upwards, and values below 0.5 shift the pixels + downwards. The actual amount of displacement in pixels depends on the \l + displacement property. + +\table +\header +\o Output examples with different displacement values +\o +\o +\row + \o \image Displace_displacement1.png + \o \image Displace_displacement2.png + \o \image Displace_displacement3.png +\row + \o \bold { displacement: -0.3 } + \o \bold { displacement: 0.0 } + \o \bold { displacement: 0.3 } +\endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Displace::displacement + + This property defines the scale for the displacement. The bigger scale, the + bigger the displacement of the pixels. The value set to 0.0 causes no + displacement. + + The value ranges from -1.0 (inverted maximum shift, according to + displacementSource) to 1.0 (maximum shift, according to displacementSource). + By default, the property is set to \c 0.0 (no displacement). + + \table + \header + \o Output examples with different displacement values + \o + \o + \row + \o \image Displace_displacement1.png + \o \image Displace_displacement2.png + \o \image Displace_displacement3.png + \endtable + +*/ + + +/*! + \qmlproperty bool QtGraphicalEffects::Displace::cached + + This property allows the effect output pixels to be cached in order to improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the cache must be updated. + Memory consumption is increased, because an extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-dropshadow.qdoc b/doc/src/qtgraphicaleffects-dropshadow.qdoc new file mode 100644 index 0000000..81603b9 --- /dev/null +++ b/doc/src/qtgraphicaleffects-dropshadow.qdoc @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass DropShadow + \inqmlmodule QtGraphicalEffects + \brief Generates a colorized and blurred shadow image of the + source. + + The DropShadow effect produces a high quality shadow image, thus the + rendering speed of the shadow might not be the highest possible. The + rendering speed is reduced especially if the shadow edges are heavily + softened. + For use cases that require faster rendering speed and for which the highest + possible visual quality is not necessary, there is an alternative effect + called \l {QtGraphicalEffects::FastDropShadow} {FastDropShadow}. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly.png + \o \image DropShadow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/DropShadow-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is approximately the same as the memory + consumption of the the source item area in pixels. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + + Enabling the effect cache increases the memory consumption. + + Due to performance reasons, the dropshadow generation is internally + implemented with two passes: a horizontal and a vertical pass. This 2-pass + method requires one intermediate buffer for the pixel data. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 1.2 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::DropShadow::source + + This property defines the source item that is going to be used as the source + for the generated shadow. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DropShadow::radius + + Radius defines the softness of the shadow. A larger radius causes the edges + of the shadow to appear more blurry. + + \bold Note: The value of the radius must be lower than the maximumRadius, + otherwise the blur quality is not optimal. + + The value ranges from 0.0 (no blur) to \l maximumRadius (maximum blur). By + default, the property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different radius values + \o + \o + \row + \o \image DropShadow_radius1.png + \o \image DropShadow_radius2.png + \o \image DropShadow_radius3.png + \row + \o \bold { radius: 0 } + \o \bold { radius: 6 } + \o \bold { radius: 12 } + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l color: #000000 + \o \l color: #000000 + \o \l color: #000000 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DropShadow::maximumRadius + + This property defines the maximum radius value that can be used without + compromising the shadow softness quality. Setting too large maximumRadius + value has a negative impact on the rendering performance. Changing this + property may cause the underlying OpenGL shaders to be recompiled. + + Ideally, this value is the same as the highest required radius value, for + example, if the radius is animated between 0.0 and 4.0, maximumRadius should + be set to 4. + + The value ranges from 0 to 16. By default, the property is set to \c 0. +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DropShadow::spread + + This property defines how large part of the glow color is strenghtened near + the source edges. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c 0.5. + + \table + \header + \o Output examples with different spread values + \o + \o + \row + \o \image DropShadow_spread1.png + \o \image DropShadow_spread2.png + \o \image DropShadow_spread3.png + \row + \o \bold { spread: 0.0 } + \o \bold { spread: 0.5 } + \o \bold { spread: 1.0 } + \row + \o \l radius: 8 + \o \l radius: 8 + \o \l radius: 8 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l color: #000000 + \o \l color: #000000 + \o \l color: #000000 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \endtable + +*/ + +/*! + \qmlproperty color QtGraphicalEffects::DropShadow::color + + This property defines the RGBA color value which is used for the shadow. + + By default, the property is set to \c "black". + + \table + \header + \o Output examples with different color values + \o + \o + \row + \o \image DropShadow_color1.png + \o \image DropShadow_color2.png + \o \image DropShadow_color3.png + \row + \o \bold { color: #000000 } + \o \bold { color: #0000ff } + \o \bold { color: #aa000000 } + \row + \o \l radius: 8 + \o \l radius: 8 + \o \l radius: 8 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::DropShadow::horizontalOffset + \qmlproperty real QtGraphicalEffects::DropShadow::verticalOffset + + HorizontalOffset and verticalOffset properties define the offset + for the rendered shadow compared to the DropShadow item position. Often, the + DropShadow item is anchored so that it fills the source element. In this + case, if the HorizontalOffset and verticalOffset properties are set to 0, the + shadow is rendered exactly under the source item. By changing the offset + properties, the shadow can be positioned relatively to the source item. + + The values range from -inf to inf. By default, the properties are set to \c 0. + + \table + \header + \o Output examples with different horizontalOffset values + \o + \o + \row + \o \image DropShadow_horizontalOffset1.png + \o \image DropShadow_horizontalOffset2.png + \o \image DropShadow_horizontalOffset3.png + \row + \o \bold { horizontalOffset: -20 } + \o \bold { horizontalOffset: 0 } + \o \bold { horizontalOffset: 20 } + \row + \o \l radius: 4 + \o \l radius: 4 + \o \l radius: 4 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l color: #000000 + \o \l color: #000000 + \o \l color: #000000 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::DropShadow::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + Every time the source or effect properties are changed, the pixels in the cache + must be updated. Memory consumption is increased, because an extra buffer of + memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-fastblur.qdoc b/doc/src/qtgraphicaleffects-fastblur.qdoc new file mode 100644 index 0000000..6ebc344 --- /dev/null +++ b/doc/src/qtgraphicaleffects-fastblur.qdoc @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass FastBlur + \inqmlmodule QtGraphicalEffects + \brief Applies a fast blur effect to one or more source items. + + FastBlur offers lower blur quality than \l + {QtGraphicalEffects::GaussianBlur} {GaussianBlur}, but it is faster to + render. The FastBlur effect softens the source content by blurring it with + algorithm which uses the source content downscaling and bilinear filtering. + Use this effect in situations where the source content is rapidly changing + and the highest possible blur quality is not + needed. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image FastBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/FastBlur-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is approximately twice the memory + consumption of the the source item area in pixels. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption because an extra + buffer is allocated for the effect output. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 2.4 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 4.8 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::FastBlur::source + + This property defines the source item that is going to be blurred. + +*/ +/*! + \qmlproperty real QtGraphicalEffects::FastBlur::blur + + BlurLevel defines the level of blurring, value 0.0 represents the source as + unblurred and value 1.0 blurs the source maximally. + + The value ranges from 0.0 (no blur) to 1.0 (maximum blur). By default, the + property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different blur values + \o + \o + \row + \o \image FastBlur_blur1.png + \o \image FastBlur_blur2.png + \o \image FastBlur_blur3.png + \row + \o \bold { blur: 0.0 } + \o \bold { blur: 0.5 } + \o \bold { blur: 1.0 } + \endtable +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::FastBlur::transparentBorder + + This property defines the blur near the edges of the item, where the pixel + blurring is affected by the pixels just outside the source. + + Setting this property to \c false, interprets the pixels outside the item + according to the OpenGL clamp-to-edge mode. If the source is Image, the pixels + are interpreted according to the Image::fillMode property. If the source is + ShaderEffectSource, the pixels are interpreted according to the + ShaderEffectSource::wrapMode property. + + Setting this property to \c true, interprets the pixels outside the item to + be transparent. This behavior is similar to the OpenGL clamp-to-border + extension. The blur is expanded slightly outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \o Output examples with different transparentBorder values + \o + \o + \row + \o \image FastBlur_transparentBorder1.png + \o \image FastBlur_transparentBorder2.png + \row + \o \bold { transparentBorder: false } + \o \bold { transparentBorder: true } + \row + \o \l blur: 1 + \o \l blur: 1 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::FastBlur::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-fastdropshadow.qdoc b/doc/src/qtgraphicaleffects-fastdropshadow.qdoc new file mode 100644 index 0000000..785993f --- /dev/null +++ b/doc/src/qtgraphicaleffects-fastdropshadow.qdoc @@ -0,0 +1,275 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass FastDropShadow + \inqmlmodule QtGraphicalEffects + \brief Generates a fast shadow image of the source. + + FastDropShadow is intended to be fast to render. It means that the quality + of the shadow may not be highest possible, especially if the shadow edges + are softened. For situations where a high visual quality is required, consider + \l {QtGraphicalEffects::DropShadow}{DropShadow} effect. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly.png + \o \image FastDropShadow_butterfly.png + \endtable + + \section1 Example + + The following example shows the usage of some of the items common properties. + \snippet snippets/FastDropShadow-example.qml example + + \section1 Memory consumption + + The internal memory consumption is approximately twice the memory + consumption of the the source item area in pixels. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption because an extra + buffer is allocated for the effect output. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 2.4 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 4.8 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::FastDropShadow::source + + This property defines the source item that is going to be used as source for + the generated shadow. + +*/ +/*! + \qmlproperty real QtGraphicalEffects::FastDropShadow::blur + + BlurLevel defines the softness of the shadow edge. The value of 0.0 + represents the shadow as sharp. The value of 1.0 softens the shdow edges + maximally. + + The value ranges from 0.0 (no blur) to 1.0 (maximum blur). By default the + property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different blur values + \o + \o + \row + \o \image FastDropShadow_blur1.png + \o \image FastDropShadow_blur2.png + \o \image FastDropShadow_blur3.png + \row + \o \bold { blur: 0.0 } + \o \bold { blur: 0.5 } + \o \bold { blur: 0.8 } + \row + \o \l color: #000000 + \o \l color: #000000 + \o \l color: #000000 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable +*/ + +/*! + \qmlproperty real QtGraphicalEffects::FastDropShadow::spread + + This property defines how large part of the glow color is strenghtened near + the source edges. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c 0.5. + + \table + \header + \o Output examples with different spread values + \o + \o + \row + \o \image FastDropShadow_spread1.png + \o \image FastDropShadow_spread2.png + \o \image FastDropShadow_spread3.png + \row + \o \bold { spread: 0.0 } + \o \bold { spread: 0.5 } + \o \bold { spread: 0.8 } + \row + \o \l blur: 0.5 + \o \l blur: 0.5 + \o \l blur: 0.5 + \row + \o \l color: #000000 + \o \l color: #000000 + \o \l color: #000000 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \endtable + +*/ + +/*! + \qmlproperty color QtGraphicalEffects::FastDropShadow::color + + This property defines the RGBA color value which is used for the shadow. + + By default, the property is set to \c "black". + + \table + \header + \o Output examples with different color values + \o + \o + \row + \o \image FastDropShadow_color1.png + \o \image FastDropShadow_color2.png + \o \image FastDropShadow_color3.png + \row + \o \bold { color: #000000 } + \o \bold { color: #0000ff } + \o \bold { color: #aa000000 } + \row + \o \l blur: 0.5 + \o \l blur: 0.5 + \o \l blur: 0.5 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \o \l verticalOffset: 20 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::FastDropShadow::horizontalOffset + \qmlproperty real QtGraphicalEffects::FastDropShadow::verticalOffset + + HorizontalOffset and verticalOffset properties define the offset for the + rendered shadow compared to the DropShadow item position. Often, the + DropShadow item is anchored so that it fills the source element. In this + case, if the HorizontalOffset and verticalOffset properties are set to 0 the + shadow is rendered exactly under the source item. By changing the offset + properties, the shadow can be positioned relatively to the source item. + + The values range from -inf to inf. By default, these properties are set to \c 0. + + \table + \header + \o Output examples with different horizontalOffset values + \o + \o + \row + \o \image FastDropShadow_horizontalOffset1.png + \o \image FastDropShadow_horizontalOffset2.png + \o \image FastDropShadow_horizontalOffset3.png + \row + \o \bold { horizontalOffset: -20 } + \o \bold { horizontalOffset: 0 } + \o \bold { horizontalOffset: 20 } + \row + \o \l blur: 0.5 + \o \l blur: 0.5 + \o \l blur: 0.5 + \row + \o \l color: #000000 + \o \l color: #000000 + \o \l color: #000000 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::FastDropShadow::cached + + This property allows the effect output pixels to be cached in order to + improve rendering performance. After the effect has been rendered into a + cache, drawing the effect into display can be done using the cached pixels, + which is very fast. + + However every time when the source or effect properties are changed, the + pixels in the cache need to be updated. Another drawback of the caching is + the increased memory consumption, extra buffer of memory is required for + storing the effect output. + + A rule of thumb for using the cache would be that it should be disabled when + the source or the effect properties are animated, otherwise it should be + enabled. + + By default the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-fastglow.qdoc b/doc/src/qtgraphicaleffects-fastglow.qdoc new file mode 100644 index 0000000..54222e9 --- /dev/null +++ b/doc/src/qtgraphicaleffects-fastglow.qdoc @@ -0,0 +1,206 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass FastGlow + \inqmlmodule QtGraphicalEffects + \brief Generates a fast blurred and colorized image of the source, which gives + the impression that the source is glowing. + + This effect is intended to have good performance, thus the quality of the + effect may not be the highest possible, especially if the glow is soft. For + situations where the high visual quality is required, consider the \l {QtGraphicalEffects::Glow}{Glow} + effect. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly_black.png + \o \image FastGlow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/FastGlow-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is approximately twice the memory + consumption of the the source item area in pixels. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption because an extra + buffer is allocated for the effect output. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 2.4 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 4.8 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::FastGlow::source + + This property defines the source item that is going to be used as the source + for the generated glow. + +*/ + + +/*! + \qmlproperty color QtGraphicalEffects::FastGlow::color + + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \o Output examples with different color values + \o + \o + \row + \o \image FastGlow_color1.png + \o \image FastGlow_color2.png + \o \image FastGlow_color3.png + \row + \o \bold { color: #ffffff } + \o \bold { color: #00ff00 } + \o \bold { color: #aa00ff00 } + \row + \o \l blur: 0.5 + \o \l blur: 0.5 + \o \l blur: 0.5 + \row + \o \l spread: 0.25 + \o \l spread: 0.25 + \o \l spread: 0.25 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::FastGlow::blur + + BlurLevel defines the level of glow edge softness. The value of 0.0 + represents the glow as sharp and the value of 1.0 softens the glow edges + maximally. + + The value ranges from 0.0 (no blur) to 1.0 (maximum blur). By default, the + property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different blur values + \o + \o + \row + \o \image FastGlow_blur1.png + \o \image FastGlow_blur2.png + \o \image FastGlow_blur3.png + \row + \o \bold { blur: 0.0 } + \o \bold { blur: 0.5 } + \o \bold { blur: 1.0 } + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::FastGlow::spread + + This property defines how large part of the glow color is strenghtened near + the source edges. + + The value ranges from 0.0 (no change) to 1.0 (maximum increase). By default, + the property is set to \c 0.0 (no change). + + \table + \header + \o Output examples with different spread values + \o + \o + \row + \o \image FastGlow_spread1.png + \o \image FastGlow_spread2.png + \o \image FastGlow_spread3.png + \row + \o \bold { spread: 0.0 } + \o \bold { spread: 0.5 } + \o \bold { spread: 0.9 } + \row + \o \l blur: 0.5 + \o \l blur: 0.5 + \o \l blur: 0.5 + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::FastGlow::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-gammaadjust.qdoc b/doc/src/qtgraphicaleffects-gammaadjust.qdoc new file mode 100644 index 0000000..f874cb5 --- /dev/null +++ b/doc/src/qtgraphicaleffects-gammaadjust.qdoc @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass GammaAdjust + \inqmlmodule QtGraphicalEffects + \brief Alters the luminance of the source item. + + GammaAdjust is applied to each pixel according to the curve which is + pre-defined as a power-law expression, where the property gamma is used as the scaling + exponent. Refer to the property documentation of \l gamma for more details. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image GammaAdjust_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/GammaAdjust-example.qml example + + \section1 Memory Consumption + + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::GammaAdjust::source + + This property defines the source item for which the luminance is going to be + adjusted. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::GammaAdjust::gamma + + This property defines the change factor for how the luminance of each pixel is altered according to the + equation: \code luminance = pow(original_luminance, gamma); // The luminance is assumed to be between 0.0 and 1.0 \endcode + + Setting the gamma values under 1.0 makes the image brighter, the values + above 1.0 darken it. + + The value ranges from 0.0 (bright) to inf (dark). By default, the property + is set to \c 1.0 (no change). + + \table + \header + \o Output examples with different gamma values + \o + \o + \row + \o \image GammaAdjust_gamma1.png + \o \image GammaAdjust_gamma2.png + \o \image GammaAdjust_gamma3.png + \row + \o \bold { gamma: 0.5 } + \o \bold { gamma: 1.0 } + \o \bold { gamma: 1.5 } + \endtable + + \table + \header + \o Pixel luminance curves of the above images. + \o + \o + \row + \o \image GammaAdjust_gamma1_graph.png + \o \image GammaAdjust_gamma2_graph.png + \o \image GammaAdjust_gamma3_graph.png + \row + \o Red curve: default gamma + \o + \o + \row + \o Yellow curve: effect applied + \o + \o + \row + \o X-axis: pixel original luminance + \o + \o + \row + \o Y-axis: pixel luminance with effect applied + \o + \o + \endtable + +*/ + + +/*! + \qmlproperty bool QtGraphicalEffects::GammaAdjust::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-gaussianblur.qdoc b/doc/src/qtgraphicaleffects-gaussianblur.qdoc new file mode 100644 index 0000000..eed4c73 --- /dev/null +++ b/doc/src/qtgraphicaleffects-gaussianblur.qdoc @@ -0,0 +1,244 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass GaussianBlur + \inqmlmodule QtGraphicalEffects + \brief Applies a higher quality blur effect. + + GaussianBlur effect softens the image by blurring it with an algorithm that + uses the Gaussian function to calculate the effect. The effect produces + higher quality than \l FastBlur, but is slower to render. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image GaussianBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/GaussianBlur-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is approximately the same as the memory + consumption of the the source item area in pixels. + This is because due performance reasons the blur is internally implemented + with two passes: a horizontal and a vertical pass. This 2-pass method + requires one intermediate buffer for the pixel data. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 1.2 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::GaussianBlur::source + + This property defines the source item that is going to be blurred. + +*/ +/*! + \qmlproperty real QtGraphicalEffects::GaussianBlur::radius + + This property defines the distance of the neighboring pixels which affect + the blurring of an individual pixel. A larger radius increases the blur + effect. To achieve a more blurry result, it is sometimes possible to + increase the deviation property. + + \bold Note: The radius value should always be lower than maximumRadius, + otherwise the blur quality is not optimal. + + The value ranges from 0.0 (no blur) to maximumRadius (maximum blur). By + default, the property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different radius values + \o + \o + \row + \o \image GaussianBlur_radius1.png + \o \image GaussianBlur_radius2.png + \o \image GaussianBlur_radius3.png + \row + \o \bold { radius: 0 } + \o \bold { radius: 4 } + \o \bold { radius: 8 } + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l deviation: 3 + \o \l deviation: 3 + \o \l deviation: 3 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::GaussianBlur::maximumRadius + + This property defines the maximum radius value that can be used without + compromising the blur quality. Setting a too large maximumRadius value has a + negative impact on the rendering performance. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Ideally, this value should be the same as the highest required radius value, + for example. if the radius is animated between 0.0 and 4.0, maximumRadius + should be set to 4. + + The value ranges from 0 to 16. By default, the property is set to \c 0. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::GaussianBlur::deviation + + This property is a parameter to the gaussian function that is used when + calculating neighboring pixel weights for the blurring. A larger deviation + causes image to appear more blurry, but it also reduces the quality of the + blur. A very large deviation value causes the effect to look a bit similar + to what, for exmple, a box blur algorithm produces. A too small deviation + values makes the effect insignificant for the pixels near the radius. + + \inlineimage GaussianBlur_deviation_graph.png + \caption The image above shows the Gaussian function with two different + deviation values, yellow (1) and cyan (2.7). The y-axis shows the weights, + the x-axis shows the pixel distance. + + The value ranges from 0.0 (no deviation) to inf (maximum deviation). By + default, devaition is binded to radius. When radius increases, deviation is + automatically increased linearly. With the radius value of 8, the deviation + default value becomes approximately 2.7034. This value produces a compromise + between the blur quality and overall blurriness. + + \table + \header + \o Output examples with different deviation values + \o + \o + \row + \o \image GaussianBlur_deviation1.png + \o \image GaussianBlur_deviation2.png + \o \image GaussianBlur_deviation3.png + \row + \o \bold { deviation: 1 } + \o \bold { deviation: 2 } + \o \bold { deviation: 4 } + \row + \o \l radius: 8 + \o \l radius: 8 + \o \l radius: 8 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::GaussianBlur::transparentBorder + + This property defines the blur near the edges of the item, where the pixel + blurring is affected by the pixels just outside the source. + + Setting this property to \c false, interprets the pixels outside the item + according to the OpenGL clamp-to-edge mode. If the source is Image, the pixels + are interpreted according to the Image::fillMode property. If the source is + ShaderEffectSource, the pixels are interpreted according to the + ShaderEffectSource::wrapMode property. + + Setting this property to \c true, interprets the pixels outside the item to + be transparent. This behavior is similar to the OpenGL clamp-to-border + extension. The blur is expanded slightly outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \o Output examples with different transparentBorder values + \o + \o + \row + \o \image GaussianBlur_transparentBorder1.png + \o \image GaussianBlur_transparentBorder2.png + \row + \o \bold { transparentBorder: false } + \o \bold { transparentBorder: true } + \row + \o \l radius: 8 + \o \l radius: 8 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l deviation: 2.7000270002700026 + \o \l deviation: 2.7000270002700026 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::GaussianBlur::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + Every time the source or effect properties are changed, the pixels in the cache + must be updated. Memory consumption is increased, because an extra buffer of + memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-glow.qdoc b/doc/src/qtgraphicaleffects-glow.qdoc new file mode 100644 index 0000000..3dd8f92 --- /dev/null +++ b/doc/src/qtgraphicaleffects-glow.qdoc @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass Glow + \inqmlmodule QtGraphicalEffects + \brief Generates a blurred and colorized image of the source, which gives + the impression that the source is glowing. + + The Glow effect produces a high quality shadow image, thus the rendering + speed of the shadow may not be the highest possible. The rendering speed is + reduced especially if the shadow edges are heavily softened. + For use cases that require faster rendering speed and the highest possible + visual quality is not necessary, there is another effect called \l {QtGraphicalEffects::FastGlow} {FastGlow}. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly_black.png + \o \image Glow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/Glow-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is approximately the same as the memory + consumption of the the source item area in pixels. Due to performance + reasons, the glow generation is implemented with two passes: a horizontal + and a vertical pass. This 2-pass method requires one intermediate buffer for + the pixel data. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect in 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 1.2 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::Glow::source + + This property defines the source item that is going to be used as source for + the generated glow. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Glow::radius + + The radius property defines the softness of the glow. A larger radius causes + the glow edges to appear more blurry. + + \bold Note: The radius value should always be lower than \l maximumRadius, + otherwise the blur quality is not optimal. + + The values range from 0.0 (no blur) to \l maximumRadius (maximum blur). By + default, the property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different radius values + \o + \o + \row + \o \image Glow_radius1.png + \o \image Glow_radius2.png + \o \image Glow_radius3.png + \row + \o \bold { radius: 0 } + \o \bold { radius: 6 } + \o \bold { radius: 12 } + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Glow::maximumRadius + + MaxRadius defines the maximum radius value that can be used without + compromising the glow softness quality. Setting a too large maximumRadius + value has a negative impact on the rendering performance. Changing this + property may cause the underlying OpenGL shaders to be recompiled. + + Ideally, this value should be the same as the highest required radius value, + for example, if radius is animated between 0.0 and 4.0, maximumRadius should + be set to 4. + + The value ranges from 0 to 16. By default, the property is set to \c 0. + +*/ + +/*! + \qmlproperty color QtGraphicalEffects::Glow::color + + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \o Output examples with different color values + \o + \o + \row + \o \image Glow_color1.png + \o \image Glow_color2.png + \o \image Glow_color3.png + \row + \o \bold { color: #ffffff } + \o \bold { color: #00ff00 } + \o \bold { color: #aa00ff00 } + \row + \o \l radius: 8 + \o \l radius: 8 + \o \l radius: 8 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l spread: 0.5 + \o \l spread: 0.5 + \o \l spread: 0.5 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::Glow::spread + + This property defines how large part of the glow color is strenghtened near + the source edges. + + The values range from 0.0 to 1.0. By default, the property is set to \c 0.5. + + \table + \header + \o Output examples with different spread values + \o + \o + \row + \o \image Glow_spread1.png + \o \image Glow_spread2.png + \o \image Glow_spread3.png + \row + \o \bold { spread: 0.0 } + \o \bold { spread: 0.5 } + \o \bold { spread: 1.0 } + \row + \o \l radius: 8 + \o \l radius: 8 + \o \l radius: 8 + \row + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \o \l maximumRadius: 8 + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::Glow::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-huesaturation.qdoc b/doc/src/qtgraphicaleffects-huesaturation.qdoc new file mode 100644 index 0000000..82767fd --- /dev/null +++ b/doc/src/qtgraphicaleffects-huesaturation.qdoc @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass HueSaturation + \inqmlmodule QtGraphicalEffects + \brief Alters the source item colors in the HSL color space. + + HueSaturation is similar to the \l Colorize effect, but the hue and + saturation property values are handled differently. The HueSaturation effect + always shifts the hue, saturation, and lightness from the original, instead + of setting them. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image HueSaturation_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/HueSaturation-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the memory consumption of the the + source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::HueSaturation::source + + This property defines the source item that provides the source pixels for + the effect. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::HueSaturation::hue + + This property defines the hue value which is added to the source hue value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \o Output examples with different hue values + \o + \o + \row + \o \image HueSaturation_hue1.png + \o \image HueSaturation_hue2.png + \o \image HueSaturation_hue3.png + \row + \o \bold { hue: -0.3 } + \o \bold { hue: 0.0 } + \o \bold { hue: 0.3 } + \row + \o \l saturation: 0 + \o \l saturation: 0 + \o \l saturation: 0 + \row + \o \l lightness: 0 + \o \l lightness: 0 + \o \l lightness: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::HueSaturation::saturation + + This property defines the saturation value value which is added to the + source saturation value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \o Output examples with different saturation values + \o + \o + \row + \o \image HueSaturation_saturation1.png + \o \image HueSaturation_saturation2.png + \o \image HueSaturation_saturation3.png + \row + \o \bold { saturation: -0.8 } + \o \bold { saturation: 0.0 } + \o \bold { saturation: 1.0 } + \row + \o \l hue: 0 + \o \l hue: 0 + \o \l hue: 0 + \row + \o \l lightness: 0 + \o \l lightness: 0 + \o \l lightness: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::HueSaturation::lightness + + This property defines the lightness value which is added to the source + saturation value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \o Output examples with different lightness values + \o + \o + \row + \o \image HueSaturation_lightness1.png + \o \image HueSaturation_lightness2.png + \o \image HueSaturation_lightness3.png + \row + \o \bold { lightness: -0.5 } + \o \bold { lightness: 0.0 } + \o \bold { lightness: 0.5 } + \row + \o \l hue: 0 + \o \l hue: 0 + \o \l hue: 0 + \row + \o \l saturation: 0 + \o \l saturation: 0 + \o \l saturation: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::HueSaturation::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ + diff --git a/doc/src/qtgraphicaleffects-lineargradient.qdoc b/doc/src/qtgraphicaleffects-lineargradient.qdoc new file mode 100644 index 0000000..834eb37 --- /dev/null +++ b/doc/src/qtgraphicaleffects-lineargradient.qdoc @@ -0,0 +1,257 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass LinearGradient + \inqmlmodule QtGraphicalEffects + \brief Draws a linear gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the given start point and end to the given end point. + + \table + \header + \o Effect applied + \row + \o \image LinearGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/LinearGradient-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small, the effect uses only a 1x256 + pixels size image to store the temporary gradient image. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect in 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o less than 0.1 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o ShaderEffectSource for maskSource (if used) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty Gradient QtGraphicalEffects::LinearGradient::gradient + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors are specified as a set of GradientStop child items, each of which + defines a position on the gradient + from 0.0 to 1.0 and a color. The position of each GradientStop is defined by + the position property, and the color is definded by the color property. + + \table + \header + \o Output examples with different gradient values + \o + \o + \row + \o \image LinearGradient_gradient1.png + \o \image LinearGradient_gradient2.png + \o \image LinearGradient_gradient3.png + \row + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } +} + \endcode + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } +} + \endcode + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } +} + \endcode + \row + \o \l start: Qt.point(0, 0) + \o \l start: Qt.point(0, 0) + \o \l start: Qt.point(0, 0) + \row + \o \l end: Qt.point(300, 300) + \o \l end: Qt.point(300, 300) + \o \l end: Qt.point(300, 300) + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::LinearGradient::maskSource + + This property defines the item that is going to be used as the mask. The + mask gets rendered into the intermediate pixel buffer and the alpha values + from the result are used to determine the gradient's pixels visibility in + the display. + The default value for maskSource is undefined and in that case no mask is + used. + + \table + \header + \o Output examples with different maskSource values + \o + \o + \row + \o \image LinearGradient_maskSource1.png + \o \image LinearGradient_maskSource2.png + \row + \o \bold { maskSource: undefined } + \o \bold { maskSource: QQuickShaderEffectSource(0xa090ba8) } + \row + \o \l start: Qt.point(0, 0) + \o \l start: Qt.point(0, 0) + \row + \o \l end: Qt.point(300, 300) + \o \l end: Qt.point(300, 300) + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::LinearGradient::start + + This property defines the starting point where the color at gradient + position of 0.0 is rendered. Colors at larger position values are rendered + linearly towards the end point. The point is given in pixels and the default + value is Qt.point(0, 0). + Setting the default values for the start and \l end results in a full height + linear gradient on the y-axis. + + \table + \header + \o Output examples with different start values + \o + \o + \row + \o \image LinearGradient_start1.png + \o \image LinearGradient_start2.png + \o \image LinearGradient_start3.png + \row + \o \bold { start: QPoint(0, 0) } + \o \bold { start: QPoint(150, 150) } + \o \bold { start: QPoint(300, 0) } + \row + \o \l end: QPoint(300, 300) + \o \l end: QPoint(300, 300) + \o \l end: QPoint(300, 300) + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::LinearGradient::end + + This property defines the ending point where the color at gradient position + of 1.0 is rendered. Colors at smaller position values are rendered linearly + towards the start point. The point is given in pixels and the default value + is Qt.point(0, height). + Setting the default values for the \l start and end results in a full height + linear gradient on the y-axis. + + \table + \header + \o Output examples with different end values + \o + \o + \row + \o \image LinearGradient_end1.png + \o \image LinearGradient_end2.png + \o \image LinearGradient_end3.png + \row + \o \bold { end: Qt.point(300, 300) } + \o \bold { end: Qt.point(150, 150) } + \o \bold { end: Qt.point(300, 0) } + \row + \o \l start: Qt.point(0, 0) + \o \l start: Qt.point(0, 0) + \o \l start: Qt.point(0, 0) + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::LinearGradient::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-opacitymask.qdoc b/doc/src/qtgraphicaleffects-opacitymask.qdoc new file mode 100644 index 0000000..9eeddf0 --- /dev/null +++ b/doc/src/qtgraphicaleffects-opacitymask.qdoc @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass OpacityMask + \inqmlmodule QtGraphicalEffects + \brief Masks the source item with another item. + + \table + \header + \o Source + \o MaskSource + \o Effect applied + \row + \o \image Original_bug.png + \o \image OpacityMask_mask.png + \o \image OpacityMask_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/OpacityMask-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect in 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o ShaderEffectSource for maskSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::OpacityMask::source + + This property defines the source item that is going to be masked. + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::OpacityMask::maskSource + + This property defines the item that is going to be used as the mask. The mask item gets rendered into an intermediate pixel buffer and + the alpha values from the result are used to determine the source item's pixels visibility in the display. + + \table + \header + \o Original + \o Mask + \o Effect applied + \row + \o \image Original_bug.png + \o \image OpacityMask_mask.png + \o \image OpacityMask_bug.png + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::OpacityMask::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-radialblur.qdoc b/doc/src/qtgraphicaleffects-radialblur.qdoc new file mode 100644 index 0000000..9c92127 --- /dev/null +++ b/doc/src/qtgraphicaleffects-radialblur.qdoc @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass RadialBlur + \inqmlmodule QtGraphicalEffects + \brief Applies directional blur in a circular direction around the items center + point. + + Effect creates perceived impression that the source item appears to be rotating + to the direction of the blur. + + Other available motionblur effects are + \l {QtGraphicalEffects::ZoomBlur} {ZoomBlur} and + \l {QtGraphicalEffects::DirectionalBlur} {DirectionalBlur}. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly.png + \o \image RadialBlur_butterfly.png + \endtable + + \chapter Example Usage + + The following example shows how to apply the effect. + \snippet snippets/RadialBlur-example.qml example + + \chapter Memory consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally + creates one ShaderEffectSource item per source. Enabling the effect cache + increases the memory consumption because an extra buffer is allocated for + the effect output. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect (32bpp colors) + \o + \row + \o Effect internal + \o 0.0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::RadialBlur::source + + This property defines the source item that is going to be blurred. + +*/ + + +/*! + \qmlproperty real QtGraphicalEffects::RadialBlur::samples + + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RadialBlur::angle + + This property defines the direction for the blur and at the same + time the level of blurring. The larger the angle, the more the result + becomes blurred. The quality of the blur depends on \l samples property. + If angle value is large, more samples are needed to keep the visual quality + at high level. + + Allowed values are between -360.0 and 360.0. + By default the property is set to \c 0.0. + + \table + \header + \o Output examples with different angle values + \o + \o + \row + \o \image RadialBlur_angle1.png + \o \image RadialBlur_angle2.png + \o \image RadialBlur_angle3.png + \row + \o \bold { angle: 0.0 } + \o \bold { angle: 15.0 } + \o \bold { angle: 30.0 } + \row + \o \l samples: 32 + \o \l samples: 32 + \o \l samples: 32 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RadialBlur::horizontalOffset + \qmlproperty real QtGraphicalEffects::RadialBlur::verticalOffset + + These properties define the offset in pixels for the perceived center point + of the rotation. + + Allowed values are between -inf and inf. + By default these properties are set to \c 0. + + \table + \header + \o Output examples with different horizontalOffset values + \o + \o + \row + \o \image RadialBlur_horizontalOffset1.png + \o \image RadialBlur_horizontalOffset2.png + \o \image RadialBlur_horizontalOffset3.png + \row + \o \bold { horizontalOffset: 75.0 } + \o \bold { horizontalOffset: 0.0 } + \o \bold { horizontalOffset: -75.0 } + \row + \o \l samples: 32 + \o \l samples: 32 + \o \l samples: 32 + \row + \o \l angle: 20 + \o \l angle: 20 + \o \l angle: 20 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::RadialBlur::transparentBorder + + This property defines the blur near the edges of the item, where the pixel + blurring is affected by the pixels just outside the source. + + Setting this property to \c false, interprets the pixels outside the item + according to the OpenGL clamp-to-edge mode. If the source is Image, the pixels + are interpreted according to the Image::fillMode property. If the source is + ShaderEffectSource, the pixels are interpreted according to the + ShaderEffectSource::wrapMode property. + + Setting this property to \c true, interprets the pixels outside the item to + be transparent. This behavior is similar to the OpenGL clamp-to-border + extension. The blur is expanded slightly outside the effect item area. + + By default, the property is set to \c false. + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::RadialBlur::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-radialgradient.qdoc b/doc/src/qtgraphicaleffects-radialgradient.qdoc new file mode 100644 index 0000000..48a1ef0 --- /dev/null +++ b/doc/src/qtgraphicaleffects-radialgradient.qdoc @@ -0,0 +1,341 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass RadialGradient + \inqmlmodule QtGraphicalEffects + \brief Draws a radial gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the middle of the item and end at the borders. + + \table + \header + \o Effect applied + \row + \o \image RadialGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/RadialGradient-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small, the effect uses only a 1x256 + pixels size image to store temporary gradient image. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + The ShaderEffectSource memory consumption is approximately the same as the + memory consumption of the the source item area in pixels. Enabling the + effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o less than 0.1 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o ShaderEffectSource for maskSource (if used) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::RadialGradient::maskSource + + This property defines the item that is going to be used as the mask. Mask + item gets rendered into an intermediate pixel buffer and the alpha values + from the result are used to determine the gradient's pixels visibility in + the display. + The default value for maskSource is undefined and in that case no mask is + used. + + \table + \header + \o Output examples with different maskSource values + \o + \o + \row + \o \image RadialGradient_maskSource1.png + \o \image RadialGradient_maskSource2.png + \row + \o \bold { maskSource: undefined } + \o \bold { maskSource: Image { source: images/butterfly.png } } + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l horizontalRadius: 300 + \o \l horizontalRadius: 300 + \row + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \row + \o \l angle: 0 + \o \l angle: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RadialGradient::angle + + This property defines the rotation of the gradient around its center point. + The rotation is only visible when the \l horizontalRadius and \l + verticalRadius properties are not equal. The angle is given in degrees and + the default value is \c 0. + + \table + \header + \o Output examples with different angle values + \o + \o + \row + \o \image RadialGradient_angle1.png + \o \image RadialGradient_angle2.png + \o \image RadialGradient_angle3.png + \row + \o \bold { angle: 0 } + \o \bold { angle: 45 } + \o \bold { angle: 90 } + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l horizontalRadius: 100 + \o \l horizontalRadius: 100 + \o \l horizontalRadius: 100 + \row + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RadialGradient::horizontalOffset + \qmlproperty real QtGraphicalEffects::RadialGradient::verticalOffset + + The HorizontalOffset and verticalOffset properties define the offset in + pixels for the center point of the gradient compared to the item center. + + The values range from -inf to inf. By default, these properties are set to \c 0. + + \table + \header + \o Output examples with different horizontalOffset values + \o + \o + \row + \o \image RadialGradient_horizontalOffset1.png + \o \image RadialGradient_horizontalOffset2.png + \o \image RadialGradient_horizontalOffset3.png + \row + \o \bold { horizontalOffset: -150 } + \o \bold { horizontalOffset: 0 } + \o \bold { horizontalOffset: 150 } + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l horizontalRadius: 300 + \o \l horizontalRadius: 300 + \o \l horizontalRadius: 300 + \row + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \row + \o \l angle: 0 + \o \l angle: 0 + \o \l angle: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RadialGradient::horizontalRadius + \qmlproperty real QtGraphicalEffects::RadialGradient::verticalRadius + + The HorizontalRadius and verticalRadius properties define the shape and size + of the radial gradient. If the radiuses are equal, the shape of the gradient + is a circle. If the horizontal and vertical radiuses differ, the shape is + elliptical. The radiuses are given in pixels. + + The value ranges from -inf to inf. By default, horizontalRadius is bound to + width and verticalRadius is bound to height. + + \table + \header + \o Output examples with different horizontalRadius values + \o + \o + \row + \o \image RadialGradient_horizontalRadius1.png + \o \image RadialGradient_horizontalRadius2.png + \row + \o \bold { horizontalRadius: 300 } + \o \bold { horizontalRadius: 100 } + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \row + \o \l angle: 0 + \o \l angle: 0 + \row + \o \l gradient: QQuickGradient(0xa05fb10) + \o \l gradient: QQuickGradient(0xa05fb10) + \endtable + +*/ + +/*! + \qmlproperty Gradient QtGraphicalEffects::RadialGradient::gradient + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors are specified as a set of GradientStop child items, each of which + defines a position on the gradient from 0.0 to 1.0 and a color. The position + of each GradientStop is defined by setting the position property. The color + is defined by setting the color property. + + \table + \header + \o Output examples with different gradient values + \o + \o + \row + \o \image RadialGradient_gradient1.png + \o \image RadialGradient_gradient2.png + \o \image RadialGradient_gradient3.png + \row + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } +} + \endcode + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } +} + \endcode + \o \bold {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } +} + \endcode + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \row + \o \l horizontalRadius: 300 + \o \l horizontalRadius: 300 + \o \l horizontalRadius: 300 + \row + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \o \l verticalRadius: 300 + \row + \o \l angle: 0 + \o \l angle: 0 + \o \l angle: 0 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::RadialGradient::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-rectangularglow.qdoc b/doc/src/qtgraphicaleffects-rectangularglow.qdoc new file mode 100644 index 0000000..3f070ab --- /dev/null +++ b/doc/src/qtgraphicaleffects-rectangularglow.qdoc @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass RectangularGlow + \inqmlmodule QtGraphicalEffects + \brief Generates a blurred and colorized rectangle, which gives + the impression that the source is glowing. + + This effect is intended to have good performance. The shape of the glow is + limited to a rectangle with a custom corner radius. For situations where + custom shapes are required, consider \l {QtGraphicalEffects::Glow} {Glow} or \l {QtGraphicalEffects::FastGlow} {FastGlow} effects. + + \table + \header + \o Source + \o Effect applied + \row + \o \image RectangularGlow_original.png + \o \image RectangularGlow_applied.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/RectangularGlow-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is small. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0.0 MB + \row + \o TOTAL (max) + \o 0.0 MB + \endtable + +*/ + +/*! + \qmlproperty color QtGraphicalEffects::RectangularGlow::color + + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \o Output examples with different color values + \o + \o + \row + \o \image RectangularGlow_color1.png + \o \image RectangularGlow_color2.png + \o \image RectangularGlow_color3.png + \row + \o \bold { color: #ffffff } + \o \bold { color: #55ff55 } + \o \bold { color: #5555ff } + \row + \o \l glowRadius: 20 + \o \l glowRadius: 20 + \o \l glowRadius: 20 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \row + \o \l cornerRadius: 25 + \o \l cornerRadius: 25 + \o \l cornerRadius: 25 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RectangularGlow::glowRadius + + This property defines how many pixels outside the item area are reached by + the glow. + + The value ranges from 0.0 (no glow) to inf (infinite glow). By default, the + property is set to \c 0.0. + + \table + \header + \o Output examples with different glowRadius values + \o + \o + \row + \o \image RectangularGlow_glowRadius1.png + \o \image RectangularGlow_glowRadius2.png + \o \image RectangularGlow_glowRadius3.png + \row + \o \bold { glowRadius: 10 } + \o \bold { glowRadius: 20 } + \o \bold { glowRadius: 40 } + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \row + \o \l cornerRadius: 25 + \o \l cornerRadius: 25 + \o \l cornerRadius: 25 + \endtable + +*/ + +/*! + \qmlproperty color QtGraphicalEffects::RectangularGlow::spread + + This property defines how large part of the glow color is strenghtened near + the source edges. + + The value ranges from 0.0 (no strenght increase) to 1.0 (maximum strenght increase). By default, the property is set to \c 0.0. + + \table + \header + \o Output examples with different spread values + \o + \o + \row + \o \image RectangularGlow_spread1.png + \o \image RectangularGlow_spread2.png + \o \image RectangularGlow_spread3.png + \row + \o \bold { spread: 0.0 } + \o \bold { spread: 0.5 } + \o \bold { spread: 1.0 } + \row + \o \l glowRadius: 20 + \o \l glowRadius: 20 + \o \l glowRadius: 20 + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \row + \o \l cornerRadius: 25 + \o \l cornerRadius: 25 + \o \l cornerRadius: 25 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RectangularGlow::cornerRadius + + This property defines the corner radius that is used to draw a glow with + rounded corners. + + The value ranges from 0.0 to half of the effective width or height of + the glow, whichever is smaller. This can be calculated with: \c min(width, height) / 2.0 + glowRadius + + By default, the property is bound to glowRadius property. The glow behaves + as if the rectangle was blurred when adjusting the glowRadius property. + + \table + \header + \o Output examples with different cornerRadius values + \o + \o + \row + \o \image RectangularGlow_cornerRadius1.png + \o \image RectangularGlow_cornerRadius2.png + \o \image RectangularGlow_cornerRadius3.png + \row + \o \bold { cornerRadius: 0 } + \o \bold { cornerRadius: 25 } + \o \bold { cornerRadius: 50 } + \row + \o \l glowRadius: 20 + \o \l glowRadius: 20 + \o \l glowRadius: 20 + \row + \o \l spread: 0 + \o \l spread: 0 + \o \l spread: 0 + \row + \o \l color: #ffffff + \o \l color: #ffffff + \o \l color: #ffffff + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::RectangularGlow::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-recursiveblur.qdoc b/doc/src/qtgraphicaleffects-recursiveblur.qdoc new file mode 100644 index 0000000..38f6194 --- /dev/null +++ b/doc/src/qtgraphicaleffects-recursiveblur.qdoc @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass RecursiveBlur + \inqmlmodule QtGraphicalEffects + \brief Blurs repeatedly, providing a strong blur effect. + + The RecursiveBlur effect softens the image by blurring it with an algorithm + that uses a recursive feedback loop to blur the source multiple times. The + effect may give more blurry results than \l {QtGraphicalEffects::GaussianBlur} {GaussianBlur} or \l FastBlur, + but the result is produced asynchronously and takes more time. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_bug.png + \o \image RecursiveBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/RecursiveBlur-example.qml example + + \section1 Memory Consumption + + The internal memory consumption is approximately twice the memory + consumption of the the source item area in pixels. + The effect uses one double-buffered ShaderEffectSource to store the result + between iterations. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for an effect with a size of 640x480 pixels with 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 2.4 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 4.8 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::RecursiveBlur::source + + This property defines the source item that is going to be blurred. + +*/ +/*! + \qmlproperty real QtGraphicalEffects::RecursiveBlur::radius + + This property defines the distance of neighboring pixels which influence + the blurring of individual pixels. A larger radius provides better quality, + but is slower to render. + + \bold Note: The radius value in this effect is not intended to be changed or + animated frequently. The correct way to use it is to set the correct value + and keep it unchanged for the whole duration of the iterative blur sequence. + + The value ranges from (no blur) to 16.0 (maximum blur step). By default, the + property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different radius values + \o + \o + \row + \o \image RecursiveBlur_radius1.png + \o \image RecursiveBlur_radius2.png + \o \image RecursiveBlur_radius3.png + \row + \o \bold { radius: 2.5 } + \o \bold { radius: 4.5 } + \o \bold { radius: 7.5 } + \row + \o \l loops: 20 + \o \l loops: 20 + \o \l loops: 20 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::RecursiveBlur::transparentBorder + + This property defines the blur behavior near the edges of teh item, where + the pixel blurring is affected by the pixels utside the source edges. + + If the transparentBorder property is set to \c false, the pixels outside the + item are interpreted according to the ShaderEffectSource wrapMode property. + If the source item is Image, the pixels are intrepreted according to the + fillMode property. + + If the property is set to \c true, the pixels outside the item are + interpreted to be transparent, which is similar to OpenGL clamp-to-border + extension. The blur is expanded slightly outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \o Output examples with different transparentBorder values + \o + \o + \row + \o \image RecursiveBlur_transparentBorder1.png + \o \image RecursiveBlur_transparentBorder2.png + \row + \o \bold { transparentBorder: false } + \o \bold { transparentBorder: true } + \row + \o \l loops: 20 + \o \l loops: 20 + \row + \o \l radius: 7.5 + \o \l radius: 7.5 + \endtable + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::RecursiveBlur::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::RecursiveBlur::progress + + This property holds the progress of asynchronous source blurring process, from 0.0 (nothing blurred) to 1.0 (finished). + +*/ + +/*! + \qmlproperty int QtGraphicalEffects::RecursiveBlur::loops + + This property defines the amount of blur iterations that are going to be + performed for the source. When the property changes, the iterative blurring + process starts. If the value is decreased or if the value changes from zero + to non-zero, a snapshot is taken from the source. The snapshot is used as a + starting point for the process. + + The iteration loop tries to run as fast as possible. The speed might be + limited by the VSYNC or the time needed for one blur step, or both. + Sometimes it may be desirable to perform the blurring with a slower pace. In + that case, it may be convenient to control the property with Animation which + increases the value. + + The value ranges from 0 to inf. By default, the property is set to \c 0. + + \table + \header + \o Output examples with different loops values + \o + \o + \row + \o \image RecursiveBlur_loops1.png + \o \image RecursiveBlur_loops2.png + \o \image RecursiveBlur_loops3.png + \row + \o \bold { loops: 4 } + \o \bold { loops: 20 } + \o \bold { loops: 70 } + \row + \o \l radius: 7.5 + \o \l radius: 7.5 + \o \l radius: 7.5 + \endtable + +*/ diff --git a/doc/src/qtgraphicaleffects-thresholdmask.qdoc b/doc/src/qtgraphicaleffects-thresholdmask.qdoc new file mode 100644 index 0000000..549c9f5 --- /dev/null +++ b/doc/src/qtgraphicaleffects-thresholdmask.qdoc @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass ThresholdMask + \inqmlmodule QtGraphicalEffects + \brief Masks the source item with another item and applies a threshold value. + + The masking behavior can be controlled with the \l threshold value for the + mask pixels. + + \table + \header + \o Source + \o MaskSource + \o Effect applied + \row + \o \image Original_bug.png + \o \image ThresholdMask_mask.png + \o \image ThresholdMask_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/ThresholdMask-example.qml example + + \section1 Memory Consumption + + The memory consumption is small. + The internal memory consumption is approximately the same as the memory + consumption of the the source item area in pixels. + If source item is not Image or ShaderEffectSource, then effect internally creates one ShaderEffectSource item per source. + Enabling the effect cache increases the memory consumption. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect in 32 bits per pixel (bpp) + \o + \row + \o Effect internal + \o 0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o ShaderEffectSource for maskSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 3.6 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::ThresholdMask::source + + This property defines the source item that is going to be masked. + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::ThresholdMask::maskSource + + This property defines the item that is going to be used as the mask. Mask item gets rendered into an intermediate pixel buffer and + the alpha values from the result are used to determine the source item's pixels visibility in the display. + + \table + \header + \o Original + \o Mask + \o Effect applied + \row + \o \image Original_bug.png + \o \image ThresholdMask_mask.png + \o \image ThresholdMask_bug.png + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ThresholdMask::threshold + + This property defines a threshold value for the mask pixels. The mask pixels that have an alpha value + below this property are used to completely mask away the corresponding pixels from the source item. + The mask pixels that have a higher alpha value are used to alphablend the source item to the display. + + The value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By default, the property is set to \c 0.0. + + \table + \header + \o Output examples with different threshold values + \o + \o + \row + \o \image ThresholdMask_threshold1.png + \o \image ThresholdMask_threshold2.png + \o \image ThresholdMask_threshold3.png + \row + \o \bold { threshold: 0.0 } + \o \bold { threshold: 0.5 } + \o \bold { threshold: 0.7 } + \row + \o \l spread: 0.2 + \o \l spread: 0.2 + \o \l spread: 0.2 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ThresholdMask::spread + + This property defines the smoothness of the mask edges near the \l threshold + alpha value. Setting spread to 0.0 uses mask normally with the specified + threshold. Setting higher spread values softens the transition from the + transparent mask pixels towards opaque mask pixels by adding interpolated + values between them. + + The value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge). By default, the property is set to \c 0.0. + + \table + \header + \o Output examples with different spread values + \o + \o + \row + \o \image ThresholdMask_spread1.png + \o \image ThresholdMask_spread2.png + \o \image ThresholdMask_spread3.png + \row + \o \bold { spread: 0.0 } + \o \bold { spread: 0.2 } + \o \bold { spread: 0.8 } + \row + \o \l threshold: 0.4 + \o \l threshold: 0.4 + \o \l threshold: 0.4 + \endtable + +*/ + + +/*! + \qmlproperty bool QtGraphicalEffects::ThresholdMask::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects-zoomblur.qdoc b/doc/src/qtgraphicaleffects-zoomblur.qdoc new file mode 100644 index 0000000..13d7685 --- /dev/null +++ b/doc/src/qtgraphicaleffects-zoomblur.qdoc @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlclass ZoomBlur + \inqmlmodule QtGraphicalEffects + \brief Applies directional blur effect towards source items center point. + + Effect creates perceived impression that the source item appears to be + moving towards the center point in Z-direction or that the camera appears + to be zooming rapidly. Other available motion blur effects are + \l {QtGraphicalEffects::DirectionalBlur} {DirectionalBlur} + and \l {QtGraphicalEffects::RadialBlur} {RadialBlur}. + + \table + \header + \o Source + \o Effect applied + \row + \o \image Original_butterfly.png + \o \image ZoomBlur_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet snippets/ZoomBlur-example.qml example + + \section1 Memory consumption + + The internal memory consumption is small. + If source item is not Image or ShaderEffectSource, then effect internally + creates one ShaderEffectSource item per source. Enabling the effect cache + increases the memory consumption because an extra buffer is allocated for + the effect output. + + \table + \header + \o Estimated memory usage for 640x480 pixels size effect (32bpp colors) + \o + \row + \o Effect internal + \o 0.0 MB + \row + \o ShaderEffectSource (if used) + \o 1.2 MB + \row + \o Effect internal cache (if enabled) + \o 1.2 MB + \row + \o TOTAL (max) + \o 2.4 MB + \endtable + +*/ + +/*! + \qmlproperty variant QtGraphicalEffects::ZoomBlur::source + + This property defines the source item that is going to be blurred. + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ZoomBlur::length + + This property defines the maximum perceived amount of movement for each + pixel. The amount is smaller near the center and reaches the specified + value at the edges. + + The quality of the blur depends on \l samples property. If length value is + large, more samples are needed to keep the visual quality at high level. + + The value ranges from 0.0 to inf. + By default the property is set to \c 0.0 (no blur). + + \table + \header + \o Output examples with different length values + \o + \o + \row + \o \image ZoomBlur_length1.png + \o \image ZoomBlur_length2.png + \o \image ZoomBlur_length3.png + \row + \o \bold { length: 0.0 } + \o \bold { length: 32.0 } + \o \bold { length: 48.0 } + \row + \o \l samples: 32 + \o \l samples: 32 + \o \l samples: 32 + \row + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \o \l horizontalOffset: 0 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ZoomBlur::samples + + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + +*/ + +/*! + \qmlproperty real QtGraphicalEffects::ZoomBlur::horizontalOffset + \qmlproperty real QtGraphicalEffects::ZoomBlur::verticalOffset + + These properties define an offset in pixels for the blur direction center + point. + + The values range from -inf to inf. By default these properties are set + to \c 0. + + \table + \header + \o Output examples with different horizontalOffset values + \o + \o + \row + \o \image ZoomBlur_horizontalOffset1.png + \o \image ZoomBlur_horizontalOffset2.png + \o \image ZoomBlur_horizontalOffset3.png + \row + \o \bold { horizontalOffset: 100.0 } + \o \bold { horizontalOffset: 0.0 } + \o \bold { horizontalOffset: -100.0 } + \row + \o \l samples: 32 + \o \l samples: 32 + \o \l samples: 32 + \row + \o \l length: 32 + \o \l length: 32 + \o \l length: 32 + \row + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \o \l verticalOffset: 0 + \endtable + +*/ + + +/*! + \qmlproperty bool QtGraphicalEffects::ZoomBlur::transparentBorder + + This property defines the blur near the edges of the item, where the pixel + blurring is affected by the pixels just outside the source. + + Setting this property to \c false, interprets the pixels outside the item + according to the OpenGL clamp-to-edge mode. If the source is Image, the pixels + are interpreted according to the Image::fillMode property. If the source is + ShaderEffectSource, the pixels are interpreted according to the + ShaderEffectSource::wrapMode property. + + Setting this property to \c true, interprets the pixels outside the item to + be transparent. This behavior is similar to the OpenGL clamp-to-border + extension. The blur is expanded slightly outside the effect item area. + + By default, the property is set to \c false. + +*/ + +/*! + \qmlproperty bool QtGraphicalEffects::ZoomBlur::cached + + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + +*/ diff --git a/doc/src/qtgraphicaleffects.qdoc b/doc/src/qtgraphicaleffects.qdoc new file mode 100644 index 0000000..8efe348 --- /dev/null +++ b/doc/src/qtgraphicaleffects.qdoc @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\title Qt Graphical Effects +\page qml-graphicaleffects-index.html +\brief Qt Graphical Effects module is a Qt Quick Add-On module. + +The Qt Graphical Effects module provides a set of QML components for building +visually impressive user interfaces. You can implement the effects inside QML applications with QML and GLSL. + +\section1 Getting started +Install the Qt Graphical Effects module, and simply add the following import statement to your .qml file: +\snippet snippets/Blend-example.qml import + +\section1 Elements + +The following list presents the functional division of components that are part of Qt Graphical Effects: + +Blend +\list +\o \l {QtGraphicalEffects::Blend}{Blend} - merges two source items by using a blend mode +\endlist + +Color +\list +\o \l {QtGraphicalEffects::BrightnessContrast}{BrightnessContrast} - adjusts brightness and contrast +\o \l {QtGraphicalEffects::Colorize}{Colorize} - sets color in the HSL color space +\o \l {QtGraphicalEffects::ColorOverlay}{ColorOverlay} - applies a color layer +\o \l {QtGraphicalEffects::Desaturate}{Desaturate} - reduces color saturation +\o \l {QtGraphicalEffects::GammaAdjust}{GammaAdjust} - adjusts luminance +\o \l {QtGraphicalEffects::HueSaturation}{HueSaturation} - adjusts colors in the HSL color space +\endlist + +Gradient +\list +\o \l {QtGraphicalEffects::ConicalGradient}{ConicalGradient} - draws a conical gradient +\o \l {QtGraphicalEffects::LinearGradient}{LinearGradient} - draws a linear gradient +\o \l {QtGraphicalEffects::RadialGradient}{RadialGradient} - draws a radial gradient +\endlist + +Distortion +\list +\o \l {QtGraphicalEffects::Displace}{Displace} - moves the pixels of the source item according to the specified displacement source +\endlist + +Drop Shadow +\list +\o \l {QtGraphicalEffects::DropShadow}{DropShadow} - draws a higher quality drop shadow +\o \l {QtGraphicalEffects::FastDropShadow}{FastDropShadow} - draws a fast drop shadow +\endlist + +Blur +\list +\o \l {QtGraphicalEffects::FastBlur}{FastBlur} - applies a fast blur effect +\o \l {QtGraphicalEffects::GaussianBlur}{GaussianBlur} - applies a higher quality blur effect +\o \l {QtGraphicalEffects::RecursiveBlur}{RecursiveBlur} - blurs repeatedly, providing a strong blur effect +\endlist + +Motion Blur +\list +\o \l {QtGraphicalEffects::DirectionalBlur}{DirectionalBlur} - applies a directional motion blur effect +\o \l {QtGraphicalEffects::RadialBlur}{RadialBlur} - applies a radial motion blur effect +\o \l {QtGraphicalEffects::ZoomBlur}{ZoomBlur} - applies a zoom motion blur effect +\endlist + +Glow +\list +\o \l {QtGraphicalEffects::FastGlow}{FastGlow} - draws a fast glow effect +\o \l {QtGraphicalEffects::Glow}{Glow} - draws a higher quality glow effect +\o \l {QtGraphicalEffects::RectangularGlow}{RectangularGlow} - draws a rectangular glow effect +\endlist + +Mask +\list +\o \l {QtGraphicalEffects::OpacityMask}{OpacityMask} - masks the source item with another item +\o \l {QtGraphicalEffects::ThresholdMask}{ThresholdMask} - masks the source item with another item and applies a threshold value +\endlist + +\section1 Examples + +Will be added here later. + +*/ diff --git a/doc/src/snippets/Blend-example.qml b/doc/src/snippets/Blend-example.qml new file mode 100644 index 0000000..26da3c3 --- /dev/null +++ b/doc/src/snippets/Blend-example.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +//! [import] +import QtGraphicalEffects 0.1 +//! [import] + +Item { + width: 300 + height: 300 + + Image { + id: blendSourceItem1 + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Image { + id: blendSourceItem2 + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Blend { + anchors.fill: blendSourceItem1 + backgroundSource: blendSourceItem1 + foregroundSource: blendSourceItem2 + mode: "screen" + } +} +//! [example] + diff --git a/doc/src/snippets/BrightnessContrast-example.qml b/doc/src/snippets/BrightnessContrast-example.qml new file mode 100644 index 0000000..fba744f --- /dev/null +++ b/doc/src/snippets/BrightnessContrast-example.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: brightnessContrastSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + BrightnessContrast { + anchors.fill: brightnessContrastSourceItem + source: brightnessContrastSourceItem + brightness: -0.2 + contrast: 0.3 + } +} +//! [example] diff --git a/doc/src/snippets/ColorOverlay-example.qml b/doc/src/snippets/ColorOverlay-example.qml new file mode 100644 index 0000000..a32572e --- /dev/null +++ b/doc/src/snippets/ColorOverlay-example.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: colorOverlaySourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + ColorOverlay { + anchors.fill: colorOverlaySourceItem + source: colorOverlaySourceItem + color: "#80800000" + } +} +//! [example] diff --git a/doc/src/snippets/Colorize-example.qml b/doc/src/snippets/Colorize-example.qml new file mode 100644 index 0000000..d9b19d0 --- /dev/null +++ b/doc/src/snippets/Colorize-example.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: colorizeSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Colorize { + anchors.fill: colorizeSourceItem + source: colorizeSourceItem + hue: 0.5 + saturation: 0.5 + lightness: -0.2 + } +} +//! [example] diff --git a/doc/src/snippets/ConicalGradient-example.qml b/doc/src/snippets/ConicalGradient-example.qml new file mode 100644 index 0000000..98d28d5 --- /dev/null +++ b/doc/src/snippets/ConicalGradient-example.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + ConicalGradient { + anchors.fill: parent + angle: 45.0 + gradient: Gradient { + GradientStop { position: 0.0; color: "#45071C" } + GradientStop { position: 1.0; color: "#FDC000" } + } + } +} +//! [example] diff --git a/doc/src/snippets/Desaturate-example.qml b/doc/src/snippets/Desaturate-example.qml new file mode 100644 index 0000000..884e48b --- /dev/null +++ b/doc/src/snippets/Desaturate-example.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: desaturateSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Desaturate { + anchors.fill: desaturateSourceItem + source: desaturateSourceItem + desaturation: 0.8 + } +} +//! [example] diff --git a/doc/src/snippets/DirectionalBlur-example.qml b/doc/src/snippets/DirectionalBlur-example.qml new file mode 100644 index 0000000..84e1b21 --- /dev/null +++ b/doc/src/snippets/DirectionalBlur-example.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: directionalBlurSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + DirectionalBlur { + anchors.fill: directionalBlurSourceItem + source: directionalBlurSourceItem + angle: 90 + length: 32 + samples: 32 + } +} +//! [example] diff --git a/doc/src/snippets/Displace-example.qml b/doc/src/snippets/Displace-example.qml new file mode 100644 index 0000000..cde1394 --- /dev/null +++ b/doc/src/snippets/Displace-example.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: displacementSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Rectangle { + id: displacementMapItem + color: Qt.rgba(0.5, 0.5, 1.0, 1.0) + anchors.fill: parent + Image { + anchors.centerIn: parent + source: "images/displacementmap.png" + sourceSize: Qt.size(parent.width/2, parent.height/2) + smooth: true + } + } + + Displace { + anchors.fill: displacementSourceItem + source: displacementSourceItem + displacementSource: ShaderEffectSource { hideSource: true; smooth: true; sourceItem: displacementMapItem; visible: false } + displacement: 0.1 + } +} +//! [example] diff --git a/doc/src/snippets/DropShadow-example.qml b/doc/src/snippets/DropShadow-example.qml new file mode 100644 index 0000000..18e4c76 --- /dev/null +++ b/doc/src/snippets/DropShadow-example.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Rectangle { + anchors.fill: parent + } + + DropShadow { + anchors.fill: dropShadowSourceItem + horizontalOffset: 3 + verticalOffset: 3 + radius: 8.0 + maximumRadius: 8.0 + color: "#80000000" + source: dropShadowSourceItem + } + + Image { + id: dropShadowSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + } +} +//! [example] diff --git a/doc/src/snippets/FastBlur-example.qml b/doc/src/snippets/FastBlur-example.qml new file mode 100644 index 0000000..e154d4d --- /dev/null +++ b/doc/src/snippets/FastBlur-example.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: fastBlurSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + FastBlur { + anchors.fill: fastBlurSourceItem + source: fastBlurSourceItem + blur: 0.5 + } +} +//! [example] diff --git a/doc/src/snippets/FastDropShadow-example.qml b/doc/src/snippets/FastDropShadow-example.qml new file mode 100644 index 0000000..d928aee --- /dev/null +++ b/doc/src/snippets/FastDropShadow-example.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Rectangle { + anchors.fill: parent + } + + FastDropShadow { + anchors.fill: fastDropShadowSourceItem + horizontalOffset: 3 + verticalOffset: 3 + blur: 0.5 + color: "#80000000" + source: fastDropShadowSourceItem + } + + Image { + id: fastDropShadowSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + } +} +//! [example] diff --git a/doc/src/snippets/FastGlow-example.qml b/doc/src/snippets/FastGlow-example.qml new file mode 100644 index 0000000..8de5043 --- /dev/null +++ b/doc/src/snippets/FastGlow-example.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +//! [example] +Item { + width: 300 + height: 300 + + Rectangle { + anchors.fill: parent + color: "black" + } + + FastGlow { + anchors.fill: fastGlowSourceItem + blur: 0.8 + color: "white" + source: fastGlowSourceItem + } + + Image { + id: fastGlowSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + } +} +//! [example] diff --git a/doc/src/snippets/GammaAdjust-example.qml b/doc/src/snippets/GammaAdjust-example.qml new file mode 100644 index 0000000..094e090 --- /dev/null +++ b/doc/src/snippets/GammaAdjust-example.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: gammaAdjustSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + GammaAdjust { + anchors.fill: gammaAdjustSourceItem + source: gammaAdjustSourceItem + gamma: 1.5 + } +} +//! [example] diff --git a/doc/src/snippets/GaussianBlur-example.qml b/doc/src/snippets/GaussianBlur-example.qml new file mode 100644 index 0000000..15954fd --- /dev/null +++ b/doc/src/snippets/GaussianBlur-example.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: gaussianBlurSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + GaussianBlur { + anchors.fill: gaussianBlurSourceItem + source: gaussianBlurSourceItem + radius: 8 + maximumRadius: 8 + } +} +//! [example] diff --git a/doc/src/snippets/Glow-example.qml b/doc/src/snippets/Glow-example.qml new file mode 100644 index 0000000..a6572d7 --- /dev/null +++ b/doc/src/snippets/Glow-example.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Rectangle { + anchors.fill: parent + color: "black" + } + + Glow { + anchors.fill: glowSourceItem + radius: 8 + maximumRadius: 8 + color: "white" + source: glowSourceItem + } + + Image { + id: glowSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + } +} +//! [example] diff --git a/doc/src/snippets/HueSaturation-example.qml b/doc/src/snippets/HueSaturation-example.qml new file mode 100644 index 0000000..da83b78 --- /dev/null +++ b/doc/src/snippets/HueSaturation-example.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: hueSaturationSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + HueSaturation { + anchors.fill: hueSaturationSourceItem + source: hueSaturationSourceItem + hue: -0.3 + saturation: 0.5 + lightness: -0.1 + } +} +//! [example] diff --git a/doc/src/snippets/LinearGradient-example.qml b/doc/src/snippets/LinearGradient-example.qml new file mode 100644 index 0000000..4a65cd6 --- /dev/null +++ b/doc/src/snippets/LinearGradient-example.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + LinearGradient { + anchors.fill: parent + start: Qt.point(0, 0) + end: Qt.point(300, 300) + gradient: Gradient { + GradientStop { position: 0.0; color: "#45071C" } + GradientStop { position: 1.0; color: "#FDC000" } + } + } +} +//! [example] diff --git a/doc/src/snippets/OpacityMask-example.qml b/doc/src/snippets/OpacityMask-example.qml new file mode 100644 index 0000000..6c8a69f --- /dev/null +++ b/doc/src/snippets/OpacityMask-example.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: opacityMaskSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Image { + id: opacityMaskItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + OpacityMask { + anchors.fill: opacityMaskSourceItem + source: opacityMaskSourceItem + maskSource: ShaderEffectSource { hideSource: true; smooth: true; sourceItem: opacityMaskItem; visible: false } + } +} +//! [example] diff --git a/doc/src/snippets/RadialBlur-example.qml b/doc/src/snippets/RadialBlur-example.qml new file mode 100644 index 0000000..d13b5b9 --- /dev/null +++ b/doc/src/snippets/RadialBlur-example.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: radialBlurSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + RadialBlur { + anchors.fill: radialBlurSourceItem + source: radialBlurSourceItem + samples: 32 + angle: 30 + } +} +//! [example] diff --git a/doc/src/snippets/RadialGradient-example.qml b/doc/src/snippets/RadialGradient-example.qml new file mode 100644 index 0000000..8c048d2 --- /dev/null +++ b/doc/src/snippets/RadialGradient-example.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + RadialGradient { + anchors.fill: parent + gradient: Gradient { + GradientStop { position: 0.0; color: "#FDC000" } + GradientStop { position: 1.0; color: "#45071C" } + } + } +} +//! [example] diff --git a/doc/src/snippets/RectangularGlow-example.qml b/doc/src/snippets/RectangularGlow-example.qml new file mode 100644 index 0000000..2daeff2 --- /dev/null +++ b/doc/src/snippets/RectangularGlow-example.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Rectangle { + anchors.fill: parent + color: "black" + } + + RectangularGlow { + id: effect + anchors.fill: rectangularGlowSource + glowRadius: 10 + spread: 0.2 + color: "white" + cornerRadius: rectangularGlowSource.radius + glowRadius + } + + Rectangle { + id: rectangularGlowSource + color: "#cc4b00" + anchors.centerIn: parent + width: Math.round(parent.width / 1.5) + height: Math.round(parent.height / 2) + radius: 25 + } +} +//! [example] + diff --git a/doc/src/snippets/RecursiveBlur-example.qml b/doc/src/snippets/RecursiveBlur-example.qml new file mode 100644 index 0000000..f667c1b --- /dev/null +++ b/doc/src/snippets/RecursiveBlur-example.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: recursiveBlurSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + RecursiveBlur { + anchors.fill: recursiveBlurSourceItem + source: recursiveBlurSourceItem + radius: 7.5 + loops: 50 + } +} +//! [example] diff --git a/doc/src/snippets/ThresholdMask-example.qml b/doc/src/snippets/ThresholdMask-example.qml new file mode 100644 index 0000000..2407218 --- /dev/null +++ b/doc/src/snippets/ThresholdMask-example.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + anchors.fill: parent + source: "images/checker.png" + smooth: true + fillMode: Image.Tile + } + + Image { + id: thresholdMaskSourceItem + source: "images/bug.jpg" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + Image { + id: thresholdMaskItem + source: "images/fog.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + ThresholdMask { + anchors.fill: thresholdMaskSourceItem + source: thresholdMaskSourceItem + maskSource: thresholdMaskItem + threshold: 0.4 + spread: 0.2 + } +} +//! [example] diff --git a/doc/src/snippets/ZoomBlur-example.qml b/doc/src/snippets/ZoomBlur-example.qml new file mode 100644 index 0000000..70783e5 --- /dev/null +++ b/doc/src/snippets/ZoomBlur-example.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [example] +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +Item { + width: 300 + height: 300 + + Image { + id: zoomBlurSourceItem + source: "images/butterfly.png" + sourceSize: Qt.size(parent.width, parent.height) + smooth: true + visible: false + } + + ZoomBlur { + anchors.fill: zoomBlurSourceItem + source: zoomBlurSourceItem + samples: 32 + length: 48 + } +} +//! [example] diff --git a/doc/src/snippets/images/bug.jpg b/doc/src/snippets/images/bug.jpg Binary files differnew file mode 100755 index 0000000..43e3676 --- /dev/null +++ b/doc/src/snippets/images/bug.jpg diff --git a/doc/src/snippets/images/butterfly.png b/doc/src/snippets/images/butterfly.png Binary files differnew file mode 100644 index 0000000..ce544f2 --- /dev/null +++ b/doc/src/snippets/images/butterfly.png diff --git a/doc/src/snippets/images/checker.png b/doc/src/snippets/images/checker.png Binary files differnew file mode 100644 index 0000000..b7f067b --- /dev/null +++ b/doc/src/snippets/images/checker.png diff --git a/doc/src/snippets/images/displacementmap.png b/doc/src/snippets/images/displacementmap.png Binary files differnew file mode 100755 index 0000000..7614db8 --- /dev/null +++ b/doc/src/snippets/images/displacementmap.png diff --git a/doc/src/snippets/images/fog.png b/doc/src/snippets/images/fog.png Binary files differnew file mode 100644 index 0000000..f462222 --- /dev/null +++ b/doc/src/snippets/images/fog.png diff --git a/doc/style/style.css b/doc/style/style.css new file mode 100644 index 0000000..df84049 --- /dev/null +++ b/doc/style/style.css @@ -0,0 +1,137 @@ +a:link, a:visited { + color: #00732F; + text-decoration: none; + font-weight: bold; +} + +body { + font: normal 400 14px/1.2 Arial; + margin-top: 85px; +} + +h1 { + margin: 0; +} + +h2 { + font: 500 20px/1.2 Arial; +} + +h3.fn, span.fn { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + word-spacing: 3px; + padding: 3px 5px; +} + +table, pre { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #E6E6E6; + border-collapse: separate; + font-size: 12px; + line-height: 1.2; + margin-bottom: 25px; + margin-left: 15px; +} + +table td { + padding: 3px 15px 3px 20px; +} + +table tr.even { + background-color: white; + color: #66666E; +} + +table tr.odd { + background-color: #F6F6F6; + color: #66666E; +} + +li { + margin-bottom: 10px; + padding-left: 12px; +} + +.cpp { + display: block; + margin: 10; + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + padding: 20px 0 20px 0; +} + +.footer { + margin-top: 50px; +} + +.memItemLeft { + padding-right: 3px; +} + +.memItemRight { + padding: 3px 15px 3px 0; +} + +.qml { + display: block; + margin: 10; + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + padding: 20px 0 20px 0; +} + +.qmldefault { + padding-left: 5px; + float: right; + color: red; +} + +.qmlreadonly { + padding-left: 5px; + float: right; + color: #254117; +} + +.rightAlign { + padding: 3px 5px 3px 10px; + text-align: right; +} + +.title { + background-color: white; + color: #44A51C; + font-family: Verdana; + font-size: 35px; + font-weight: normal; + left: 0; + padding-bottom: 5px; + padding-left: 16px; + padding-top: 20px; + position: absolute; + right: 0; + top: 0; +} + +.toc { + float: right; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #DDD; + margin: 0 20px 10px 10px; + padding: 20px 15px 20px 20px; + height: auto; + width: 200px; +} diff --git a/modules/qt_graphical_effects.pri b/modules/qt_graphical_effects.pri new file mode 100644 index 0000000..f03645e --- /dev/null +++ b/modules/qt_graphical_effects.pri @@ -0,0 +1,16 @@ +QT.qtgraphicaleffects.VERSION = 1.0.0 +QT.qtgraphicaleffects.MAJOR_VERSION = 1 +QT.qtgraphicaleffects.MINOR_VERSION = 0 +QT.qtgraphicaleffects.PATCH_VERSION = 0 + +QT.qtgraphicaleffects.name = QtGraphicalEffects +QT.qtgraphicaleffects.bins = $$QT_MODULE_BIN_BASE +QT.qtgraphicaleffects.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtGraphicalEffects +QT.qtgraphicaleffects.private_includes = $$QT_MODULE_INCLUDE_BASE/QtGraphicalEffects/$$QT.qtgraphicaleffects.VERSION +QT.qtgraphicaleffects.sources = $$QT_MODULE_BASE/src +QT.qtgraphicaleffects.libs = $$QT_MODULE_LIB_BASE +QT.qtgraphicaleffects.plugins = $$QT_MODULE_PLUGIN_BASE +QT.qtgraphicaleffects.imports = $$QT_MODULE_IMPORT_BASE +QT.qtgraphicaleffects.depends = core declarative + +QT_CONFIG += qtgraphicaleffects diff --git a/qtgraphicaleffects.pro b/qtgraphicaleffects.pro new file mode 100644 index 0000000..3239334 --- /dev/null +++ b/qtgraphicaleffects.pro @@ -0,0 +1,15 @@ +TEMPLATE = subdirs + +module_qtgraphicaleffects_src.subdir = src +module_qtgraphicaleffects_src.target = module-qtgraphicaleffects-src + +module_qtgraphicaleffects_tests.subdir = tests +module_qtgraphicaleffects_tests.target = module-qtgraphicaleffects-tests +module_qtgraphicaleffects_tests.depends = module_qtgraphicaleffects_src +module_qtgraphicaleffects_tests.CONFIG = no_default_install +!contains(QT_BUILD_PARTS,tests):module_qtgraphicaleffects_tests.CONFIG += no_default_target + +SUBDIRS += module_qtgraphicaleffects_src \ + module_qtgraphicaleffects_tests + +include(doc/doc.pri) diff --git a/src/effects/Blend.qml b/src/effects/Blend.qml new file mode 100644 index 0000000..f9fc01d --- /dev/null +++ b/src/effects/Blend.qml @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant backgroundSource + property variant foregroundSource + property string mode: "normal" + property bool cached: false + + SourceProxy { + id: backgroundSourceProxy + input: rootItem.backgroundSource + } + + SourceProxy { + id: foregroundSourceProxy + input: rootItem.foregroundSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant backgroundSource: backgroundSourceProxy.output + property variant foregroundSource: foregroundSourceProxy.output + property string mode: rootItem.mode + anchors.fill: parent + + fragmentShader: fragmentShaderBegin + blendModeNormal + fragmentShaderEnd + + function buildFragmentShader() { + var shader = fragmentShaderBegin + + switch (mode) { + case "darken" : shader += blendModeDarken; break; + case "addition" : shader += blendModeAddition; break; + case "difference" : shader += blendModeDifference; break; + case "divide" : shader += blendModeDivide; break; + case "lighten" : shader += blendModeLighten; break; + case "normal" : shader += blendModeNormal; break; + case "multiply" : shader += blendModeMultiply; break; + case "screen" : shader += blendModeScreen; break; + case "subtract" : shader += blendModeSubtract; break; + default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break; + } + + shader += fragmentShaderEnd + fragmentShader = shader + + // Workaraound for a bug just to make sure display gets updated when the mode changes. + backgroundSourceChanged() + } + + Component.onCompleted: { + buildFragmentShader() + } + + onModeChanged: { + buildFragmentShader() + } + + property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);" + property string blendModeDarken: "result.rgb = min(rgb1, rgb2);" + property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);" + property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);" + property string blendModeLighten: "result.rgb = max(rgb1, rgb2);" + property string blendModeMultiply: "result.rgb = rgb1 * rgb2;" + property string blendModeNormal: "result.rgb = rgb2;" + property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);" + property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));" + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D backgroundSource; + uniform sampler2D foregroundSource; + void main() { + lowp vec4 result = vec4(0.0); + lowp vec4 color1 = texture2D(backgroundSource, qt_TexCoord0); + lowp vec4 color2 = texture2D(foregroundSource, qt_TexCoord0); + lowp vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a); + lowp vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a); + " + + property string fragmentShaderEnd: " + gl_FragColor.a = color1.a * qt_Opacity; + gl_FragColor.rgb = mix(rgb1, result.rgb, color2.a); + } + " + } +} diff --git a/src/effects/BrightnessContrast.qml b/src/effects/BrightnessContrast.qml new file mode 100644 index 0000000..1f7b31b --- /dev/null +++ b/src/effects/BrightnessContrast.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real brightness: 0.0 + property real contrast: 0.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real brightness: rootItem.brightness + property real contrast: rootItem.contrast + + anchors.fill: parent + blending: !rootItem.cached + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float brightness; + uniform highp float contrast; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + pixelColor.rgb /= max(1.0/256.0, pixelColor.a); + highp float c = 1.0 + contrast; + highp float contrastGainFactor = 1.0 + c * c * c * c * step(0.0, contrast); + pixelColor.rgb = ((pixelColor.rgb - 0.5) * (contrastGainFactor * contrast + 1.0)) + 0.5; + pixelColor.rgb += brightness; + pixelColor.rgb *= pixelColor.a; + pixelColor.rgb = mix(pixelColor.rgb, vec3(1.0, 1.0, 1.0), brightness); + gl_FragColor = pixelColor * qt_Opacity; + } + " + } +} diff --git a/src/effects/ColorOverlay.qml b/src/effects/ColorOverlay.qml new file mode 100644 index 0000000..4ba65ee --- /dev/null +++ b/src/effects/ColorOverlay.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property color color: "transparent" + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property color color: rootItem.color + + anchors.fill: parent + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp vec4 color; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } +} diff --git a/src/effects/Colorize.qml b/src/effects/Colorize.qml new file mode 100644 index 0000000..ba30029 --- /dev/null +++ b/src/effects/Colorize.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real hue: 0.0 + property real saturation: 1.0 + property real lightness: 0.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real hue: rootItem.hue + property real saturation: rootItem.saturation + property real lightness: rootItem.lightness + + anchors.fill: parent + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float hue; + uniform highp float saturation; + uniform highp float lightness; + + highp float RGBtoL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float l = (cmin + cmax) / 2.0; + return l; + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 sample = texture2D(source, qt_TexCoord0); + sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a); + highp float light = RGBtoL(sample.rgb); + highp float c = step(0.0, lightness); + sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness)))); + gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity; + } + " + } +} diff --git a/src/effects/ConicalGradient.qml b/src/effects/ConicalGradient.qml new file mode 100644 index 0000000..4f2d140 --- /dev/null +++ b/src/effects/ConicalGradient.qml @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property bool cached: false + property real angle: 0.0 + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + property variant maskSource + + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + Rectangle { + id: gradientRect + width: 1 + height: 256 + gradient: rootItem.gradient + smooth: true + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + rotation: shaderItem.rotation + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant gradientSource: ShaderEffectSource { + sourceItem: gradientRect + smooth: true + hideSource: true + wrapMode: ShaderEffectSource.Repeat + visible: false + } + property variant maskSource: maskSourceProxy.output + property real startAngle: (rootItem.angle - 90) * Math.PI/180 + property variant center: Qt.point(0.5 + horizontalOffset / width, 0.5 + verticalOffset / height) + + anchors.fill: parent + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: startAngleChanged() + + property string noMaskShader: " + varying mediump vec2 qt_TexCoord0; + uniform lowp sampler2D gradientSource; + uniform float qt_Opacity; + uniform float startAngle; + uniform vec2 center; + + void main() { + const float PI = 3.14159265; + const float PIx2inv = 0.1591549; + highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv; + gl_FragColor = texture2D(gradientSource, vec2(0.0, a)) * qt_Opacity; + } + " + + property string maskShader: " + varying mediump vec2 qt_TexCoord0; + uniform lowp sampler2D gradientSource; + uniform lowp sampler2D maskSource; + uniform float qt_Opacity; + uniform float startAngle; + uniform vec2 center; + + void main() { + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + const float PI = 3.14159265; + const float PIx2inv = 0.1591549; + highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv; + gl_FragColor = texture2D(gradientSource, vec2(0.0, a)) * maskAlpha * qt_Opacity; + } + " + } +} diff --git a/src/effects/Desaturate.qml b/src/effects/Desaturate.qml new file mode 100644 index 0000000..c95d2cf --- /dev/null +++ b/src/effects/Desaturate.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real desaturation: 0.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real desaturation: rootItem.desaturation + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float desaturation; + void main(void) { + lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st); + lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0; + gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation); + } + " + } +} diff --git a/src/effects/DirectionalBlur.qml b/src/effects/DirectionalBlur.qml new file mode 100644 index 0000000..0ab54a9 --- /dev/null +++ b/src/effects/DirectionalBlur.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real length: 0.0 + property int samples: 0 + property real angle: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real len: rootItem.length + property bool transparentBorder: rootItem.transparentBorder + property real samples: rootItem.samples + property real weight: 1 / rootItem.samples + property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant pixelSize: Qt.size(1.0 / (width / (1.0 - 2 * expand.width)), 1.0 / (height / (1.0 - 2 * expand.height))) + property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180)) + + x: transparentBorder ? -expandPixels.width : 0 + y: transparentBorder ? -expandPixels.height : 0 + width: transparentBorder ? parent.width + 2.0 * expandPixels.width : parent.width + height: transparentBorder ? parent.height + 2.0 * expandPixels.height : parent.height + + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float len; + uniform highp float samples; + uniform highp float weight; + uniform highp vec2 expand; + uniform highp vec2 pixelSize; + uniform highp vec2 delta; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + highp vec2 shift = vec2(delta.x, delta.y) * len / max(1.0, samples - 1.0); + mediump vec2 texCoord = qt_TexCoord0; + gl_FragColor = vec4(0.0); + + PLACEHOLDER_EXPAND_STEPS + + texCoord -= shift * max(0.0, samples - 1.0) * 0.5; + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + var linearSteps = "" + + if (transparentBorder) { + expandSteps += "texCoord.s = (texCoord.s - expand.x) / (1.0 - 2.0 * expand.x);" + expandSteps += "texCoord.t = (texCoord.t - expand.y) / (1.0 - 2.0 * expand.y);" + expandSteps += "highp vec2 stepSize = vec2(1.0 - pixelSize.x, 1.0 - pixelSize.y);" + linearSteps = "* linearstep(0.0, pixelSize.x, texCoord.s) * linearstep(1.0, stepSize.x, texCoord.s) * linearstep(0.0, pixelSize.y, texCoord.t) * linearstep(1.0, stepSize.y, texCoord.t)" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord) " + linearSteps + ";\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, texCoord) * weight " + linearSteps + "; texCoord += shift;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/src/effects/DirectionalGaussianBlur.qml b/src/effects/DirectionalGaussianBlur.qml new file mode 100644 index 0000000..55d52b5 --- /dev/null +++ b/src/effects/DirectionalGaussianBlur.qml @@ -0,0 +1,263 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real deviation: (radius + 1) / 3.3333 + property real radius: 0.0 + property int maximumRadius: 0 + property real horizontalStep: 0.0 + property real verticalStep: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: rootItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real deviation: rootItem.deviation + property real radius: rootItem.radius + property int maxRadius: rootItem.maximumRadius + property bool transparentBorder: rootItem.transparentBorder + property real deltaX: rootItem.horizontalStep + property real deltaY: rootItem.verticalStep + property real gaussianSum: 0.0 + property real startIndex: 0.0 + property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1) + property real expandX: transparentBorder && deltaX > 0 ? maxRadius / width : 0.0 + property real expandY: transparentBorder && deltaY > 0 ? maxRadius / height : 0.0 + property real pixelX: 1.0 / (width / (1.0 - 2 * expandX)) + property real pixelY: 1.0 / (height / (1.0 - 2 * expandY)) + property variant gwts: [] + property variant delta: Qt.vector3d(deltaX * deltaFactor, deltaY * deltaFactor, startIndex); + property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]); + property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]); + property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]); + property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]); + property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]); + property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]); + property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]); + property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]); + property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]); + property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]); + property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]); + + anchors.fill: rootItem + + function gausFunc(x){ + //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2))); + return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2))))); + } + + function updateGaussianWeights() { + gaussianSum = 0.0; + startIndex = -maxRadius + 0.5 + + var n = new Array(32); + for (var j = 0; j < 32; j++) + n[j] = 0; + + var max = maxRadius * 2 + var delta = (2 * radius - 1) / (max - 1); + for (var i = 0; i < max; i++) { + n[i] = gausFunc(-radius + 0.5 + i * delta); + gaussianSum += n[i]; + } + + gwts = n; + } + + function buildFragmentShader() { + var linearSteps = "" + + if (transparentBorder) + linearSteps = "* linearstep(0.0, pixelX, texCoord.s) * linearstep(1.0, stepX, texCoord.s) * linearstep(0.0, pixelY, texCoord.t) * linearstep(1.0, stepY, texCoord.t)" + + var shaderSteps = [ + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z" + linearSteps + "; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y" + linearSteps + "; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z" + linearSteps + "; texCoord += shift;" + ] + + var shader = fragmentShaderBegin + var samples = maxRadius * 2 + if (samples > 32) { + console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!") + samples = 32 + } + + for (var i = 0; i < samples; i++) { + shader += shaderSteps[i] + } + + shader += fragmentShaderEnd + fragmentShader = shader + } + + onDeviationChanged: updateGaussianWeights() + + onRadiusChanged: updateGaussianWeights() + + onTransparentBorderChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + onMaxRadiusChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + Component.onCompleted: { + buildFragmentShader() + updateGaussianWeights() + } + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp vec3 delta; + uniform highp vec3 factor_0_2; + uniform highp vec3 factor_3_5; + uniform highp vec3 factor_6_8; + uniform highp vec3 factor_9_11; + uniform highp vec3 factor_12_14; + uniform highp vec3 factor_15_17; + uniform highp vec3 factor_18_20; + uniform highp vec3 factor_21_23; + uniform highp vec3 factor_24_26; + uniform highp vec3 factor_27_29; + uniform highp vec3 factor_30_32; + uniform highp float gaussianSum; + uniform highp float expandX; + uniform highp float expandY; + uniform highp float pixelX; + uniform highp float pixelY; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + highp float dlinearstep(highp float e0, highp float d, highp float x) { + return clamp((x - e0) * d, 0.0, 1.0); + } + + void main() { + highp vec2 shift = vec2(delta.x, delta.y); + highp float index = delta.z; + mediump vec2 texCoord = qt_TexCoord0; + highp float stepX = 1.0 - pixelX; + highp float stepY = 1.0 - pixelY; + texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX); + texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY); + texCoord += (shift * index); + + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + " + + property string fragmentShaderEnd: " + if (gaussianSum > 0.0) + gl_FragColor /= gaussianSum; + else + gl_FragColor = texture2D(source, qt_TexCoord0); + + gl_FragColor *= qt_Opacity; + } + " + } +} diff --git a/src/effects/Displace.qml b/src/effects/Displace.qml new file mode 100644 index 0000000..006cbfa --- /dev/null +++ b/src/effects/Displace.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property variant displacementSource + property real displacement: 0.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: displacementSourceProxy + input: rootItem.displacementSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant displacementSource: displacementSourceProxy.output + property real displacement: rootItem.displacement + property real xPixel: 1.0/width + property real yPixel: 1.0/height + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D displacementSource; + uniform highp float displacement; + uniform highp float xPixel; + uniform highp float yPixel; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 offset = texture2D(displacementSource, qt_TexCoord0); + offset.xy -= vec2(0.5, 0.5); + offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy)); + highp vec2 tx = qt_TexCoord0 + (offset.xy * displacement); + + lowp float e1 = linearstep(0.0, xPixel, tx.x); + lowp float e2 = linearstep(0.0, yPixel, tx.y); + lowp float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x); + lowp float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y); + + lowp vec4 sample = texture2D(source, tx); + sample.rgb *= e1 * e2 * e3 * e4; + gl_FragColor = sample * qt_Opacity * offset.a; + } + " + } +} diff --git a/src/effects/DropShadow.qml b/src/effects/DropShadow.qml new file mode 100644 index 0000000..a947ba9 --- /dev/null +++ b/src/effects/DropShadow.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property color color: "black" + property bool cached: false + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + property real spread: 0.0 + property bool transparentBorder: false + + Glow { + x: rootItem.horizontalOffset + y: rootItem.verticalOffset + width: parent.width + height: parent.height + source: rootItem.source + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } +} diff --git a/src/effects/FastBlur.qml b/src/effects/FastBlur.qml new file mode 100644 index 0000000..fc94f9d --- /dev/null +++ b/src/effects/FastBlur.qml @@ -0,0 +1,358 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real blur: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + sourceItem: shaderItem + live: true + hideSource: visible + smooth: rootItem.blur > 0 + } + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + uniform highp float yStep; + uniform highp float xStep; + varying mediump vec2 qt_TexCoord0; + + void main() { + highp vec2 shift = vec2(xStep, yStep); + + lowp vec4 sourceColor = texture2D(source, vec2(qt_TexCoord0.x + shift.x, qt_TexCoord0.y + shift.y * 0.36)) * 0.25 + + texture2D(source, vec2(qt_TexCoord0.x + shift.x * 0.36, qt_TexCoord0.y - shift.y)) * 0.25 + + texture2D(source, vec2(qt_TexCoord0.x - shift.x * 0.36, qt_TexCoord0.y + shift.y)) * 0.25 + + texture2D(source, vec2(qt_TexCoord0.x - shift.x, qt_TexCoord0.y - shift.y * 0.36)) * 0.25; + + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.blur > 0 + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: Math.sqrt(rootItem.blur) * 1.2 - 0.2 + property real weight1 + property real weight2 + property real weight3 + property real weight4 + property real weight5 + property real weight6 + + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + function weight(v) { + if (v <= 0.0) + return 1.0 + if (v >= 0.5) + return 0.0 + + return 1.0 - v * 2.0 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/src/effects/FastDropShadow.qml b/src/effects/FastDropShadow.qml new file mode 100644 index 0000000..db00aac --- /dev/null +++ b/src/effects/FastDropShadow.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real blur: 0.0 + property color color: "black" + property bool cached: false + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + property real spread: 0.0 + property bool transparentBorder: false + + FastGlow { + x: rootItem.horizontalOffset + y: rootItem.verticalOffset + width: parent.width + height: parent.height + source: rootItem.source + blur: rootItem.blur + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } +} diff --git a/src/effects/FastGlow.qml b/src/effects/FastGlow.qml new file mode 100644 index 0000000..5ee7471 --- /dev/null +++ b/src/effects/FastGlow.qml @@ -0,0 +1,370 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real spread: 0.0 + property real blur: 0.0 + property color color: "white" + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + uniform highp float yStep; + uniform highp float xStep; + varying mediump vec2 qt_TexCoord0; + + void main() { + highp vec2 shift = vec2(xStep, yStep); + + lowp vec4 sourceColor = texture2D(source, vec2(qt_TexCoord0.x + shift.x, qt_TexCoord0.y + shift.y * 0.36)) * 0.25 + + texture2D(source, vec2(qt_TexCoord0.x + shift.x * 0.36, qt_TexCoord0.y - shift.y)) * 0.25 + + texture2D(source, vec2(qt_TexCoord0.x - shift.x * 0.36, qt_TexCoord0.y + shift.y)) * 0.25 + + texture2D(source, vec2(qt_TexCoord0.x - shift.x, qt_TexCoord0.y - shift.y * 0.36)) * 0.25; + + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0) + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property alias color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a)); + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/src/effects/GammaAdjust.qml b/src/effects/GammaAdjust.qml new file mode 100644 index 0000000..62ba66a --- /dev/null +++ b/src/effects/GammaAdjust.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real gamma: 1.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real gamma: rootItem.gamma + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float gamma; + void main(void) { + gl_FragColor = pow(texture2D(source, qt_TexCoord0.st), vec4(gamma)); + } + " + } +} diff --git a/src/effects/GaussianBlur.qml b/src/effects/GaussianBlur.qml new file mode 100644 index 0000000..86dedf4 --- /dev/null +++ b/src/effects/GaussianBlur.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property real deviation: (radius + 1) / 3.3333 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: verticalBlur + visible: rootItem.cached + smooth: true + sourceItem: verticalBlur + live: true + hideSource: visible + } + + DirectionalGaussianBlur { + id: verticalBlur + x: transparentBorder ? -maximumRadius : 0 + y: transparentBorder ? -maximumRadius : 0 + width: horizontalBlur.width + height: transparentBorder ? horizontalBlur.height + 2 * maximumRadius : horizontalBlur.height + + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + + source: ShaderEffectSource { + sourceItem: horizontalBlur + hideSource: true + visible: false + smooth: true + } + + deviation: rootItem.deviation + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + } + + DirectionalGaussianBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width + height: parent.height + + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + + source: sourceProxy.output + deviation: rootItem.deviation + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + } +} diff --git a/src/effects/Glow.qml b/src/effects/Glow.qml new file mode 100644 index 0000000..dfe98cb --- /dev/null +++ b/src/effects/Glow.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property real spread: 0.0 + property color color: "white" + property bool cached: false + property bool transparentBorder: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + GaussianBlur { + id: blur + anchors.fill: parent + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + } + + ShaderEffectSource { + id: blurredSource + sourceItem: blur + live: true + hideSource: true + textureSize: transparentBorder ? Qt.size(blur.width + 2 * maximumRadius, blur.height + 2 * maximumRadius) : Qt.size(blur.width, blur.height) + sourceRect: transparentBorder ? Qt.rect(-maximumRadius, -maximumRadius, blur.width + 2 * maximumRadius, blur.height + 2 * maximumRadius) : Qt.rect(0,0,0,0) + smooth: true + } + + ShaderEffect { + id: shaderItem + + property variant source: blurredSource + property real spread: 1.0 - (rootItem.spread * 0.98) + property color color: rootItem.color + + anchors.fill: blur + anchors.margins: transparentBorder ? -maximumRadius : 0 + smooth: true + + fragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + uniform highp vec4 color; + uniform highp float spread; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 sourceColor = texture2D(source, qt_TexCoord0); + sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a)); + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/src/effects/HueSaturation.qml b/src/effects/HueSaturation.qml new file mode 100644 index 0000000..1a49faa --- /dev/null +++ b/src/effects/HueSaturation.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source: 0 + property real hue: 0.0 + property real saturation: 0.0 + property real lightness: 0.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant hsl: Qt.vector3d(rootItem.hue, rootItem.saturation, rootItem.lightness) + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform highp sampler2D source; + uniform highp vec3 hsl; + + highp vec3 RGBtoHSL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float h = 0.0; + highp float s = 0.0; + highp float l = (cmin + cmax) / 2.0; + highp float diff = cmax - cmin; + + if (diff > 1.0 / 256.0) { + if (l < 0.5) + s = diff / (cmin + cmax); + else + s = diff / (2.0 - (cmin + cmax)); + + if (color.r == cmax) + h = (color.g - color.b) / diff; + else if (color.g == cmax) + h = 2.0 + (color.b - color.r) / diff; + else + h = 4.0 + (color.r - color.g) / diff; + + h /= 6.0; + } + return vec3(h, s, l); + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 sample = texture2D(source, qt_TexCoord0); + sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a); + sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y); + sample.xyz = RGBtoHSL(sample.rgb); + sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z)); + highp float c = step(0.0, hsl.z); + sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z)); + gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity; + } + " + } +} diff --git a/src/effects/LinearGradient.qml b/src/effects/LinearGradient.qml new file mode 100644 index 0000000..e2a7019 --- /dev/null +++ b/src/effects/LinearGradient.qml @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant start: Qt.point(0, 0) + property variant end: Qt.point(0, height) + property bool cached: false + property variant maskSource + + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: gradientSource + sourceItem: Rectangle { + width: 1 + height: 256 + gradient: rootItem.gradient + smooth: true + } + smooth: true + hideSource: true + visible: false + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + anchors.fill: parent + + property variant source: gradientSource + property variant maskSource: maskSourceProxy.output + property variant startPoint: Qt.point(start.x / width, start.y / height) + property real dx: end.x - start.x + property real dy: end.y - start.y + property real l: 1.0 / Math.sqrt(Math.pow(dx / width, 2.0) + Math.pow(dy / height, 2.0)) + property real angle: Math.atan2(dx, dy) + property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle)) + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + uniform highp vec2 startPoint; + uniform highp float l; + uniform highp vec2 matrixData; + + void main() { + highp mat2 rot = mat2(matrixData.y, -matrixData.x, + matrixData.x, matrixData.y); + + qt_TexCoord0 = qt_MultiTexCoord0; + + qt_TexCoord1 = qt_MultiTexCoord0 * l; + qt_TexCoord1 -= startPoint * l; + qt_TexCoord1 *= rot; + + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: lChanged() + + property string maskShader: " + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + + void main() { + lowp vec4 gradientColor = texture2D(source, qt_TexCoord1); + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + gl_FragColor = gradientColor * maskAlpha * qt_Opacity; + } + " + + property string noMaskShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord1; + + void main() { + gl_FragColor = texture2D(source, qt_TexCoord1) * qt_Opacity; + } + " + } +} diff --git a/src/effects/OpacityMask.qml b/src/effects/OpacityMask.qml new file mode 100644 index 0000000..3059f40 --- /dev/null +++ b/src/effects/OpacityMask.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property variant maskSource + property bool cached: false + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: rootItem.source + property variant maskSource: rootItem.maskSource + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform sampler2D maskSource; + void main(void) { + gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity; + } + " + } +} diff --git a/src/effects/RadialBlur.qml b/src/effects/RadialBlur.qml new file mode 100644 index 0000000..8526c8b --- /dev/null +++ b/src/effects/RadialBlur.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real angle: 0.0 + property int samples: 0 + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height) + property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1 + property int samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) + property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) + property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant pixelSize: Qt.size(1.0 / (width / (1.0 - 2 * expand.width)), 1.0 / (height / (1.0 - 2 * expand.height))) + property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height) + property real w: width + property real h: height + + x: transparentBorder ? -expandPixels.width : 0 + y: transparentBorder ? -expandPixels.height : 0 + width: transparentBorder ? parent.width + expandPixels.width * 2.0 : parent.width + height: transparentBorder ? parent.height + expandPixels.height * 2.0 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float angleSinStep; + uniform highp float angleCosStep; + uniform highp float weight; + uniform highp vec2 expand; + uniform highp vec2 center; + uniform highp vec2 pixelSize; + uniform highp vec2 delta; + uniform highp float w; + uniform highp float h; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + highp mat2 m; + m[0] = vec2(angleCosStep, -angleSinStep); + m[1] = vec2(angleSinStep, angleCosStep); + gl_FragColor = vec4(0.0); + highp vec2 dir = vec2(qt_TexCoord0.s * w - w * 0.5, qt_TexCoord0.t * h - h * 0.5); + + mediump vec2 texCoord = qt_TexCoord0; + + PLACEHOLDER_EXPAND_STEPS + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + var linearSteps = "" + + if (transparentBorder) { + expandSteps += "texCoord.s = (texCoord.s - expand.x) / (1.0 - 2.0 * expand.x);" + expandSteps += "texCoord.t = (texCoord.t - expand.y) / (1.0 - 2.0 * expand.y);" + expandSteps += "highp vec2 stepSize = vec2(1.0 - pixelSize.x, 1.0 - pixelSize.y);" + linearSteps = "* linearstep(0.0, pixelSize.x, texCoord.s) * linearstep(1.0, stepSize.x, texCoord.s) * linearstep(0.0, pixelSize.y, texCoord.t) * linearstep(1.0, stepSize.y, texCoord.t)" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord) " + linearSteps + ";\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "texCoord = vec2(center.x + dir.x * delta.x, center.y + dir.y * delta.y); gl_FragColor += texture2D(source, texCoord) * weight " + linearSteps + "; dir *= m;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/src/effects/RadialGradient.qml b/src/effects/RadialGradient.qml new file mode 100644 index 0000000..4c46369 --- /dev/null +++ b/src/effects/RadialGradient.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property bool cached: false + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + property real horizontalRadius: width + property real verticalRadius: height + property real angle: 0.0 + property variant maskSource + + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: gradientSource + sourceItem: Rectangle { + width: 1 + height: 256 + gradient: rootItem.gradient + smooth: true + } + smooth: true + hideSource: true + visible: false + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant gradientImage: gradientSource + property variant maskSource: maskSourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height) + property real horizontalRatio: rootItem.horizontalRadius > 0 ? width / (2 * rootItem.horizontalRadius) : width * 16384 + property real verticalRatio: rootItem.verticalRadius > 0 ? height / (2 * rootItem.verticalRadius) : height * 16384 + property real angle: -rootItem.angle / 360 * 2 * Math.PI + property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle)) + + anchors.fill: parent + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp vec2 matrixData; + uniform highp float horizontalRatio; + uniform highp float verticalRatio; + uniform highp vec2 center; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + highp vec2 ratio = vec2(horizontalRatio, verticalRatio); + + // Rotation matrix + highp mat2 rot = mat2(matrixData.y, -matrixData.x, + matrixData.x, matrixData.y); + + qt_TexCoord0 = qt_MultiTexCoord0; + + qt_TexCoord1 = qt_MultiTexCoord0; + qt_TexCoord1 -= center; + qt_TexCoord1 *= rot; + qt_TexCoord1 += center; + qt_TexCoord1 *= ratio; + + centerPoint = center * ratio; + + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: horizontalRatioChanged() + + property string maskShader: " + uniform lowp sampler2D gradientImage; + uniform lowp sampler2D maskSource; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint))); + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + gl_FragColor = gradientColor * maskAlpha * qt_Opacity; + } + " + + property string noMaskShader: " + uniform lowp sampler2D gradientImage; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint))); + gl_FragColor = gradientColor * qt_Opacity; + } + " + } +} diff --git a/src/effects/RectangularGlow.qml b/src/effects/RectangularGlow.qml new file mode 100644 index 0000000..b88cc87 --- /dev/null +++ b/src/effects/RectangularGlow.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property real glowRadius: 0.0 + property real spread: 0.0 + property color color: "white" + property real cornerRadius: glowRadius + property bool cached: false + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + x: (parent.width - width) / 2.0 + y: (parent.height - height) / 2.0 + width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2 + height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2 + + function clampedCornerRadius() { + var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius; + return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius)) + } + + property color color: rootItem.color + property real inverseSpread: 1.0 - rootItem.spread + property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width + property real relativeSizeY: relativeSizeX * (width / height) + property real spread: rootItem.spread / 2.0 + property real cornerRadius: clampedCornerRadius() + + fragmentShader: " + uniform highp float qt_Opacity; + uniform mediump float relativeSizeX; + uniform mediump float relativeSizeY; + uniform mediump float spread; + uniform lowp vec4 color; + varying highp vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); + + highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier; + } + " + } +} diff --git a/src/effects/RecursiveBlur.qml b/src/effects/RecursiveBlur.qml new file mode 100644 index 0000000..d0c72fe --- /dev/null +++ b/src/effects/RecursiveBlur.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property bool cached: false + property bool transparentBorder: false + property int loops: 0 + property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0 + + onLoopsChanged: recursiveSource.scheduleUpdate() + onSourceChanged: recursionTimer.reset() + onRadiusChanged: recursionTimer.reset() + onTransparentBorderChanged: recursionTimer.reset() + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + smooth: true + visible: rootItem.cached + hideSource: visible + live: true + sourceItem: blurItem + } + + Item { + id: recursionTimer + property int counter: 0 + + function reset() { + counter = 0 + recursiveSource.scheduleUpdate() + } + + function nextFrame() { + if (loops < counter) + recursionTimer.counter = 0 + + if (counter > 0) + recursiveSource.sourceItem = blurItem + else + recursiveSource.sourceItem = inputItem + + if (counter < loops) { + recursiveSource.scheduleUpdate() + counter++ + } + } + } + + ShaderEffect { + id: inputItem + property variant source: sourceProxy.output + anchors.fill: parent + visible: !blurItem.visible + } + + ShaderEffectSource { + id: recursiveSource + visible: false + smooth: true + hideSource: false + live: false + sourceItem: inputItem + recursive: true + onSourceItemChanged: scheduleUpdate() + onScheduledUpdateCompleted: recursionTimer.nextFrame() + } + + GaussianBlur { + id: blurItem + visible: loops > 0 + anchors.fill: parent + radius: rootItem.radius + maximumRadius: Math.ceil(rootItem.radius) + deviation: (radius + 1) / 2.3333 + transparentBorder: rootItem.transparentBorder + cached: false + source: recursiveSource + } +} diff --git a/src/effects/SourceProxy.qml b/src/effects/SourceProxy.qml new file mode 100644 index 0000000..ccaa79b --- /dev/null +++ b/src/effects/SourceProxy.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant input + property variant output: input + visible: false + + onInputChanged: { + if (input == undefined) { + output = input + } + else if ((isQQuickImage(input) && !hasChildren(input))) { + output = input + } + else if (isQQuickShaderEffectSource(input)) { + output = input + } + else { + proxySource.sourceItem = input + output = proxySource + } + } + + function isQQuickImage(item) { + var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ] + return hasProperties(item, imageProperties) + } + + function isQQuickShaderEffectSource(item) { + var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ] + return hasProperties(item, shaderEffectSourceProperties) + } + + function hasProperties(item, properties) { + var counter = 0 + for (var j = 0; j < properties.length; j++) { + if (item.hasOwnProperty(properties [j])) + counter++ + } + return properties.length == counter + } + + function hasChildren(item) { + if (item.hasOwnProperty("childrenRect")) { + if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)") + return true + else + return false + } + return false + } + + ShaderEffectSource { + id: proxySource + live: rootItem.input != rootItem.output + hideSource: false + smooth: true + visible: false + } +} diff --git a/src/effects/ThresholdMask.qml b/src/effects/ThresholdMask.qml new file mode 100644 index 0000000..8ada325 --- /dev/null +++ b/src/effects/ThresholdMask.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property variant maskSource + property real threshold: 0.0 + property real spread: 0.0 + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant maskSource: rootItem.maskSource + property real threshold: rootItem.threshold + property real spread: rootItem.spread + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform sampler2D maskSource; + uniform float threshold; + uniform float spread; + void main(void) { + lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st); + lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st); + gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity; + } + " + } +} diff --git a/src/effects/ZoomBlur.qml b/src/effects/ZoomBlur.qml new file mode 100644 index 0000000..07446c5 --- /dev/null +++ b/src/effects/ZoomBlur.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rootItem + property variant source + property real length: 0.0 + property int samples: 0 + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height) + property real len: rootItem.length + property bool transparentBorder: rootItem.transparentBorder + property real samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant pixelSize: Qt.size(1.0 / (width / (1.0 - 2 * expand.width)), 1.0 / (height / (1.0 - 2 * expand.height))) + property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height) + + x: transparentBorder ? -expandPixels.width : 0 + y: transparentBorder ? -expandPixels.height : 0 + width: transparentBorder ? parent.width + 2.0 * expandPixels.width : parent.width + height: transparentBorder ? parent.height + 2.0 * expandPixels.height : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform sampler2D source; + uniform highp float len; + uniform highp float weight; + uniform highp float samples; + uniform highp vec2 center; + uniform highp vec2 expand; + uniform highp vec2 pixelSize; + uniform highp vec2 delta; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + mediump vec2 texCoord = qt_TexCoord0; + mediump vec2 centerCoord = center; + + PLACEHOLDER_EXPAND_STEPS + + highp vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t); + dir /= max(1.0, length(dir) * 2.0); + + highp vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0); + gl_FragColor = vec4(0.0); + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + var linearSteps = "" + + if (transparentBorder) { + expandSteps += "centerCoord.s = (centerCoord.s - expand.x) / (1.0 - 2.0 * expand.x);" + expandSteps += "centerCoord.t = (centerCoord.t - expand.y) / (1.0 - 2.0 * expand.y);" + expandSteps += "texCoord.s = (texCoord.s - expand.x) / (1.0 - 2.0 * expand.x);" + expandSteps += "texCoord.t = (texCoord.t - expand.y) / (1.0 - 2.0 * expand.y);" + expandSteps += "highp vec2 stepSize = vec2(1.0 - pixelSize.x, 1.0 - pixelSize.y);" + linearSteps = "* linearstep(0.0, pixelSize.x, texCoord.s) * linearstep(1.0, stepSize.x, texCoord.s) * linearstep(0.0, pixelSize.y, texCoord.t) * linearstep(1.0, stepSize.y, texCoord.t)" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord) " + linearSteps + ";\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, texCoord) * weight " + linearSteps + "; texCoord += shift;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/src/effects/effects.pro b/src/effects/effects.pro new file mode 100644 index 0000000..ab3ecc0 --- /dev/null +++ b/src/effects/effects.pro @@ -0,0 +1,13 @@ +TEMPLATE = subdirs + +TARGETPATH = "QtGraphicalEffects" + +plugin.files += $$PWD/qmldir +plugin.files += $$PWD/*.qml +plugin.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH +!isEmpty(DESTDIR): plugin.path = $$DESTDIR + +OTHER_FILES = *.qml \ + qmldir + +INSTALLS += plugin diff --git a/src/effects/qmldir b/src/effects/qmldir new file mode 100644 index 0000000..e37f1e3 --- /dev/null +++ b/src/effects/qmldir @@ -0,0 +1,26 @@ +Blend 0.1 Blend.qml +BrightnessContrast 0.1 BrightnessContrast.qml +Colorize 0.1 Colorize.qml +ColorOverlay 0.1 ColorOverlay.qml +ConicalGradient 0.1 ConicalGradient.qml +Desaturate 0.1 Desaturate.qml +DirectionalBlur 0.1 DirectionalBlur.qml +Displace 0.1 Displace.qml +DropShadow 0.1 DropShadow.qml +FastBlur 0.1 FastBlur.qml +FastDropShadow 0.1 FastDropShadow.qml +FastGlow 0.1 FastGlow.qml +GammaAdjust 0.1 GammaAdjust.qml +GaussianBlur 0.1 GaussianBlur.qml +Glow 0.1 Glow.qml +HueSaturation 0.1 HueSaturation.qml +LinearGradient 0.1 LinearGradient.qml +OpacityMask 0.1 OpacityMask.qml +RadialBlur 0.1 RadialBlur.qml +RadialGradient 0.1 RadialGradient.qml +RecursiveBlur 0.1 RecursiveBlur.qml +RectangularGlow 0.1 RectangularGlow.qml +ThresholdMask 0.1 ThresholdMask.qml +SourceProxy 0.1 SourceProxy.qml +ZoomBlur 0.1 ZoomBlur.qml + diff --git a/src/src.pro b/src/src.pro new file mode 100644 index 0000000..b779774 --- /dev/null +++ b/src/src.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += effects diff --git a/sync.profile b/sync.profile new file mode 100644 index 0000000..b783bb7 --- /dev/null +++ b/sync.profile @@ -0,0 +1,24 @@ +%modules = ( # path to module name map + "QtGraphicalEffects" => "$basedir/src/effects", +); +%moduleheaders = ( # restrict the module headers to those found in relative path +); +%classnames = ( +); +%mastercontent = ( +); +%modulepris = ( + "QtGraphicalEffects" => "$basedir/modules/qt_graphical_effects.pri", +); +# Module dependencies. +# Every module that is required to build this module should have one entry. +# Each of the module version specifiers can take one of the following values: +# - A specific Git revision. +# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) +# +%dependencies = ( + "qtbase" => "refs/heads/master", + "qtdeclarative" => "refs/heads/master", + "qtsvg" => "refs/heads/master", + "qtxmlpatterns" => "refs/heads/master", +); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro new file mode 100644 index 0000000..38f3d2a --- /dev/null +++ b/tests/auto/auto.pro @@ -0,0 +1,7 @@ +load(qttest_p4) + +QT += opengl declarative + +TARGET = tst_qtgraphicaleffects + +SOURCES += tst_qtgraphicaleffects.cpp diff --git a/tests/auto/tst_qtgraphicaleffects.cpp b/tests/auto/tst_qtgraphicaleffects.cpp new file mode 100644 index 0000000..2652bad --- /dev/null +++ b/tests/auto/tst_qtgraphicaleffects.cpp @@ -0,0 +1,695 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QtDeclarative> + +class tst_qtgraphicaleffects : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + + void blend(); + void brightnessContrast(); + void colorize(); + void colorOverlay(); + void conicalGradient(); + void desaturate(); + void directionalBlur(); + void displace(); + void dropShadow(); + void fastBlur(); + void fastDropShadow(); + void fastGlow(); + void gammaAdjust(); + void gaussianBlur(); + void glow(); + void hueSaturation(); + void linearGradient(); + void opacityMask(); + void radialBlur(); + void radialGradient(); + void recursiveBlur(); + void rectangularGlow(); + void thresholdMask(); + void zoomBlur(); + +private: QDeclarativeEngine engine; +}; + +void tst_qtgraphicaleffects::initTestCase() +{ + engine.addImportPath("../../src"); +} + + +void tst_qtgraphicaleffects::brightnessContrast() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "BrightnessContrast {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("brightness").toDouble(), 0.0); + QCOMPARE(obj->property("contrast").toDouble(), 0.0); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::colorize() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "Colorize {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("hue").toDouble(), 0.0); + QCOMPARE(obj->property("saturation").toDouble(), 1.0); + QCOMPARE(obj->property("lightness").toDouble(), 0.0); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::fastBlur() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "FastBlur {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("blur").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::desaturate() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "Desaturate {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("desaturation").toDouble(), 0.0); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::hueSaturation() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "HueSaturation {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("hue").toDouble(), 0.0); + QCOMPARE(obj->property("saturation").toDouble(), 0.0); + QCOMPARE(obj->property("lightness").toDouble(), 0.0); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::opacityMask() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "OpacityMask {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "maskSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("maskSource").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::radialGradient() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "RadialGradient {" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("gradient").toInt(), 0); + QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("horizontalRadius").toDouble(), 50.0); + QCOMPARE(obj->property("verticalRadius").toDouble(), 50.0); + QCOMPARE(obj->property("maskSource").toInt(), 0); + QCOMPARE(obj->property("angle").toDouble(), 0.0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::linearGradient() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "LinearGradient {" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("gradient").toInt(), 0); + QCOMPARE(obj->property("start").toPointF(), QPointF(0.0, 0.0)); + QCOMPARE(obj->property("end").toPointF(), QPointF(0.0, 50.0)); + QCOMPARE(obj->property("maskSource").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::rectangularGlow() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "RectangularGlow {" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("spread").toDouble(), 0.0); + QCOMPARE(obj->property("glowRadius").toDouble(), 0.0); + QCOMPARE(obj->property("color").toString(), QString("#ffffff")); + QCOMPARE(obj->property("cornerRadius").toDouble(), 0.0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::conicalGradient() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "ConicalGradient {" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("angle").toDouble(), 0.0); + QCOMPARE(obj->property("gradient").toInt(), 0); + QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("maskSource").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::colorOverlay() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "ColorOverlay {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("color").toString(), QString("#000000")); + + delete obj; +} + +void tst_qtgraphicaleffects::gaussianBlur() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "GaussianBlur {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("radius").toDouble(), 0.0); + QCOMPARE(obj->property("maximumRadius").toInt(), 0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + + double res = obj->property("deviation").toDouble(); + QVERIFY(res < 0.3000 + 0.0001); + QVERIFY(res > 0.3000 - 0.0001); + + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::dropShadow() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "DropShadow {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("radius").toDouble(), 0.0); + QCOMPARE(obj->property("maximumRadius").toInt(), 0); + QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("color").toString(), QString("#000000")); + QCOMPARE(obj->property("spread").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::fastDropShadow() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "FastDropShadow {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("blur").toDouble(), 0.0); + QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("color").toString(), QString("#000000")); + QCOMPARE(obj->property("spread").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::gammaAdjust() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "GammaAdjust {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + //qDebug() << component.errorString(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("gamma").toDouble(), 1.0); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::thresholdMask() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "ThresholdMask {" + "width: 50; height: 50\n" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "maskSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("maskSource").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("threshold").toDouble(), 0.0); + QCOMPARE(obj->property("spread").toDouble(), 0.0); + + delete obj; +} + +void tst_qtgraphicaleffects::glow() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "Glow {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("radius").toDouble(), 0.0); + QCOMPARE(obj->property("maximumRadius").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("spread").toDouble(), 0.0); + QCOMPARE(obj->property("color").toString(), QString("#ffffff")); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::fastGlow() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "FastGlow {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("blur").toDouble(), 0.0); + QCOMPARE(obj->property("spread").toDouble(), 0.0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("color").toString(), QString("#ffffff")); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::blend() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "Blend {" + "backgroundSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "foregroundSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("backgroundSource").toInt(), 0); + QCOMPARE(obj->property("foregroundSource").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("mode").toString(), QString("normal")); + + delete obj; +} + +void tst_qtgraphicaleffects::displace() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "Displace {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "displacementSource: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("source").toInt(), 0); + QCOMPARE(obj->property("displacementSource").toInt(), 0); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("displacement").toDouble(), 0.0); + + delete obj; +} + +void tst_qtgraphicaleffects::recursiveBlur() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "RecursiveBlur {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("loops").toInt(), 0); + QCOMPARE(obj->property("radius").toDouble(), 0.0); + QCOMPARE(obj->property("progress").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::directionalBlur() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "DirectionalBlur {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("lenght").toInt(), 0); + QCOMPARE(obj->property("samples").toDouble(), 0.0); + QCOMPARE(obj->property("angle").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + QCOMPARE(obj->property("cached").toBool(), false); + + delete obj; +} + +void tst_qtgraphicaleffects::radialBlur() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "RadialBlur {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("samples").toDouble(), 0.0); + QCOMPARE(obj->property("angle").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0); + + delete obj; +} + +void tst_qtgraphicaleffects::zoomBlur() +{ + // Creation + QString componentStr = "import QtQuick 2.0\n" + "import effects 0.1\n" + "ZoomBlur {" + "source: ShaderEffectSource {sourceItem: Rectangle {width: 100; height: 100}}" + "width: 50; height: 50\n" + "}"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QObject *obj = component.create(); + QTest::qWait(100); + QVERIFY(obj != 0); + + // Default values + QCOMPARE(obj->property("lenght").toInt(), 0); + QCOMPARE(obj->property("samples").toDouble(), 0.0); + QCOMPARE(obj->property("transparentBorder").toBool(), false); + QCOMPARE(obj->property("cached").toBool(), false); + QCOMPARE(obj->property("horizontalOffset").toDouble(), 0.0); + QCOMPARE(obj->property("verticalOffset").toDouble(), 0.0); + + delete obj; +} + +QTEST_MAIN(tst_qtgraphicaleffects) + +#include "tst_qtgraphicaleffects.moc" diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro new file mode 100644 index 0000000..0e7e6e4 --- /dev/null +++ b/tests/manual/manual.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +OTHER_FILES = testbed/*.qml +#SUBDIRS += testbed + diff --git a/tests/manual/testbed/BGColorPicker.qml b/tests/manual/testbed/BGColorPicker.qml new file mode 100644 index 0000000..176d9e7 --- /dev/null +++ b/tests/manual/testbed/BGColorPicker.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Label { + id: bgColorPicker + property string color: "#242424" + caption: "Background color" + Image { + id: highlight + source: "images/color_selection_hl.png" + width: 18; height: 18; + x: 37 + y: 0 + } + + Row { + y: 3 + spacing: 8 + Rectangle { width: 12; height: 12; color: "#ffffff" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Rectangle { width: 12; height: 12; color: "#ababab" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Rectangle { width: 12; height: 12; color: "#242424" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Rectangle { width: 12; height: 12; color: "#000000" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.color + highlight.x = parent.x - 3 + } + } + } + Image {source: "images/background.png" + MouseArea { + anchors.fill: parent + onClicked: { + bgColorPicker.color = parent.source + highlight.x = parent.x - 3 + } + } + } + } +} diff --git a/tests/manual/testbed/CheckBox.qml b/tests/manual/testbed/CheckBox.qml new file mode 100644 index 0000000..15ef837 --- /dev/null +++ b/tests/manual/testbed/CheckBox.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: checkBox + property string caption: "" + property bool selected: true + property bool pressed: mouse.pressed + anchors {left: parent.left; right: parent.right} + height: 20 + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: checkBox.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Image { + id: button + anchors {left: captionText.right; leftMargin: 5; verticalCenter: parent.verticalCenter} + source: "images/checkbox_outer.png" + smooth: true + Image { + id: buttonFill + anchors.centerIn: parent + source: "images/checkbox_inner.png" + smooth: true + visible: checkBox.selected + } + } + + MouseArea { + id: mouse + anchors.fill: parent + anchors.rightMargin: 160 + onClicked: checkBox.selected = !checkBox.selected + preventStealing: true + } +} diff --git a/tests/manual/testbed/ColorPicker.qml b/tests/manual/testbed/ColorPicker.qml new file mode 100755 index 0000000..1683771 --- /dev/null +++ b/tests/manual/testbed/ColorPicker.qml @@ -0,0 +1,273 @@ +/***************************************************************************** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Add-On Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** +** You may use this file under the terms of the BSD license as follows: +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE. +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: root + property color color: Qt.hsla(hue, saturation, lightness, alpha) + + property alias hue: hueSlider.value + property alias saturation: saturationSlider.value + property alias lightness: lightnessSlider.value + property alias alpha: alphaSlider.value + + width: parent.width + height: 100 + + Image { + anchors.fill: map + source: "images/background.png" + fillMode: Image.Tile + } + + Rectangle { + id: colorBox + anchors.fill: map + color: root.color + } + + ShaderEffect { + id: map + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + width: 68 + height: width + property real hue: root.hue + opacity: 0.01 + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform highp float hue; + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 c = vec4(1.0); + //c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s)); + c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.y, 0.5 * qt_TexCoord0.x * (qt_TexCoord0.y + 1.0))); + gl_FragColor = c * qt_Opacity; + } + " + + MouseArea { + id: mapMouseArea + anchors.fill: parent + hoverEnabled: true + onPositionChanged: { + if (pressed) { + var xx = Math.max(0, Math.min(mouse.x, parent.width)) + var yy = Math.max(0, Math.min(mouse.y, parent.height)) + crosshair.x = xx - crosshair.width / 2 + crosshair.y = yy - crosshair.height / 2 + root.saturation = 1.0 - yy / parent.height + root.lightness = 0.5 * xx / parent.width * (yy / parent.height + 1.0) + } + } + onEntered: map.opacity = 1 + onReleased: { + if (mouse.x < 0 || mouse.x > parent.width || mouse.y < 0 || mouse.y > parent.height) { + map.opacity = 0.01; + } + } + onPressed: positionChanged(mouse) + onExited: { + if (!pressed) { + map.opacity = 0.01; + } + } + } + + Image { + id: crosshair + source: "images/slider_handle.png" + x: root.lightness * parent.width - width / 2 + y: (1.0 - root.saturation) * parent.height - height / 2 + } + + Behavior on opacity { PropertyAnimation { duration: 100 } } + } + + + Column { + anchors.left: parent.left + anchors.right: parent.right + + ColorSlider { + id: hueSlider + minimum: 0.0 + maximum: 1.0 + value: 0.5 + caption: "H" + trackItem: Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop {position: 0.000; color: Qt.rgba(1, 0, 0, 1)} + GradientStop {position: 0.167; color: Qt.rgba(1, 1, 0, 1)} + GradientStop {position: 0.333; color: Qt.rgba(0, 1, 0, 1)} + GradientStop {position: 0.500; color: Qt.rgba(0, 1, 1, 1)} + GradientStop {position: 0.667; color: Qt.rgba(0, 0, 1, 1)} + GradientStop {position: 0.833; color: Qt.rgba(1, 0, 1, 1)} + GradientStop {position: 1.000; color: Qt.rgba(1, 0, 0, 1)} + } + } + } + + ColorSlider { + id: saturationSlider + minimum: 0.0 + maximum: 1.0 + value: 1.0 + caption: "S" + handleOpacity: 1.5 - map.opacity + trackItem: Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop { position: 0; color: Qt.hsla(root.hue, 0.0, root.lightness, 1.0) } + GradientStop { position: 1; color: Qt.hsla(root.hue, 1.0, root.lightness, 1.0) } + } + } + } + + ColorSlider { + id: lightnessSlider + minimum: 0.0 + maximum: 1.0 + value: 0.5 + caption: "L" + handleOpacity: 1.5 - map.opacity + trackItem: Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop { position: 0; color: 'black' } + GradientStop { position: 0.5; color: Qt.hsla(root.hue, root.saturation, 0.5, 1.0) } + GradientStop { position: 1; color: 'white' } + } + } + } + + ColorSlider { + id: alphaSlider + minimum: 0.0 + maximum: 1.0 + value: 1.0 + caption: "A" + trackItem:Item { + anchors.fill: parent + Image { + anchors {fill: parent; leftMargin: 5; rightMargin: 5} + source: "images/background.png" + fillMode: Image.TileHorizontally + } + Rectangle { + width: parent.height + height: parent.width - 10 + color: "red" + rotation: -90 + transformOrigin: Item.TopLeft + y: width + x: 5 + gradient: Gradient { + GradientStop { position: 0; color: "transparent" } + GradientStop { position: 1; color: Qt.hsla(root.hue, root.saturation, root.lightness, 1.0) } + } + } + } + } + + Label { + caption: "ARGB" + text: "#" + ((Math.ceil(root.alpha * 255) + 256).toString(16).substr(1, 2) + root.color.toString().substr(1, 6)).toUpperCase(); + } + } +} diff --git a/tests/manual/testbed/ColorSlider.qml b/tests/manual/testbed/ColorSlider.qml new file mode 100755 index 0000000..54a902f --- /dev/null +++ b/tests/manual/testbed/ColorSlider.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: colorSlider + + property real value: 1 + property real maximum: 1 + property real minimum: 0 + property string caption: "" + property bool pressed: mouseArea.pressed + property bool integer: false + property string handleSource: "images/slider_handle.png" + property real handleOpacity: 1.0 + property alias trackItem: track.children + + width: parent.width + height: 20 + + function updatePos() { + if (maximum > minimum) { + var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5; + return Math.min(Math.max(pos, 5), track.width - 5) - 10; + } else { + return 5; + } + } + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: colorSlider.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueCaption + anchors.left: captionText.right + anchors.verticalCenter: parent.verticalCenter + width: 35 + horizontalAlignment: Text.AlignRight + text: colorSlider.value.toFixed(1) + font.family: "Arial" + font.pixelSize: 11 + color: "#999999" + } + + Item { + id: track + height: 4 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width / 2 + anchors.right: parent.right + anchors.rightMargin: 10 + + Image { + id: handle; + anchors.verticalCenter: parent.verticalCenter + smooth: true + source: mouseArea.pressed ? 'images/slider_handle_pressed.png' : colorSlider.handleSource + opacity: colorSlider.handleOpacity + x: updatePos() + z: 1 + } + + MouseArea { + id: mouseArea + anchors {left: parent.left; right: parent.right; leftMargin: 5; rightMargin: 5; verticalCenter: parent.verticalCenter} + height: 8 + + onPressed: { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = colorSlider.integer ? Math.round(realValue) : realValue; + } + + onPositionChanged: { + if (pressed) { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = colorSlider.integer ? Math.round(realValue) : realValue; + } + } + } + } +} diff --git a/tests/manual/testbed/Control.qml b/tests/manual/testbed/Control.qml new file mode 100644 index 0000000..76a1dfd --- /dev/null +++ b/tests/manual/testbed/Control.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: control + property string caption: "" + default property alias children: controlsColumn.children + property bool last: false + + property bool __hide: caption == "advanced" + + anchors {left: parent.left; right: parent.right} + height: __hide ? 30 : controlsColumn.height + 40 + + Behavior on height { + NumberAnimation { duration: 100 } + } + + Image { + source: "images/group_top.png" + anchors {top: parent.top; left: parent.left; right: parent.right} + } + + Image { + source: "images/group_bottom.png" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + smooth: true + visible: !last || __hide + } + + Text { + id: sectionText + anchors {left: parent.left; top: parent.top; leftMargin: 11; topMargin: 8} + color: "white" + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + text: caption + } + + Image { + anchors {right: parent.right; rightMargin: 5; top: parent.top} + source: __hide ? "images/expand.png" : "images/collapse.png" + } + + MouseArea { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 30 + onClicked: control.__hide = !control.__hide + } + + Column { + id: controlsColumn + anchors.top: parent.top + anchors.topMargin: 30 + anchors.left: parent.left + anchors.right: parent.right + opacity: !__hide + Behavior on opacity { + NumberAnimation { duration: 100 } + } + } +} diff --git a/tests/manual/testbed/ImageSource.qml b/tests/manual/testbed/ImageSource.qml new file mode 100644 index 0000000..5ad02d3 --- /dev/null +++ b/tests/manual/testbed/ImageSource.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Image { + id: is + source: "images/bug.jpg" + smooth: true + visible: sourceType.value == "shaderEffectSource" + anchors.fill: parent + fillMode: Image.PreserveAspectFit + sourceSize: width > height ? Qt.size(0, parent.height) : Qt.size(parent.width, 0) + + property bool forcedUpdateAnimationRunning: false + Rectangle { + x: is.width - 10 - width + y: 10 + width: 25 + height: 25 + visible: is.forcedUpdateAnimationRunning + color: "#229933" + NumberAnimation on rotation { + id: dd + running: is.forcedUpdateAnimationRunning + loops: Animation.Infinite + duration: 5000 + from: 0.0 + to: 360.0 + } + } +} diff --git a/tests/manual/testbed/Label.qml b/tests/manual/testbed/Label.qml new file mode 100644 index 0000000..2bad339 --- /dev/null +++ b/tests/manual/testbed/Label.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: label + property string caption: "" + property string text: "" + default property alias children: childrenItem.children + anchors {left: parent.left; right: parent.right} + height: Math.max(20, childrenItem.height) + + Text { + id: captionText + width: 110 + height: 20 + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: label.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueText + anchors {left: captionText.right; right: parent.right; leftMargin: 11; verticalCenter: parent.verticalCenter} + height: 20 + verticalAlignment: Text.AlignVCenter + text: label.text + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + visible: label.text.length > 0 + } + + Item { + id: childrenItem + anchors {left: captionText.right; leftMargin: 11; right: parent.right} + height: childrenRect.height + } +} diff --git a/tests/manual/testbed/PositionPicker.qml b/tests/manual/testbed/PositionPicker.qml new file mode 100755 index 0000000..522a690 --- /dev/null +++ b/tests/manual/testbed/PositionPicker.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Image { + id: positionPicker + property real xValue: 0 + property real yValue: 0 + + x: xValue - positionPicker.width / 2 + y: yValue - positionPicker.height / 2 + + property alias pressed: mouseArea.pressed + + source: pressed ? "images/slider_handle_pressed.png" : "images/slider_handle.png" + + MouseArea { + id: mouseArea + + property real startX + property real startY + + anchors.fill: parent + onPressed: { + startX = mouseX; + startY = mouseY; + } + + onPositionChanged: { + xValue = positionPicker.x + positionPicker.width / 2 + mouseX - startX; + yValue = positionPicker.y + positionPicker.height / 2 + mouseY - startY; + + positionPicker.x += mouseX - startX; + positionPicker.y += mouseY - startY; + } + } +} diff --git a/tests/manual/testbed/ProgressBar.qml b/tests/manual/testbed/ProgressBar.qml new file mode 100644 index 0000000..cd77a0a --- /dev/null +++ b/tests/manual/testbed/ProgressBar.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: slider + + property real value: 1 + property real maximum: 1 + property real minimum: 0 + property string caption: "" + property bool integer: false + + width: parent.width + height: 20 + + function updatePos() { + if (maximum > minimum) { + var pos = (track.width) * (value - minimum) / (maximum - minimum); + return Math.min(Math.max(pos, 0), track.width); + } else { + return 0; + } + } + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: slider.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueCaption + anchors.left: captionText.right + anchors.verticalCenter: parent.verticalCenter + width: 35 + horizontalAlignment: Text.AlignRight + text: slider.value.toFixed(1) + font.family: "Arial" + font.pixelSize: 11 + color: "#999999" + } + + Item { + id: track + height: parent.height + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width / 2 + anchors.right: parent.right + anchors.rightMargin: 10 + + BorderImage { + source: "images/slider_track.png" + anchors.left: parent.left + anchors.right: parent.right + border.right: 2 + } + + BorderImage { + id: trackFilled + anchors.left: parent.left + width: updatePos() + source: "images/slider_track_filled.png" + border.left: 3 + border.right: 3 + } + } +} diff --git a/tests/manual/testbed/RadioButton.qml b/tests/manual/testbed/RadioButton.qml new file mode 100644 index 0000000..7732093 --- /dev/null +++ b/tests/manual/testbed/RadioButton.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: radioButton + property string caption: "" + property bool selected: false + property bool pressed: mouse.pressed + anchors {left: parent.left; right: parent.right} + height: 20 + + Text { + id: captionText + anchors {left: parent.horizontalCenter; leftMargin: -5; right: parent.right; verticalCenter: parent.verticalCenter} + horizontalAlignment: Text.AlignLeft + text: radioButton.caption + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Image { + id: button + anchors {right: captionText.left; rightMargin: 10; verticalCenter: parent.verticalCenter} + source: "images/radiobutton_outer.png" + smooth: true + Image { + id: buttonFill + anchors.centerIn: parent + source: "images/radiobutton_inner.png" + smooth: true + visible: radioButton.selected + } + } + + MouseArea { + id: mouse + anchors.fill: parent + anchors.leftMargin: 115 + preventStealing: true + } +} diff --git a/tests/manual/testbed/RadioButtonColumn.qml b/tests/manual/testbed/RadioButtonColumn.qml new file mode 100644 index 0000000..4deff71 --- /dev/null +++ b/tests/manual/testbed/RadioButtonColumn.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: radioButtoncolumn + property string value: "" + property string prefixCaption: "" + default property alias children: buttons.children + property string caption: "" + + width: parent.width + height: buttons.height + + Text { + id: captionText + anchors {top: parent.top; topMargin: 4} + width: 110 + horizontalAlignment: Text.AlignRight + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + text: radioButtoncolumn.caption + ':' + } + + Column { + id: buttons + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } +} diff --git a/tests/manual/testbed/RgbaColorPicker.qml b/tests/manual/testbed/RgbaColorPicker.qml new file mode 100644 index 0000000..c93a180 --- /dev/null +++ b/tests/manual/testbed/RgbaColorPicker.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: rgbaSlider + property alias rValue: rSlider.value + property alias gValue: gSlider.value + property alias bValue: bSlider.value + property alias aValue: aSlider.value + property bool pressed: rSlider.pressed || gSlider.pressed || bSlider.pressed || aSlider.pressed + + width: parent.width + height: childrenRect.height + + function dec2hex(i) + { + if (i <= 15) + return "0" + i.toString(16); + else + return i.toString(16); + } + + Rectangle { + id: colorRect + width: 50; height: 50 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.verticalCenter: sliders.verticalCenter + color: Qt.rgba(rgbaSlider.rValue, rgbaSlider.gValue, rgbaSlider.bValue, rgbaSlider.aValue) + } + Column { + id: sliders + anchors {left: parent.left; right: parent.right} + Slider { + id: aSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'A' + } + Slider { + id: rSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'R' + } + Slider { + id: gSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'G' + } + Slider { + id: bSlider + minimum: 0 + maximum: 1 + value: 1.0 + caption: 'B' + } + + } +// Text { +// anchors.top: colorRect.bottom +// anchors.topMargin: 5 +// anchors.horizontalCenter: colorRect.horizontalCenter +// horizontalAlignment: Text.AlignHCenter +// text: "#" + dec2hex(Math.round(rgbaSlider.aValue * 255)) + dec2hex(Math.round(rgbaSlider.rValue * 255)) + dec2hex(Math.round(rgbaSlider.gValue * 255)) + dec2hex(Math.round(rgbaSlider.bValue * 255)) +// font.capitalization: Font.AllUppercase +// color: "#999999" +// font.pixelSize: 11 +// } +} diff --git a/tests/manual/testbed/Slider.qml b/tests/manual/testbed/Slider.qml new file mode 100755 index 0000000..9def5be --- /dev/null +++ b/tests/manual/testbed/Slider.qml @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: slider + + property real value: 1 + property real maximum: 1 + property real minimum: 0 + property string caption: "" + property bool pressed: mouseArea.pressed + property bool integer: false + property string handleSource: "images/slider_handle.png" + + width: parent.width + height: 20 + + function updatePos() { + if (maximum > minimum) { + var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5; + return Math.min(Math.max(pos, 5), track.width - 5) - 10; + } else { + return 5; + } + } + + Text { + id: captionText + width: 110 + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.AlignRight + text: slider.caption + ':' + font.family: "Arial" + font.pixelSize: 11 + color: "#B3B3B3" + } + + Text { + id: valueCaption + anchors.left: captionText.right + anchors.verticalCenter: parent.verticalCenter + width: 35 + horizontalAlignment: Text.AlignRight + text: slider.value.toFixed(1) + font.family: "Arial" + font.pixelSize: 11 + color: "#999999" + } + + Item { + id: track + height: parent.height + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: parent.width / 2 + anchors.right: parent.right + anchors.rightMargin: 10 + + BorderImage { + source: "images/slider_track.png" + anchors.left: parent.left + anchors.right: parent.right + border.right: 2 + } + + BorderImage { + id: trackFilled + anchors.left: minimum == -maximum ? (value < 0 ? handle.horizontalCenter : parent.horizontalCenter) : parent.left + anchors.right: minimum == -maximum && value < 0 ? parent.horizontalCenter : handle.horizontalCenter + source: "images/slider_track_filled.png" + border.left: 3 + border.right: 3 + } + + Image { + id: handle; + smooth: true + source: mouseArea.pressed ? 'images/slider_handle_pressed.png' : slider.handleSource + x: updatePos() + } + + MouseArea { + id: mouseArea + anchors {left: parent.left; right: parent.right; leftMargin: 5; rightMargin: 5; verticalCenter: parent.verticalCenter} + height: 4 + + onPressed: { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = slider.integer ? Math.round(realValue) : realValue; + } + + onPositionChanged: { + if (pressed) { + var handleX = Math.max(0, Math.min(mouseX, mouseArea.width)) + var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum; + value = slider.integer ? Math.round(realValue) : realValue; + } + } + } + } +} diff --git a/tests/manual/testbed/TestBedModel.qml b/tests/manual/testbed/TestBedModel.qml new file mode 100644 index 0000000..a98e94d --- /dev/null +++ b/tests/manual/testbed/TestBedModel.qml @@ -0,0 +1,67 @@ +/***************************************************************************** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Add-On Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** +** You may use this file under the terms of the BSD license as follows: +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the +** names of its contributors may be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +** POSSIBILITY OF SUCH DAMAGE. +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ + +import QtQuick 2.0 + +ListModel { + id: testcaseModel + ListElement { name: "TestBlend.qml"; group: "Blend"; last: true } + ListElement { name: "TestDisplace.qml"; group: "Distortion"; last: true } + ListElement { name: "TestOpacityMask.qml"; group: "Mask" } + ListElement { name: "TestThresholdMask.qml"; group: "Mask"; last: true } + ListElement { name: "TestFastGlow.qml"; group: "Glow" } + ListElement { name: "TestGlow.qml"; group: "Glow" } + ListElement { name: "TestRectangularGlow.qml"; group: "Glow"; last: true } + ListElement { name: "TestFastBlur.qml"; group: "Blur" } + ListElement { name: "TestGaussianBlur.qml"; group: "Blur" } + ListElement { name: "TestRecursiveBlur.qml"; group: "Blur"; last: true } + ListElement { name: "TestDirectionalBlur.qml"; group: "Motion Blur"; } + ListElement { name: "TestRadialBlur.qml"; group: "Motion Blur"; } + ListElement { name: "TestZoomBlur.qml"; group: "Motion Blur"; last: true } + ListElement { name: "TestFastDropShadow.qml"; group: "Drop Shadow" } + ListElement { name: "TestDropShadow.qml"; group: "Drop Shadow"; last: true } + ListElement { name: "TestLinearGradient.qml"; group: "Gradient" } + ListElement { name: "TestConicalGradient.qml"; group: "Gradient" } + ListElement { name: "TestRadialGradient.qml"; group: "Gradient"; last: true } + ListElement { name: "TestColorize.qml"; group: "Color" } + ListElement { name: "TestColorOverlay.qml"; group: "Color" } + ListElement { name: "TestHueSaturation.qml"; group: "Color" } + ListElement { name: "TestBrightnessContrast.qml"; group: "Color" } + ListElement { name: "TestDesaturate.qml"; group: "Color" } + ListElement { name: "TestGammaAdjust.qml"; group: "Color"; last: true } +} diff --git a/tests/manual/testbed/TestBlend.qml b/tests/manual/testbed/TestBlend.qml new file mode 100644 index 0000000..0c9caf1 --- /dev/null +++ b/tests/manual/testbed/TestBlend.qml @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource1 + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ImageSource { + id: imageSource2 + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource1 + sourceItem: imageSource1 + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + ShaderEffectSource { + id: shaderEffectSource2 + sourceItem: imageSource2 + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + Blend { + id: effect + anchors.fill: imageSource1 + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + backgroundSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource1 : imageSource1 + foregroundSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource2 : imageSource2 + mode: blendMode.value + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + + RadioButtonColumn { + id: blendMode + value: "normal" + caption: "mode" + RadioButton { + caption: "normal" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "addition" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "darken" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "difference" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "divide" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "multiply" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "lighten" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "screen" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + RadioButton { + caption: "subtract" + selected: caption == blendMode.value + onPressedChanged: blendMode.value = caption + } + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestBrightnessContrast.qml b/tests/manual/testbed/TestBrightnessContrast.qml new file mode 100644 index 0000000..dd57f5a --- /dev/null +++ b/tests/manual/testbed/TestBrightnessContrast.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + onLiveChanged: scheduleUpdate() + } + + BrightnessContrast { + id: effect + anchors.fill: imageSource + brightness: brigthnessSlider.value + contrast: contrastSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: brigthnessSlider + minimum: -1.0 + maximum: 1.0 + value: 0.0 + caption: "brightness" + } + Slider { + id: contrastSlider + minimum: -1.0 + maximum: 1.0 + value: 0.0 + caption: "contrast" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestCaseTemplate.qml b/tests/manual/testbed/TestCaseTemplate.qml new file mode 100644 index 0000000..109912a --- /dev/null +++ b/tests/manual/testbed/TestCaseTemplate.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: main + + property real imageSize: Math.min(height, width - 220) + default property alias testItem : testItemContainer.children + property alias controls: controlsColumn.children + property string currentTest: "" + property string fps: "nan" + property string bgColor: "black" + + property int dummy: 0 + property int fpsCount: 0 + + anchors.fill: parent + color: bgColor.charAt(0) == '#' ? bgColor : "red" + + onDummyChanged: fpsCount++; + + NumberAnimation on dummy { + duration: 500 + from: 0 + to: 10000 + loops: Animation.Infinite + } + + Timer { + interval: 1000 + repeat: true + running: true + onTriggered: { + fps = "" + fpsCount; + fpsCount = 0; + } + } + + Image { + id: background + anchors.fill: parent + fillMode: Image.Tile + source: bgColor.substring(0,7) == "file://" ? bgColor : "" + } + + Item { + id: testItemContainer + property real margin: 0 + x: (parent.width - testParameterContainer.width - width) / 2 + anchors.verticalCenter: parent.verticalCenter + anchors.top: undefined + width: Math.min(parent.height - 20, parent.width - testParameterContainer.width - 20) + height: width + } + + Image { + id: titlebar + source: "images/title.png" + anchors.top: parent.top + anchors.right: parent.right + width: 300 + + Text { + id: effectsListTitle + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: currentTest + color: "white" + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + } + } + + Rectangle { + id: testParameterContainer + anchors.top: titlebar.bottom + anchors.bottom: parent.bottom + anchors.right: parent.right + width: 300 + color: "#171717" + + Flickable { + id: slidersFlickable + anchors.fill: parent + contentHeight: childrenRect.height + interactive: contentHeight > height + clip: true + + Column { + id: controlsColumn + anchors.left: parent.left + anchors.right: parent.right + } + } + } +} diff --git a/tests/manual/testbed/TestColorOverlay.qml b/tests/manual/testbed/TestColorOverlay.qml new file mode 100755 index 0000000..1fe9273 --- /dev/null +++ b/tests/manual/testbed/TestColorOverlay.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + anchors.fill: imageSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + onLiveChanged: scheduleUpdate() + } + + ColorOverlay { + id: effect + anchors.fill: imageSource + color: colorPicker.color + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + alpha: 0.5 + } + }, + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestColorize.qml b/tests/manual/testbed/TestColorize.qml new file mode 100644 index 0000000..4e5f729 --- /dev/null +++ b/tests/manual/testbed/TestColorize.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + source: "images/butterfly.png" + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + Colorize { + id: effect + anchors.fill: imageSource + hue: colorPicker.hue + saturation: colorPicker.saturation + lightness: colorPicker.lightness + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + ColorPicker { + id: colorPicker + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + } + }, + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestConicalGradient.qml b/tests/manual/testbed/TestConicalGradient.qml new file mode 100755 index 0000000..8e2794d --- /dev/null +++ b/tests/manual/testbed/TestConicalGradient.qml @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: maskImage + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: maskSource + sourceItem: maskImage + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ConicalGradient { + id: effect + anchors.fill: parent + cached: cachedCheckBox.selected + visible: enabledCheckBox.selected + maskSource: maskCheckBox.selected ? (sourceType.value == "shaderEffectSource" ? maskSource : maskImage) : undefined + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + gradient: Gradient { + GradientStop {position: 0.0; color: gradientBeginColorSlider.color} + GradientStop {position: 1.0; color: gradientEndColorSlider.color} + } + angle: startAngleSlider.value + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: startAngleSlider + caption: "angle" + minimum: -360 + maximum: 360 + value: 0 + } + CheckBox { + id: maskCheckBox + caption: "Use Mask" + } + }, + + Control { + caption: "gradient begin color" + ColorPicker { + id: gradientBeginColorSlider + hue: 340/360 + saturation: 0.9 + lightness: 0.27 + } + }, + + Control { + caption: "gradient end color" + ColorPicker { + id: gradientEndColorSlider + hue: 46/360 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDesaturate.qml b/tests/manual/testbed/TestDesaturate.qml new file mode 100644 index 0000000..1191eb6 --- /dev/null +++ b/tests/manual/testbed/TestDesaturate.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + Desaturate { + id: effect + anchors.fill: imageSource + desaturation: grayscaleSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: grayscaleSlider + minimum: 0 + maximum: 1.0 + value: 1.0 + caption: "desaturation" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDirectionalBlur.qml b/tests/manual/testbed/TestDirectionalBlur.qml new file mode 100644 index 0000000..4742deb --- /dev/null +++ b/tests/manual/testbed/TestDirectionalBlur.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + DirectionalBlur { + id: effect + anchors.fill: imageSource + transparentBorder: transparentBorderCheckBox.selected + angle: angleSlider.value + length: lengthSlider.value + samples: samplesSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: angleSlider + minimum: -180.0 + maximum: 180.0 + value: 90.0 + caption: "angle" + } + Slider { + id: lengthSlider + minimum: 0.0 + maximum: 64.0 + value: 32.0 + caption: "length" + } + Slider { + id: samplesSlider + minimum: 0 + maximum: 32 + value: 32 + caption: "samples" + integer: true + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDisplace.qml b/tests/manual/testbed/TestDisplace.qml new file mode 100644 index 0000000..d5749bd --- /dev/null +++ b/tests/manual/testbed/TestDisplace.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + ImageSource { + id: imageSource + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + Rectangle { + id: displacementMapSource + visible: !enabledCheckBox.selected + color: "#8080ff" + smooth: true + anchors.fill: parent + Image { + id: di + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + sourceSize: Qt.size(128, 128) + source: "images/displacementmap.png" + smooth: true + } + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: false + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ShaderEffectSource { id: shaderEffectNormalSource + sourceItem: displacementMapSource + live: true + hideSource: enabledCheckBox.selected + smooth: true + visible: false + } + + Displace { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + displacementSource: sourceType.value == "shaderEffectSource" ? shaderEffectNormalSource : di + displacement: displacementScaleSlider.value + smooth: true + MouseArea { + anchors.fill: parent + onClicked: { di.x = mouseX - di.width/2; di.y = mouseY - di.height/2; } + onPositionChanged: { if (pressed) { di.x = mouseX - di.width/2; di.y = mouseY - di.height/2; } } + } + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: displacementScaleSlider + caption: "displacement" + minimum: -1.0 + maximum: 1.0 + value: 0.1 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestDropShadow.qml b/tests/manual/testbed/TestDropShadow.qml new file mode 100755 index 0000000..eba7403 --- /dev/null +++ b/tests/manual/testbed/TestDropShadow.qml @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + DropShadow { + id: effect + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + anchors.fill: imageSource + radius: radiusSlider.value + spread: spreadSlider.value + maximumRadius: maximumRadiusSlider.value + color: colorPicker.color + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + anchors.fill: imageSource + sourceItem: imageSource + hideSource: false + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + 10 + yValue: effect.height / 2 + 10 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: radiusSlider + minimum: 0 + maximum: 16 + value: 8 + caption: "radius" + } + Slider { + id: maximumRadiusSlider + minimum: 0 + maximum: 16 + value: 8 + integer: true + caption: "maximumRadius" + } + Slider { + id: spreadSlider + minimum: 0 + maximum: 1.0 + value: 0.0 + caption: "spread" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 0 + lightness: 0 + alpha: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + color: "#ababab" + } + } + ] +} diff --git a/tests/manual/testbed/TestFastBlur.qml b/tests/manual/testbed/TestFastBlur.qml new file mode 100644 index 0000000..16515af --- /dev/null +++ b/tests/manual/testbed/TestFastBlur.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource; + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: enabledCheckBox.selected + onLiveChanged: scheduleUpdate() + } + + FastBlur { + id: effect + anchors.fill: imageSource + blur: blurSlider.value + transparentBorder: transparentBorderCheckBox.selected + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: blurSlider + minimum: 0.0 + maximum: 1.0 + value: 0.5 + caption: "blur" + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestFastDropShadow.qml b/tests/manual/testbed/TestFastDropShadow.qml new file mode 100755 index 0000000..d7aeffd --- /dev/null +++ b/tests/manual/testbed/TestFastDropShadow.qml @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + FastDropShadow { + id: effect + anchors.fill: imageSource + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + spread: spreadSlider.value + blur: blurLevelSlider.value + color: colorPicker.color + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + anchors.fill: imageSource + sourceItem: imageSource + hideSource: false + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + 10 + yValue: effect.height / 2 + 10 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: blurLevelSlider + minimum: 0 + maximum: 1.0 + value: 0.5 + caption: "blur" + } + Slider { + id: spreadSlider + minimum: 0 + maximum: 1.0 + value: 0.0 + caption: "spread" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 0 + lightness: 0 + alpha: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + color: "#ababab" + } + } + ] +} diff --git a/tests/manual/testbed/TestFastGlow.qml b/tests/manual/testbed/TestFastGlow.qml new file mode 100644 index 0000000..02525c0 --- /dev/null +++ b/tests/manual/testbed/TestFastGlow.qml @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + FastGlow { + id: effect + anchors.fill: imageSource + color: colorPicker.color + spread: spreadSlider.value + blur: blurLevelSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: false + smooth: true + visible: true + onLiveChanged: scheduleUpdate() + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: blurLevelSlider + minimum: 0 + maximum: 1.0 + value: 0.5 + caption: "blur" + } + Slider { + id: spreadSlider + caption: "spread" + minimum: 0.0 + maximum: 1.0 + value: 0.3 + } + CheckBox { + id: transparentBorderSwitch + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestGammaAdjust.qml b/tests/manual/testbed/TestGammaAdjust.qml new file mode 100644 index 0000000..f2f6f38 --- /dev/null +++ b/tests/manual/testbed/TestGammaAdjust.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + source: "images/butterfly.png" + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false + onLiveChanged: scheduleUpdate() + } + + GammaAdjust { + id: effect + anchors.fill: imageSource + gamma: gammaSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: gammaSlider + minimum: 0 + maximum: 2.0 + value: 1.0 + caption: "gamma" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestGaussianBlur.qml b/tests/manual/testbed/TestGaussianBlur.qml new file mode 100755 index 0000000..287af92 --- /dev/null +++ b/tests/manual/testbed/TestGaussianBlur.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + GaussianBlur { + id: effect + anchors.fill: imageSource + radius: radiusSlider.value + maximumRadius: maximumRadiusSlider.value + deviation: deviationSlider.value + transparentBorder: transparentBorderCheckBox.selected + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: maximumRadiusSlider + minimum: 0 + maximum: 16 + value: 16 + integer: true + caption: "maximumRadius" + } + Slider { + id: radiusSlider + minimum: 0.0 + maximum: 16.0 + value: 8.0 + caption: "radius" + } + Slider { + id: deviationSlider + minimum: 0 + maximum: 16 + value: (effect.radius + 1) / 3.3333 + caption: "deviation" + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestGlow.qml b/tests/manual/testbed/TestGlow.qml new file mode 100644 index 0000000..ca6006c --- /dev/null +++ b/tests/manual/testbed/TestGlow.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + Glow { + id: effect + anchors.fill: imageSource + color: colorPicker.color + spread: spreadSlider.value + radius: radiusSlider.value + maximumRadius: maximumRadiusSlider.value + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + ImageSource { + id: imageSource + source: "images/butterfly.png" + anchors.centerIn: parent + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: false + smooth: true + visible: true + onLiveChanged: scheduleUpdate() + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: radiusSlider + minimum: 0.0 + maximum: 16.0 + value: 8.0 + caption: "radius" + } + Slider { + id: spreadSlider + caption: "spread" + minimum: 0.0 + maximum: 1.0 + value: 0.3 + } + Slider { + id: maximumRadiusSlider + minimum: 0 + maximum: 16 + value: 8 + integer: true + caption: "maximumRadius" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestHueSaturation.qml b/tests/manual/testbed/TestHueSaturation.qml new file mode 100644 index 0000000..e1aa569 --- /dev/null +++ b/tests/manual/testbed/TestHueSaturation.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + forcedUpdateAnimationRunning: updateCheckBox.selected + source: "images/butterfly.png" + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + visible: false; onLiveChanged: scheduleUpdate() + } + + HueSaturation { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + hue: colorPicker.hue + saturation: colorPicker.saturation + lightness: colorPicker.lightness + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + ColorPicker { + id: colorPicker + hue: 0.5 + saturation: 0.5 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestLinearGradient.qml b/tests/manual/testbed/TestLinearGradient.qml new file mode 100755 index 0000000..5b059c2 --- /dev/null +++ b/tests/manual/testbed/TestLinearGradient.qml @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: maskImage + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: maskSource + sourceItem: maskImage + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true; visible: false; onLiveChanged: scheduleUpdate() } + + LinearGradient { + id: effect + anchors.fill: parent + cached: cachedCheckBox.selected + visible: enabledCheckBox.selected + maskSource: maskCheckBox.selected ? (sourceType.value == "shaderEffectSource" ? maskSource : maskImage) : undefined + start: Qt.point(startPicker.xValue, startPicker.yValue) + end: Qt.point(endPicker.xValue, endPicker.yValue) + gradient: Gradient { + GradientStop { + position: 0.0 + color: gradientBeginColorSlider.color + } + GradientStop { + position: 1.0 + color: gradientEndColorSlider.color + } + } + } + + PositionPicker { + id: startPicker + xValue: 150 + yValue: 150 + } + PositionPicker { + id: endPicker + xValue: 300 + yValue: 450 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "startX" + text: startPicker.xValue + } + Label { + caption: "startY" + text: startPicker.yValue + } + Label { + caption: "endX" + text: endPicker.xValue + } + Label { + caption: "endY" + text: endPicker.yValue + } + CheckBox { + id: maskCheckBox + caption: "Use Mask" + } + }, + + Control { + caption: "gradient begin color" + ColorPicker { + id: gradientBeginColorSlider + hue: 340/360 + saturation: 0.9 + lightness: 0.27 + } + }, + + Control { + caption: "gradient end color" + ColorPicker { + id: gradientEndColorSlider + hue: 46/360 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestOpacityMask.qml b/tests/manual/testbed/TestOpacityMask.qml new file mode 100644 index 0000000..4708eef --- /dev/null +++ b/tests/manual/testbed/TestOpacityMask.qml @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + ImageSource { + id: maskSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: shaderEffectSource1 + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + ShaderEffectSource { + id: shaderEffectSource2 + sourceItem: maskSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + OpacityMask { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource1 : imageSource + maskSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource2 : maskSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRadialBlur.qml b/tests/manual/testbed/TestRadialBlur.qml new file mode 100644 index 0000000..6dd5eb9 --- /dev/null +++ b/tests/manual/testbed/TestRadialBlur.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + RadialBlur { + id: effect + anchors.fill: imageSource + transparentBorder: transparentBorderCheckBox.selected + angle: lengthSlider.value + samples: samplesSlider.value + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: lengthSlider + minimum: -180.0 + maximum: 180.0 + value: 15.0 + caption: "angle" + } + Slider { + id: samplesSlider + minimum: 0 + maximum: 64 + value: 32 + caption: "samples" + integer: true + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRadialGradient.qml b/tests/manual/testbed/TestRadialGradient.qml new file mode 100755 index 0000000..33c2a6d --- /dev/null +++ b/tests/manual/testbed/TestRadialGradient.qml @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: maskImage + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + Text { + text: "MASK" + font.pixelSize: 60 + font.bold: true + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + } + } + + ShaderEffectSource { + id: maskSource + sourceItem: maskImage + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected; smooth: true; visible: false; onLiveChanged: scheduleUpdate() } + + RadialGradient { + id: effect + anchors.fill: parent + cached: cachedCheckBox.selected + visible: enabledCheckBox.selected + maskSource: maskCheckBox.selected ? (sourceType.value == "shaderEffectSource" ? maskSource : maskImage) : undefined + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + horizontalRadius: horizontalRadiusSlider.value + verticalRadius: verticalRadiusSlider.value + angle: angleSlider.value + gradient: Gradient { + GradientStop {position: 0.0; color: gradientBeginColorSlider.color} + GradientStop {position: 1.0; color: gradientEndColorSlider.color} + } + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + Slider { + id: horizontalRadiusSlider + minimum: 0 + maximum: effect.width + value: effect.width / 2 + caption: "horizontalRadius" + } + Slider { + id: verticalRadiusSlider + minimum: 0 + maximum: effect.height + value: effect.height / 2 + caption: "verticalRadius" + } + Slider { + id: angleSlider + minimum: 0 + maximum: 360 + value: 0 + caption: "angle" + } + CheckBox { + id: maskCheckBox + caption: "Use Mask" + } + }, + + Control { + caption: "gradient begin color" + ColorPicker { + id: gradientBeginColorSlider + hue: 340/360 + saturation: 0.9 + lightness: 0.27 + } + }, + + Control { + caption: "gradient end color" + ColorPicker { + id: gradientEndColorSlider + hue: 46/360 + saturation: 1 + lightness: 0.5 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRectangularGlow.qml b/tests/manual/testbed/TestRectangularGlow.qml new file mode 100644 index 0000000..27e2bc1 --- /dev/null +++ b/tests/manual/testbed/TestRectangularGlow.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + RectangularGlow { + id: effect + anchors.fill: rectSource + color: colorPicker.color + spread: spreadSlider.value + glowRadius: sizeSlider.value + visible: enabledCheckBox.selected + opacity: opacitySlider.value + cornerRadius: radiusSlider.value + } + + Rectangle { + id: rectSource + visible: true + anchors.centerIn: parent + width: Math.round(parent.width / 1.5) + height: Math.round(parent.height / 2) + radius: 25 + color: "#cc4b00" + smooth: true + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: spreadSlider + caption: "spread" + minimum: 0.0 + maximum: 1.0 + value: 0.5 + } + Slider { + id: sizeSlider + minimum: 0 + maximum: rectSource.width / 2.0 + value: 10.0 + caption: "glowRadius" + onValueChanged: radiusSlider.value = Math.max(0, Math.min(radiusSlider.value, radiusSlider.maximum)) + } + Slider { + id: radiusSlider + minimum: 0 + maximum: Math.min(effect.width, effect.height) / 2 + effect.glowRadius; + caption: "cornerRadius" + value: rectSource.radius + effect.glowRadius + } + Slider { + id: opacitySlider + minimum: 0 + maximum: 1.0 + value: 1.0 + caption: "opacity" + } + }, + + Control { + caption: "color" + ColorPicker { + id: colorPicker + hue: 0 + saturation: 1 + lightness: 1 + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestRecursiveBlur.qml b/tests/manual/testbed/TestRecursiveBlur.qml new file mode 100644 index 0000000..56acb31 --- /dev/null +++ b/tests/manual/testbed/TestRecursiveBlur.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + + ImageSource { + id: imageSource + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: true + hideSource: enabledCheckBox.selected + smooth: true + visible: false + } + + RecursiveBlur { + id: effect + loops: iterationSlider.value + anchors.fill: imageSource + radius: radiusSlider.value + transparentBorder: transparentBorderCheckBox.selected + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: iterationSlider + minimum: 0 + maximum: 500 + value: 0 + integer: true + caption: "loops" + } + Slider { + id: radiusSlider + minimum: 0.0 + maximum: 16.0 + value: 7.5 + caption: "radius" + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + ProgressBar { + id: progressSlider + minimum: 0 + maximum: 1.0 + value: effect.progress + caption: "progress" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestThresholdMask.qml b/tests/manual/testbed/TestThresholdMask.qml new file mode 100644 index 0000000..1f5c15b --- /dev/null +++ b/tests/manual/testbed/TestThresholdMask.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/bug.jpg" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + ImageSource { + id: maskSource + source: "images/fog.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource1 + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ShaderEffectSource { + id: shaderEffectSource2 + sourceItem: maskSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + visible: false + onLiveChanged: scheduleUpdate() + } + + ThresholdMask { + id: effect + anchors.fill: imageSource + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource1 : imageSource + maskSource: sourceType.value == "shaderEffectSource" ? shaderEffectSource2 : maskSource + threshold: thresholdSlider.value + spread: fringeSlider.value + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: thresholdSlider + minimum: 0.0 + maximum: 1.0 + value: 0.4 + caption: "threshold" + } + Slider { + id: fringeSlider + minimum: 0.0 + maximum: 1.0 + value: 0.2 + caption: "spread" + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/TestZoomBlur.qml b/tests/manual/testbed/TestZoomBlur.qml new file mode 100644 index 0000000..6885032 --- /dev/null +++ b/tests/manual/testbed/TestZoomBlur.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../../../src/effects" + +TestCaseTemplate { + ImageSource { + id: imageSource + source: "images/butterfly.png" + forcedUpdateAnimationRunning: updateCheckBox.selected + } + + ShaderEffectSource { + id: shaderEffectSource + sourceItem: imageSource + live: updateCheckBox.selected + hideSource: enabledCheckBox.selected + smooth: true + onLiveChanged: scheduleUpdate() + } + + ZoomBlur { + id: effect + anchors.fill: imageSource + transparentBorder: transparentBorderCheckBox.selected + length: lengthSlider.value + samples: samplesSlider.value + horizontalOffset: offsetPicker.xValue - width / 2 + verticalOffset: offsetPicker.yValue - height / 2 + visible: enabledCheckBox.selected + cached: cachedCheckBox.selected + source: sourceType.value == "shaderEffectSource" ? shaderEffectSource : imageSource + } + + PositionPicker { + id: offsetPicker + xValue: effect.width / 2 + yValue: effect.height / 2 + } + + bgColor: bgColorPicker.color + controls: [ + Control { + caption: "general" + Slider { + id: lengthSlider + minimum: 0.0 + maximum: 64.0 + value: 32.0 + caption: "length" + } + Slider { + id: samplesSlider + minimum: 0 + maximum: 32 + value: 32 + caption: "samples" + integer: true + } + CheckBox { + id: transparentBorderCheckBox + caption: "transparentBorder" + selected: false + } + Label { + caption: "horizontalOffset" + text: effect.horizontalOffset + } + Label { + caption: "verticalOffset" + text: effect.verticalOffset + } + }, + + Control { + caption: "advanced" + last: true + Label { + caption: "Effect size" + text: effect.width + "x" + effect.height + } + Label { + caption: "FPS" + text: fps + } + CheckBox { + id: cachedCheckBox + caption: "cached" + } + CheckBox { + id: enabledCheckBox + caption: "enabled" + } + CheckBox { + id: updateCheckBox + caption: "animated" + selected: false + } + RadioButtonColumn { + id: sourceType + value: "shaderEffectSource" + caption: "source type" + RadioButton { + caption: "shaderEffectSource" + selected: caption == sourceType.value + onPressedChanged: sourceType.value = caption + } + RadioButton { + caption: "image" + selected: caption == sourceType.value + onPressedChanged: { + sourceType.value = caption + updateCheckBox.selected = false + } + } + } + BGColorPicker { + id: bgColorPicker + } + } + ] +} diff --git a/tests/manual/testbed/images/background.png b/tests/manual/testbed/images/background.png Binary files differnew file mode 100644 index 0000000..458d33d --- /dev/null +++ b/tests/manual/testbed/images/background.png diff --git a/tests/manual/testbed/images/bug.jpg b/tests/manual/testbed/images/bug.jpg Binary files differnew file mode 100755 index 0000000..43e3676 --- /dev/null +++ b/tests/manual/testbed/images/bug.jpg diff --git a/tests/manual/testbed/images/butterfly.png b/tests/manual/testbed/images/butterfly.png Binary files differnew file mode 100644 index 0000000..ce544f2 --- /dev/null +++ b/tests/manual/testbed/images/butterfly.png diff --git a/tests/manual/testbed/images/checkbox_inner.png b/tests/manual/testbed/images/checkbox_inner.png Binary files differnew file mode 100644 index 0000000..52dce9c --- /dev/null +++ b/tests/manual/testbed/images/checkbox_inner.png diff --git a/tests/manual/testbed/images/checkbox_outer.png b/tests/manual/testbed/images/checkbox_outer.png Binary files differnew file mode 100644 index 0000000..6efa85f --- /dev/null +++ b/tests/manual/testbed/images/checkbox_outer.png diff --git a/tests/manual/testbed/images/checker.png b/tests/manual/testbed/images/checker.png Binary files differnew file mode 100644 index 0000000..b7f067b --- /dev/null +++ b/tests/manual/testbed/images/checker.png diff --git a/tests/manual/testbed/images/collapse.png b/tests/manual/testbed/images/collapse.png Binary files differnew file mode 100644 index 0000000..1b1259e --- /dev/null +++ b/tests/manual/testbed/images/collapse.png diff --git a/tests/manual/testbed/images/color_selection_hl.png b/tests/manual/testbed/images/color_selection_hl.png Binary files differnew file mode 100644 index 0000000..87de70b --- /dev/null +++ b/tests/manual/testbed/images/color_selection_hl.png diff --git a/tests/manual/testbed/images/displacementmap.png b/tests/manual/testbed/images/displacementmap.png Binary files differnew file mode 100755 index 0000000..7614db8 --- /dev/null +++ b/tests/manual/testbed/images/displacementmap.png diff --git a/tests/manual/testbed/images/expand.png b/tests/manual/testbed/images/expand.png Binary files differnew file mode 100644 index 0000000..49f9c15 --- /dev/null +++ b/tests/manual/testbed/images/expand.png diff --git a/tests/manual/testbed/images/fog.png b/tests/manual/testbed/images/fog.png Binary files differnew file mode 100644 index 0000000..f462222 --- /dev/null +++ b/tests/manual/testbed/images/fog.png diff --git a/tests/manual/testbed/images/group_bottom.png b/tests/manual/testbed/images/group_bottom.png Binary files differnew file mode 100644 index 0000000..08961d0 --- /dev/null +++ b/tests/manual/testbed/images/group_bottom.png diff --git a/tests/manual/testbed/images/group_top.png b/tests/manual/testbed/images/group_top.png Binary files differnew file mode 100644 index 0000000..210a57f --- /dev/null +++ b/tests/manual/testbed/images/group_top.png diff --git a/tests/manual/testbed/images/icon_blend.png b/tests/manual/testbed/images/icon_blend.png Binary files differnew file mode 100644 index 0000000..4112515 --- /dev/null +++ b/tests/manual/testbed/images/icon_blend.png diff --git a/tests/manual/testbed/images/icon_blur.png b/tests/manual/testbed/images/icon_blur.png Binary files differnew file mode 100644 index 0000000..f0c6f5e --- /dev/null +++ b/tests/manual/testbed/images/icon_blur.png diff --git a/tests/manual/testbed/images/icon_color.png b/tests/manual/testbed/images/icon_color.png Binary files differnew file mode 100644 index 0000000..649cf75 --- /dev/null +++ b/tests/manual/testbed/images/icon_color.png diff --git a/tests/manual/testbed/images/icon_distortion.png b/tests/manual/testbed/images/icon_distortion.png Binary files differnew file mode 100644 index 0000000..11bbece --- /dev/null +++ b/tests/manual/testbed/images/icon_distortion.png diff --git a/tests/manual/testbed/images/icon_drop_shadow.png b/tests/manual/testbed/images/icon_drop_shadow.png Binary files differnew file mode 100644 index 0000000..77b2f88 --- /dev/null +++ b/tests/manual/testbed/images/icon_drop_shadow.png diff --git a/tests/manual/testbed/images/icon_glow.png b/tests/manual/testbed/images/icon_glow.png Binary files differnew file mode 100644 index 0000000..019b4b5 --- /dev/null +++ b/tests/manual/testbed/images/icon_glow.png diff --git a/tests/manual/testbed/images/icon_gradient.png b/tests/manual/testbed/images/icon_gradient.png Binary files differnew file mode 100644 index 0000000..0d836b3 --- /dev/null +++ b/tests/manual/testbed/images/icon_gradient.png diff --git a/tests/manual/testbed/images/icon_mask.png b/tests/manual/testbed/images/icon_mask.png Binary files differnew file mode 100644 index 0000000..ceca052 --- /dev/null +++ b/tests/manual/testbed/images/icon_mask.png diff --git a/tests/manual/testbed/images/icon_motion_blur.png b/tests/manual/testbed/images/icon_motion_blur.png Binary files differnew file mode 100644 index 0000000..89ceb66 --- /dev/null +++ b/tests/manual/testbed/images/icon_motion_blur.png diff --git a/tests/manual/testbed/images/radiobutton_inner.png b/tests/manual/testbed/images/radiobutton_inner.png Binary files differnew file mode 100644 index 0000000..e77ccc4 --- /dev/null +++ b/tests/manual/testbed/images/radiobutton_inner.png diff --git a/tests/manual/testbed/images/radiobutton_outer.png b/tests/manual/testbed/images/radiobutton_outer.png Binary files differnew file mode 100644 index 0000000..6568c65 --- /dev/null +++ b/tests/manual/testbed/images/radiobutton_outer.png diff --git a/tests/manual/testbed/images/slider_handle.png b/tests/manual/testbed/images/slider_handle.png Binary files differnew file mode 100644 index 0000000..633bbe9 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle.png diff --git a/tests/manual/testbed/images/slider_handle_b.png b/tests/manual/testbed/images/slider_handle_b.png Binary files differnew file mode 100755 index 0000000..c7d2540 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_b.png diff --git a/tests/manual/testbed/images/slider_handle_g.png b/tests/manual/testbed/images/slider_handle_g.png Binary files differnew file mode 100755 index 0000000..86decaf --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_g.png diff --git a/tests/manual/testbed/images/slider_handle_pressed.png b/tests/manual/testbed/images/slider_handle_pressed.png Binary files differnew file mode 100644 index 0000000..10e5ed9 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_pressed.png diff --git a/tests/manual/testbed/images/slider_handle_r.png b/tests/manual/testbed/images/slider_handle_r.png Binary files differnew file mode 100755 index 0000000..1bc1614 --- /dev/null +++ b/tests/manual/testbed/images/slider_handle_r.png diff --git a/tests/manual/testbed/images/slider_track.png b/tests/manual/testbed/images/slider_track.png Binary files differnew file mode 100644 index 0000000..3ab0d21 --- /dev/null +++ b/tests/manual/testbed/images/slider_track.png diff --git a/tests/manual/testbed/images/slider_track_filled.png b/tests/manual/testbed/images/slider_track_filled.png Binary files differnew file mode 100644 index 0000000..045e6c8 --- /dev/null +++ b/tests/manual/testbed/images/slider_track_filled.png diff --git a/tests/manual/testbed/images/slider_track_left.png b/tests/manual/testbed/images/slider_track_left.png Binary files differnew file mode 100755 index 0000000..b1cc989 --- /dev/null +++ b/tests/manual/testbed/images/slider_track_left.png diff --git a/tests/manual/testbed/images/slider_track_right.png b/tests/manual/testbed/images/slider_track_right.png Binary files differnew file mode 100755 index 0000000..2936c7c --- /dev/null +++ b/tests/manual/testbed/images/slider_track_right.png diff --git a/tests/manual/testbed/images/title.png b/tests/manual/testbed/images/title.png Binary files differnew file mode 100644 index 0000000..e3110a2 --- /dev/null +++ b/tests/manual/testbed/images/title.png diff --git a/tests/manual/testbed/images/workarea_left.png b/tests/manual/testbed/images/workarea_left.png Binary files differnew file mode 100644 index 0000000..3b8bb71 --- /dev/null +++ b/tests/manual/testbed/images/workarea_left.png diff --git a/tests/manual/testbed/testBed.qml b/tests/manual/testbed/testBed.qml new file mode 100755 index 0000000..e37ffb5 --- /dev/null +++ b/tests/manual/testbed/testBed.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: main + + width: 950 + height: 620 + color: '#171717' + + ListView { + id: testCaseList + width: 160 + anchors.top: titlebar.bottom + anchors.left: parent.left + anchors.bottom: parent.bottom + + model: TestBedModel {} + delegate: delegateItem + + section.property: "group" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + + } + + Image { + id: titlebar + source: "images/title.png" + anchors.top: parent.top + anchors.left: parent.left + width: 160 + + Text { + id: effectsListTitle + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "Effects" + color: "white" + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + } + } + + Loader { + id: testLoader + anchors {left: testCaseList.right; right: parent.right; top: parent.top; bottom: parent.bottom} + } + + Image { + anchors {left: testLoader.left; top: parent.top; bottom: parent.bottom} + source: "images/workarea_left.png" + } + + + Component { + id: sectionHeading + Item { + width: parent.width + height: 23 + Image { + source: "images/group_top.png" + width: parent.width + } + Image { + id: icon + source: "images/icon_" + section.replace(/ /g, "_").toLowerCase() + ".png" + anchors {top: parent.top; topMargin: 6; left: parent.left; leftMargin: 6} + } + Text { + id: sectionText + text: section + anchors {fill: parent; leftMargin: 25; topMargin: 3} + color: "white" + verticalAlignment: Text.AlignVCenter + font.family: "Arial" + font.bold: true + font.pixelSize: 12 + } + } + } + + Component { + id: delegateItem + Item { + width: ListView.view.width + height: last ? 27 : 20 + + Image { + source: "images/group_bottom.png" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + smooth: true + visible: last && index != 20 ? 1 : 0 + } + Rectangle { + width: parent.width + color: "#3D3D3D" + height: 20 + visible: delegateMouseArea.pressed + } + Text { + id: delegateText; + anchors {fill: parent; leftMargin: 25; topMargin: 3} + text: name.slice(4, name.indexOf(".")) + font.family: "Arial" + font.pixelSize: 12 + color: "#CCCCCC" + } + MouseArea { + id: delegateMouseArea + anchors.fill: parent; + onClicked: { +// main.state = "testRunning"; + testLoader.source = name; + testLoader.item.currentTest = delegateText.text; + } + } + } + } + +// states: [ +// State { +// name: "testRunning" +// PropertyChanges { target: testCaseList } +// } +// ] +} diff --git a/tests/manual/testbed/testbed.qmlproject b/tests/manual/testbed/testbed.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/tests/manual/testbed/testbed.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/tests/system/auto/auto.pro b/tests/system/auto/auto.pro new file mode 100644 index 0000000..8554607 --- /dev/null +++ b/tests/system/auto/auto.pro @@ -0,0 +1,16 @@ +QT += testlib + +TARGET = tst_imagecompare +CONFIG += console +CONFIG -= app_bundle +TEMPLATE = app + +SOURCES += tst_imagecompare.cpp \ + imagecompare.cpp \ + main.cpp + +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +HEADERS += \ + imagecompare.h \ + tst_imagecompare.h diff --git a/tests/system/auto/imagecompare.cpp b/tests/system/auto/imagecompare.cpp new file mode 100644 index 0000000..4e562a8 --- /dev/null +++ b/tests/system/auto/imagecompare.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "imagecompare.h" + +ImageCompare::ImageCompare(QObject *parent) : QObject(parent){ +} + +bool ImageCompare::CompareImages(QImage actual, QImage expected){ + + bool result = true; + bool compareAlpha, compareRed, compareGreen, compareBlue; + const int tolerance = 1; + + for(int y = 0; y < 300; y++){ + for(int x = 0; x < 300; x++){ + + // Gets the color of the pixel in the given position. + QRgb pixelActual = actual.pixel(x,y); + QRgb pixelExpected = expected.pixel(x,y); + + // Compares separately the alpha, red, green and blue components of an ARGB value within the specified tolerance. + compareAlpha = (abs(qAlpha(pixelActual) - qAlpha(pixelExpected)) <= tolerance); + compareRed = (abs(qRed(pixelActual) - qRed(pixelExpected)) <= tolerance); + compareGreen = (abs(qGreen(pixelActual) - qGreen(pixelExpected)) <= tolerance); + compareBlue = (abs(qBlue(pixelActual) - qBlue(pixelExpected)) <= tolerance); + + result &= (compareAlpha && compareRed && compareGreen && compareBlue); + } + } + return result; +} diff --git a/tests/system/auto/imagecompare.h b/tests/system/auto/imagecompare.h new file mode 100644 index 0000000..1f074af --- /dev/null +++ b/tests/system/auto/imagecompare.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef IMAGECOMPARE_H +#define IMAGECOMPARE_H + +#include <QObject> +#include <QtCore/QCoreApplication> +#include <QtGui/QImage> +#include <math.h> + +class ImageCompare : public QObject +{ + Q_OBJECT + +public: + explicit ImageCompare(QObject *parent = 0); + bool CompareImages(QImage, QImage); + +signals: + +public slots: + +}; + +#endif // IMAGECOMPARE_H diff --git a/tests/system/auto/main.cpp b/tests/system/auto/main.cpp new file mode 100644 index 0000000..411a7eb --- /dev/null +++ b/tests/system/auto/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/QCoreApplication> +#include "tst_imagecompare.h" + +int main(int argc, char *argv[]){ + + QCoreApplication a(argc, argv); + + tst_imagecompare test; + + // To be enabled/uncommented if test result output is needed in XML format + //QStringList arguments; + //arguments << " " << "-o" << "results.xml" << "-xml"; + //QTest::qExec(&test, arguments); + + QTest::qExec(&test, argc, argv); + + return 0; +} diff --git a/tests/system/auto/tst_imagecompare.cpp b/tests/system/auto/tst_imagecompare.cpp new file mode 100644 index 0000000..3c79e3c --- /dev/null +++ b/tests/system/auto/tst_imagecompare.cpp @@ -0,0 +1,1198 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/QString> +#include <QtCore/QDir> +#include <QtCore/QProcess> +#include <QStringList> +#include <QtGui/QImage> +#include <QDebug> +#include "imagecompare.h" +#include "tst_imagecompare.h" + +QDir expectedDir("../../../doc/src/images"); +QDir actualDir("./output"); + +void tst_imagecompare::initTestCase(){ + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString qtDir = env.value("QTDIR"); + QStringList dumperpath; + dumperpath << "../../../tools/pngdumper/pngdumper.qml"; + + // Verifies that QTDIR environment variable is set + QCOMPARE(qtDir == "", false); + + QProcess *myProcess = new QProcess(); + myProcess->start(qtDir + "/bin/qmlscene", dumperpath); + myProcess->waitForFinished(300000); + + // Verifies does the output folder exist + QCOMPARE(actualDir.exists(), true); + + // Verifies that the output folder includes dumped png images + QStringList filters; + filters << "*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + QCOMPARE(list.size() == 0, false); +} + +void tst_imagecompare::blend_varMode(){ + QStringList filters; + filters << "blend_mode*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::brightnessContrast_varBrightness(){ + QStringList filters; + filters << "brightnesscontrast_brightness*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::brightnessContrast_varContrast(){ + QStringList filters; + filters << "brightnesscontrast_contrast*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::colorize_varHue(){ + QStringList filters; + filters << "colorize_hue*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::colorize_varSaturation(){ + QStringList filters; + filters << "colorize_saturation*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename;' + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::colorize_varLightness(){ + QStringList filters; + filters << "colorize_lightness*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::colorOverlay_varColor(){ + QStringList filters; + filters << "coloroverlay_color*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::conicalGradient_varAngle(){ + QStringList filters; + filters << "conicalgradient_angle*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::conicalGradient_varHorizontalOffset(){ + QStringList filters; + filters << "conicalgradient_horizontaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::conicalGradient_varVerticalOffset(){ + QStringList filters; + filters << "conicalgradient_verticaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::conicalGradient_varGradient(){ + QStringList filters; + filters << "conicalgradient_gradient*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::conicalGradient_varMaskSource(){ + QStringList filters; + filters << "conicalgradient_masksource*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::desaturate_varDesaturation(){ + QStringList filters; + filters << "desaturate_desaturation*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::displace_varDisplacement(){ + QStringList filters; + filters << "displace_displacement*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::dropShadow_varRadius(){ + QStringList filters; + filters << "dropshadow_radius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::dropShadow_varColor(){ + QStringList filters; + filters << "dropshadow_color*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::dropShadow_varHorizontalOffset(){ + QStringList filters; + filters << "dropshadow_horizontaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::dropShadow_varVerticalOffset(){ + QStringList filters; + filters << "dropshadow_verticaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::dropShadow_varSpread(){ + QStringList filters; + filters << "dropshadow_spread*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastDropShadow_varColor(){ + QStringList filters; + filters << "fastdropshadow_color*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + + +void tst_imagecompare::fastDropShadow_varHorizontalOffset(){ + QStringList filters; + filters << "fastdropshadow_horizontaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastDropShadow_varVerticalOffset(){ + QStringList filters; + filters << "fastdropshadow_verticaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastDropShadow_varSpread(){ + QStringList filters; + filters << "fastdropshadow_spread*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::glow_varRadius(){ + QStringList filters; + filters << "glow_radius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::glow_varColor(){ + QStringList filters; + filters << "glow_color*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::glow_varSpread(){ + QStringList filters; + filters << "glow_spread*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastGlow_varBlur(){ + QStringList filters; + filters << "fastglow_blur*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastGlow_varColor(){ + QStringList filters; + filters << "fastglow_color*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastGlow_varSpread(){ + QStringList filters; + filters << "fastglow_spread*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastBlur_varBlur(){ + QStringList filters; + filters << "fastblur_blur*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::fastBlur_varTransparentBorder(){ + QStringList filters; + filters << "fastblur_transparentborder*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::gammaAdjust_varGamma(){ + QStringList filters; + filters << "gammaadjust_gamma*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::gaussianBlur_varRadius(){ + QStringList filters; + filters << "gaussianblur_radius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::gaussianBlur_varDeviation(){ + QStringList filters; + filters << "gaussianblur_deviation*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::gaussianBlur_varTransparentBorder(){ + QStringList filters; + filters << "gaussianblur_transparentborder*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::hueSaturation_varHue(){ + QStringList filters; + filters << "huesaturation_hue*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::hueSaturation_varSaturation(){ + QStringList filters; + filters << "huesaturation_saturation*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::hueSaturation_varLightness(){ + QStringList filters; + filters << "huesaturation_lightness*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::linearGradient_varGradient(){ + QStringList filters; + filters << "lineargradient_gradient*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::linearGradient_varStart(){ + QStringList filters; + filters << "lineargradient_start*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::linearGradient_varEnd(){ + QStringList filters; + filters << "lineargradient_end*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::linearGradient_varMaskSource(){ + QStringList filters; + filters << "lineargradient_masksource*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::opacityMask_varMaskSource(){ + QStringList filters; + filters << "opacitymask_masksource*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varHorizontalOffset(){ + QStringList filters; + filters << "radialgradient_horizontaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varVerticalOffset(){ + QStringList filters; + filters << "radialgradient_verticaloffset*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varHorizontalRadius(){ + QStringList filters; + filters << "radialgradient_horizontalradius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varVerticalRadius(){ + QStringList filters; + filters << "radialgradient_verticalradius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varGradient(){ + QStringList filters; + filters << "radialgradient_gradient*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varAngle(){ + QStringList filters; + filters << "radialgradient_angle*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::radialGradient_varMaskSource(){ + QStringList filters; + filters << "radialgradient_masksource*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::rectangularGlow_varGlowRadius(){ + QStringList filters; + filters << "rectangularglow_glowradius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::rectangularGlow_varSpread(){ + QStringList filters; + filters << "rectangularglow_spread*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::rectangularGlow_varColor(){ + QStringList filters; + filters << "rectangularglow_color*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::rectangularGlow_varCornerRadius(){ + QStringList filters; + filters << "rectangularglow_cornerradius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::recursiveBlur_varLoops(){ + QStringList filters; + filters << "recursiveblur_loops*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::recursiveBlur_varRadius(){ + QStringList filters; + filters << "recursiveblur_radius*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::recursiveBlur_varTransparentBorder(){ + QStringList filters; + filters << "recursiveblur_transparentborder*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::thresholdMask_varSpread(){ + QStringList filters; + filters << "thresholdmask_spread*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} + +void tst_imagecompare::thresholdMask_varThreshold(){ + QStringList filters; + filters << "thresholdmask_threshold*.png"; + actualDir.setNameFilters(filters); + QStringList list = actualDir.entryList(); + + for (int i = 0; i < list.size(); ++i){ + QString filename = list.at(i).toLocal8Bit().constData(); + //qDebug() << "Testing shader image " + filename; + QString actualFile = actualDir.absolutePath() + "/" + filename; + QString expectedFile = expectedDir.absolutePath() + "/" + filename; + + QImage actual(actualFile); + QImage expected(expectedFile); + ImageCompare compare; + QCOMPARE(compare.CompareImages(actual, expected), true); + } +} diff --git a/tests/system/auto/tst_imagecompare.h b/tests/system/auto/tst_imagecompare.h new file mode 100644 index 0000000..a36931e --- /dev/null +++ b/tests/system/auto/tst_imagecompare.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TST_IMAGECOMPARE_H +#define TST_IMAGECOMPARE_H + +#include <QtTest/QtTest> + +class tst_imagecompare : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void initTestCase(); + void blend_varMode(); + void brightnessContrast_varBrightness(); + void brightnessContrast_varContrast(); + void colorize_varHue(); + void colorize_varSaturation(); + void colorize_varLightness(); + void colorOverlay_varColor(); + void conicalGradient_varAngle(); + void conicalGradient_varHorizontalOffset(); + void conicalGradient_varVerticalOffset(); + void conicalGradient_varGradient(); + void conicalGradient_varMaskSource(); + void desaturate_varDesaturation(); + void displace_varDisplacement(); + void dropShadow_varRadius(); + void dropShadow_varColor(); + void dropShadow_varHorizontalOffset(); + void dropShadow_varVerticalOffset(); + void dropShadow_varSpread(); + void fastDropShadow_varColor(); + void fastDropShadow_varHorizontalOffset(); + void fastDropShadow_varVerticalOffset(); + void fastDropShadow_varSpread(); + void glow_varRadius(); + void glow_varColor(); + void glow_varSpread(); + void fastGlow_varBlur(); + void fastGlow_varColor(); + void fastGlow_varSpread(); + void fastBlur_varBlur(); + void fastBlur_varTransparentBorder(); + void gammaAdjust_varGamma(); + void gaussianBlur_varRadius(); + void gaussianBlur_varDeviation(); + void gaussianBlur_varTransparentBorder(); + void hueSaturation_varHue(); + void hueSaturation_varSaturation(); + void hueSaturation_varLightness(); + void linearGradient_varGradient(); + void linearGradient_varStart(); + void linearGradient_varEnd(); + void linearGradient_varMaskSource(); + void opacityMask_varMaskSource(); + void radialGradient_varHorizontalOffset(); + void radialGradient_varVerticalOffset(); + void radialGradient_varHorizontalRadius(); + void radialGradient_varVerticalRadius(); + void radialGradient_varGradient(); + void radialGradient_varAngle(); + void radialGradient_varMaskSource(); + void rectangularGlow_varGlowRadius(); + void rectangularGlow_varSpread(); + void rectangularGlow_varColor(); + void rectangularGlow_varCornerRadius(); + void recursiveBlur_varLoops(); + void recursiveBlur_varRadius(); + void recursiveBlur_varTransparentBorder(); + void thresholdMask_varSpread(); + void thresholdMask_varThreshold(); +}; + +#endif // TST_IMAGECOMPARE_H diff --git a/tests/tests.pro b/tests/tests.pro new file mode 100644 index 0000000..2b527af --- /dev/null +++ b/tests/tests.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += manual auto diff --git a/tools/pngdumper/ItemModel.qml b/tools/pngdumper/ItemModel.qml new file mode 100644 index 0000000..8b627fe --- /dev/null +++ b/tools/pngdumper/ItemModel.qml @@ -0,0 +1,783 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +VisualItemModel { + Blend { + width: size + height: size + backgroundSource: bug + foregroundSource: butterfly + mode: "normal" + property string __name: "Blend" + property variant __properties: ["mode"] + property string __varyingProperty: "mode" + property variant __values: ["normal", "addition", "darken", "difference", "divide", "lighten", "multiply", "screen", "subtract"] + } + + BrightnessContrast { + width: size + height: size + source: bug + property string __name: "BrightnessContrast" + property variant __properties: ["brightness", "contrast"] + property string __varyingProperty: "brightness" + property variant __values: [-0.25, 0.0, 0.5] + } + BrightnessContrast { + width: size + height: size + source: bug + property string __name: "BrightnessContrast" + property variant __properties: ["brightness", "contrast"] + property string __varyingProperty: "contrast" + property variant __values: [-0.5, 0.0, 0.5] + } + + Colorize { + width: size + height: size + source: bug + property string __name: "Colorize" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "hue" + property variant __values: [0.2, 0.5, 0.8] + } + Colorize { + width: size + height: size + source: bug + property string __name: "Colorize" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "saturation" + property variant __values: [0.0, 0.5, 1.0] + } + Colorize { + width: size + height: size + source: bug + property string __name: "Colorize" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "lightness" + property variant __values: [-0.75, 0.0, 0.75] + } + + ColorOverlay { + width: size + height: size + source: bug + property string __name: "ColorOverlay" + property variant __properties: ["color"] + property string __varyingProperty: "color" + property variant __values: ["#80ff0000", "#8000ff00", "#800000ff"] + } + + ConicalGradient { + function init() { checkerboard = true } + + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient"] + property string __varyingProperty: "angle" + property variant __values: [0, 45, 185] + } + ConicalGradient { + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient"] + property string __varyingProperty: "horizontalOffset" + property variant __values: [-50, 0, 50] + } + ConicalGradient { + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient"] + property string __varyingProperty: "gradient" + property variant __values: [firstGradient, secondGradient, thirdGradient] + } + ConicalGradient { + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient", "maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [undefined, butterfly] + + function uninit() { checkerboard = false } + } + + Desaturate { + width: size + height: size + source: butterfly + property string __name: "Desaturate" + property variant __properties: ["desaturation"] + property string __varyingProperty: "desaturation" + property variant __values: ["0.0", "0.5", "1.0"] + } + + // TODO: Update the displacement texture + Displace { + width: size + height: size + source: bug + displacementSource: ShaderEffectSource {sourceItem: displacementMapSource; visible: false } + property string __name: "Displace" + property variant __properties: ["displacement"] + property string __varyingProperty: "displacement" + property variant __values: ["-0.3", "0.0", "0.3"] + } + + DropShadow { + function init() { butterfly.visible = true } + + width: size + height: size + source: butterfly + horizontalOffset: 0 + verticalOffset: 20 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "radius" + property variant __values: [0, 6, 12] + } + DropShadow { + function init() { checkerboard = true } + width: size + height: size + source: butterfly + horizontalOffset: 0 + verticalOffset: 20 + radius: 8 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#000000", "#0000ff", "#aa000000"] + + function uninit() { checkerboard = false } + } + DropShadow { + width: size + height: size + source: butterfly + //verticalOffset: 3 + radius: 4 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "horizontalOffset" + property variant __values: ["-20", "0", "20"] + } + DropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + radius: 4 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "verticalOffset" + property variant __values: ["-20", "0", "20"] + } + DropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + radius: 8 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "1.0"] + } + + FastDropShadow { + function init() { checkerboard = true } + + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#000000", "#0000ff", "#aa000000"] + + function uninit() { checkerboard = false } + } + FastDropShadow { + width: size + height: size + source: butterfly + //verticalOffset: 3 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "horizontalOffset" + property variant __values: [-20, 0, 20] + } + FastDropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "verticalOffset" + property variant __values: [-20, 0, 20] + } + FastDropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "0.8"] + } + FastDropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "blur" + property variant __values: ["0.0", "0.5", "0.8"] + } + + Glow { + function init() { background = "black" } + + width: size + height: size + source: butterfly + maximumRadius: 8 + property string __name: "Glow" + property variant __properties: ["radius", "maximumRadius", "color", "spread"] + property string __varyingProperty: "radius" + property variant __values: [0, 6, 12] + } + Glow { + width: size + height: size + source: butterfly + radius: 8 + spread: 0.5 + maximumRadius: 8 + property string __name: "Glow" + property variant __properties: ["radius", "maximumRadius", "color", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#ffffff", "#00ff00", "#aa00ff00"] + } + Glow { + width: size + height: size + source: butterfly + radius: 8 + maximumRadius: 8 + property string __name: "Glow" + property variant __properties: ["radius", "maximumRadius", "color", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "1.0"] + } + + FastGlow { + width: size + height: size + source: butterfly + property string __name: "FastGlow" + property variant __properties: ["blur", "color", "spread"] + property string __varyingProperty: "blur" + property variant __values: ["0.0", "0.5", "1.0"] + } + FastGlow { + width: size + height: size + source: butterfly + blur: 0.5 + spread: 0.25 + property string __name: "FastGlow" + property variant __properties: ["blur", "color", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#ffffff", "#00ff00", "#aa00ff00"] + } + FastGlow { + width: size + height: size + source: butterfly + blur: 0.5 + property string __name: "FastGlow" + property variant __properties: ["blur", "color", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "0.9"] + + function uninit() { + butterfly.visible = false + background = "white" + } + } + + FastBlur { + width: size + height: size + source: bug + property string __name: "FastBlur" + property variant __properties: ["blur"] + property string __varyingProperty: "blur" + property variant __values: ["0.0", "0.5", "1.0"] + } + FastBlur { + function init() { checkerboard = true } + width: size + height: size + source: bug + blur: 1.0 + property string __name: "FastBlur" + property variant __properties: ["blur", "transparentBorder"] + property string __varyingProperty: "transparentBorder" + property variant __values: [false, true] + function uninit() { checkerboard = false } + } + + GammaAdjust { + width: size + height: size + source: bug + property string __name: "GammaAdjust" + property variant __properties: ["gamma"] + property string __varyingProperty: "gamma" + property variant __values: ["0.5", "1.0", "1.5"] + } + + GaussianBlur { + width: size + height: size + source: bug + maximumRadius: 8 + deviation: 3 + property string __name: "GaussianBlur" + property variant __properties: ["radius", "maximumRadius", "deviation"] + property string __varyingProperty: "radius" + property variant __values: [0, 4, 8] + } + GaussianBlur { + width: size + height: size + source: bug + maximumRadius: 8 + radius: 8 + property string __name: "GaussianBlur" + property variant __properties: ["radius", "maximumRadius", "deviation"] + property string __varyingProperty: "deviation" + property variant __values: [1, 2, 4] + } + GaussianBlur { + function init() { checkerboard = true } + width: size + height: size + source: bug + maximumRadius: 8 + radius: 8 + property string __name: "GaussianBlur" + property variant __properties: ["radius", "maximumRadius", "deviation", "transparentBorder"] + property string __varyingProperty: "transparentBorder" + property variant __values: [false, true] + function uninit() { checkerboard = false } + } + + HueSaturation { + width: size + height: size + source: bug + property string __name: "HueSaturation" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "hue" + property variant __values: ["-0.3", "0.0", "0.3"] + } + HueSaturation { + width: size + height: size + source: bug + property string __name: "HueSaturation" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "saturation" + property variant __values: ["-0.8", "0.0", "1.0"] + } + HueSaturation { + width: size + height: size + source: bug + property string __name: "HueSaturation" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "lightness" + property variant __values: ["-0.5", "0.0", "0.5"] + } + + LinearGradient { + function init() { checkerboard = true } + + width: size + height: size + start: Qt.point(0,0) + end: Qt.point(width, height) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient"] + property string __varyingProperty: "gradient" + property variant __values: [firstGradient, secondGradient, thirdGradient] + } + LinearGradient { + width: size + height: size + end: Qt.point(width, height) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient"] + property string __varyingProperty: "start" + property variant __values: [Qt.point(0,0), Qt.point(width / 2, height / 2), Qt.point(width, 0)] + } + LinearGradient { + width: size + height: size + start: Qt.point(0,0) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient"] + property string __varyingProperty: "end" + property variant __values: [Qt.point(width, height), Qt.point(width / 2, height / 2), Qt.point(width, 0)] + } + LinearGradient { + width: size + height: size + start: Qt.point(0,0) + end: Qt.point(width, height) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient", "maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [undefined, butterfly] + } + + OpacityMask { + width: size + height: size + source: bug + property string __name: "OpacityMask" + property variant __properties: ["maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [butterfly] + } + + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "horizontalOffset" + property variant __values: [-width / 2, 0, width / 2] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "verticalOffset" + property variant __values: [-height / 2, 0, height / 2] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "horizontalRadius" + property variant __values: [width, width / 3] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "verticalRadius" + property variant __values: [height, height / 3] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "gradient" + property variant __values: [firstGradient, secondGradient, thirdGradient] + } + RadialGradient { + width: size + height: size + horizontalRadius: width / 3 + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "angle" + property variant __values: [0, 45, 90] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient", "maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [undefined, butterfly] + + function uninit() { checkerboard = false } + } + + RectangularGlow { + function init() { + background = "black" + rect.visible = true + } + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "glowRadius" + property variant __values: [10, 20, 40] + cornerRadius: 25 + } + RectangularGlow { + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "1.0"] + cornerRadius: 25 + glowRadius: 20 + } + RectangularGlow { + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "color" + property variant __values: ["#ffffff", "#55ff55", "#5555ff"] + cornerRadius: 25 + glowRadius: 20 + } + RectangularGlow { + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "cornerRadius" + property variant __values: [0, 25, 50] + glowRadius: 20 + + function uninit() { + background = "white" + rect.visible = false + } + } + + RecursiveBlur { + function init() { + timer.interval = 2000 + checkerboard = true + } + + width: size + height: size + source: bug + radius: 7.5 + property string __name: "RecursiveBlur" + property variant __properties: ["loops", "radius"] + property string __varyingProperty: "loops" + property variant __values: [4, 20, 70] + } + RecursiveBlur { + width: size + height: size + source: bug + loops: 20 + property string __name: "RecursiveBlur" + property variant __properties: ["loops", "radius"] + property string __varyingProperty: "radius" + property variant __values: [2.5, 4.5, 7.5] + } + RecursiveBlur { + width: size + height: size + source: bug + loops: 20 + radius: 7.5 + property string __name: "RecursiveBlur" + property variant __properties: ["loops", "radius", "transparentBorder"] + property string __varyingProperty: "transparentBorder" + property variant __values: [false, true] + + function uninit() { + timer.interval = timerInterval + checkerboard = false + } + } + + ThresholdMask { + width: size + height: size + source: bug + maskSource: fog + threshold: 0.4 + property string __name: "ThresholdMask" + property variant __properties: ["spread", "threshold"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.2", "0.8"] + function init() { checkerboard = true } + } + ThresholdMask { + width: size + height: size + source: bug + maskSource: fog + spread: 0.2 + property string __name: "ThresholdMask" + property variant __properties: ["spread", "threshold"] + property string __varyingProperty: "threshold" + property variant __values: ["0.0", "0.5", "0.7"] + function uninit() { checkerboard = false } + } + + RadialBlur { + width: size + height: size + source: butterfly + samples: 32 + property string __name: "RadialBlur" + property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "angle" + property variant __values: ["0.0", "15.0", "30.0"] + function uninit() { checkerboard = false } + } + + RadialBlur { + width: size + height: size + source: butterfly + samples: 32 + angle: 20 + property string __name: "RadialBlur" + property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "horizontalOffset" + property variant __values: ["75.0", "0.0", "-75.0"] + function uninit() { checkerboard = false } + } + + DirectionalBlur { + width: size + height: size + source: butterfly + samples: 32 + length: 32 + property string __name: "DirectionalBlur" + property variant __properties: ["samples", "angle", "length"] + property string __varyingProperty: "angle" + property variant __values: ["0.0", "45.0", "90.0"] + function uninit() { checkerboard = false } + } + + DirectionalBlur { + width: size + height: size + source: butterfly + samples: 32 + property string __name: "DirectionalBlur" + property variant __properties: ["samples", "angle", "length"] + property string __varyingProperty: "length" + property variant __values: ["0.0", "32.0", "48.0"] + function uninit() { checkerboard = false } + } + + ZoomBlur { + width: size + height: size + source: butterfly + samples: 32 + length: 32 + property string __name: "ZoomBlur" + property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "horizontalOffset" + property variant __values: ["100.0", "0.0", "-100.0"] + function uninit() { checkerboard = false } + } + + ZoomBlur { + width: size + height: size + source: butterfly + samples: 32 + property string __name: "ZoomBlur" + property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "length" + property variant __values: ["0.0", "32.0", "48.0"] + function uninit() { checkerboard = false } + } + + Item { + id: theEnd + width: size + height: size + function init() { Qt.quit() } + } +} diff --git a/tools/pngdumper/pngdumper.cpp b/tools/pngdumper/pngdumper.cpp new file mode 100644 index 0000000..598eb25 --- /dev/null +++ b/tools/pngdumper/pngdumper.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "pngdumper.h" + +#include <QtDeclarative/qdeclarative.h> + +ItemCapturer::ItemCapturer(QQuickItem *parent): + QQuickItem(parent) +{ +} + +ItemCapturer::~ItemCapturer() +{ +} + +void ItemCapturer::grabItem(QQuickItem *item, QString filename) +{ + QImage img = canvas()->grabFrameBuffer(); + QQuickItem *rootItem = canvas()->rootItem(); + QRectF rectf = rootItem->mapRectFromItem(item, QRectF(0, 0, item->width(), item->height())); + QDir pwd = QDir().dirName(); + pwd.mkdir("output"); + img = img.copy(rectf.toRect()); + img.save("output/" + filename); +} + +void ItemCapturer::document(QString s) +{ + printf(s.toAscii().data()); +} diff --git a/tools/pngdumper/pngdumper.h b/tools/pngdumper/pngdumper.h new file mode 100644 index 0000000..b08befb --- /dev/null +++ b/tools/pngdumper/pngdumper.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ITEMCAPTURER_H +#define ITEMCAPTURER_H + +#include <QtQuick> + +class ItemCapturer : public QQuickItem +{ + Q_OBJECT + Q_DISABLE_COPY(ItemCapturer) + +public: + ItemCapturer(QQuickItem *parent = 0); + ~ItemCapturer(); + + Q_INVOKABLE void grabItem(QQuickItem *item, QString filename); + Q_INVOKABLE void document(QString s); +}; + +QML_DECLARE_TYPE(ItemCapturer) + +#endif // ITEMCAPTURER_H + diff --git a/tools/pngdumper/pngdumper.pro b/tools/pngdumper/pngdumper.pro new file mode 100644 index 0000000..1677049 --- /dev/null +++ b/tools/pngdumper/pngdumper.pro @@ -0,0 +1,45 @@ +TEMPLATE = lib +TARGET = pngdumper +QT += core quick +CONFIG += qt plugin + +TARGET = $$qtLibraryTarget($$TARGET) +uri = com.nokia.mt.pngdumper + +# Input +SOURCES += \ + pngdumper_plugin.cpp \ + pngdumper.cpp + +HEADERS += \ + pngdumper_plugin.h \ + pngdumper.h + +OTHER_FILES = qmldir \ + pngdumper.qml \ + ItemModel.qml + +!equals(_PRO_FILE_PWD_, $$OUT_PWD) { + copy_qmldir.target = $$OUT_PWD/qmldir + copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir + copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" + QMAKE_EXTRA_TARGETS += copy_qmldir + PRE_TARGETDEPS += $$copy_qmldir.target +} + +qmldir.files = qmldir +symbian { + TARGET.EPOCALLOWDLLDATA = 1 +} else:unix { + maemo5 | !isEmpty(MEEGO_VERSION_MAJOR) { + installPath = /usr/lib/qt4/imports/$$replace(uri, \\., /) + } else { + installPath = $$[QT_INSTALL_IMPORTS]/$$replace(uri, \\., /) + } + qmldir.path = $$installPath + target.path = $$installPath + INSTALLS += target qmldir +} + + + diff --git a/tools/pngdumper/pngdumper.qml b/tools/pngdumper/pngdumper.qml new file mode 100644 index 0000000..c3dab22 --- /dev/null +++ b/tools/pngdumper/pngdumper.qml @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import com.nokia.mt.pngdumper 1.0 + +Rectangle { + id: main + width: 300 + height: width + property real size: width + property real timerInterval: 200 + property color background: "white" + property bool checkerboard: false + color: background + + Gradient { + id: firstGradient + GradientStop { position: 0.000; color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; color: Qt.rgba(1, 0, 0, 1) } + } + Gradient { + id: secondGradient + GradientStop { position: 0.0; color: "#F0F0F0" } + GradientStop { position: 0.5; color: "#000000" } + GradientStop { position: 1.0; color: "#F0F0F0" } + } + Gradient { + id: thirdGradient + GradientStop { position: 0.0; color: "#00000000" } + GradientStop { position: 1.0; color: "#FF000000" } + } + + ItemModel { + id: itemModel + } + + Item { + id: container + width: size + height: size + clip: true + + Image { + source: '../../tests/manual/testbed/images/checker.png' + smooth: true + anchors.fill: parent + fillMode: Image.Tile + visible: main.checkerboard + } + + ListView { + id: list + width: size + height: size + model: itemModel + highlightMoveDuration: 1 + spacing: size + anchors.centerIn: parent + cacheBuffer: size + } + } + + // Sources + Image { + id: bug + source: "../../tests/manual/testbed/images/bug.jpg" + smooth: true + width: size + height: width + fillMode: Image.PreserveAspectFit + visible: false + } + ShaderEffectSource { + id: butterfly + smooth: true + width: size + height: width + visible: false + sourceItem: + Image { + //id: butterfly + source: "../../tests/manual/testbed/images/butterfly.png" + smooth: true + width: size + height: width + fillMode: Image.PreserveAspectFit + visible: false + } + } + Image { + id: fog + source: "../../tests/manual/testbed/images/fog.png" + smooth: true + width: size + height: width + fillMode: Image.PreserveAspectFit + visible: false + } + Rectangle { + id: rect + width: size / 2 + height: size / 2 + anchors.centerIn: container + color: "#dde4ff" + visible: false + } + Rectangle { + id: displacementMapSource + visible: false + color: Qt.rgba(0.5, 0.5, 1.0, 1.0) + smooth: true + anchors.fill: bug + Image { + id: di + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + sourceSize: Qt.size(128, 128) + source: "../../tests/manual/testbed/images/displacementmap.png" + smooth: true + } + } + + ItemCapturer { + id: capturer + } + + Timer { + interval: 1000 + running: true + onTriggered: { + // Ugly workaround for listview not updating itself + list.contentX = 1 + eval("list.currentItem."+list.currentItem.__varyingProperty+"=list.currentItem.__values[0]"); + timer.running = true + list.contentX = 0 + } + } + + Timer { + id: timer + interval: timerInterval + repeat: true + property int i: 0 + + onTriggered: { + var value = list.currentItem.__values[i]; + var filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (i + 1) + ".png" + filename = filename.replace(/\"/g,"") + //filename = filename.toLowerCase(); + capturer.grabItem(container, filename) + //console.log(filename) + + if (i >= list.currentItem.__values.length - 1) { + capturer.document("\\table\n") + capturer.document("\\header\n") + capturer.document("\\o Output examples with different " + list.currentItem.__varyingProperty + " values\n") + capturer.document("\\o\n\\o\n\\row\n") + var ii = 0 + for(ii = 0; ii < list.currentItem.__values.length; ii++) { + filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (ii + 1) + ".png" + filename = filename.replace(/\"/g,"") + //filename = filename.toLowerCase(); + capturer.document(" \\o \\image " + filename + "\n") + } + capturer.document("\\row\n") + for(ii = 0; ii < list.currentItem.__values.length; ii++) { + capturer.document(" \\o \\bold { " + list.currentItem.__varyingProperty + ": " + list.currentItem.__values[ii] + " }\n") + } + for (var p = 0; p < list.currentItem.__properties.length; p++) { + if (list.currentItem.__properties[p] == list.currentItem.__varyingProperty) continue; + + capturer.document("\\row\n") + + for(ii = 0; ii < list.currentItem.__values.length; ii++) { + capturer.document(" \\o \\l " + list.currentItem.__properties[p] + ": " + eval("list.currentItem."+list.currentItem.__properties[p]) + "\n") + } + } + capturer.document("\\endtable\n") + + if (list.currentIndex < list.count-1) { + i = 0 + if (list.currentItem.uninit != undefined) list.currentItem.uninit() + list.currentIndex++ + list.positionViewAtIndex(list.currentIndex, ListView.Center) + if (list.currentItem.init != undefined) list.currentItem.init() + } else Qt.quit() + } else i++ + + eval("list.currentItem."+list.currentItem.__varyingProperty+"=list.currentItem.__values[i]"); + } + } +} diff --git a/tools/pngdumper/pngdumper_plugin.cpp b/tools/pngdumper/pngdumper_plugin.cpp new file mode 100644 index 0000000..4f706c1 --- /dev/null +++ b/tools/pngdumper/pngdumper_plugin.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "pngdumper_plugin.h" +#include "pngdumper.h" + +#include <QtDeclarative/qdeclarative.h> + +void ItemcapturerPlugin::registerTypes(const char *uri) +{ + qmlRegisterType<ItemCapturer>(uri, 1, 0, "ItemCapturer"); +} + +Q_EXPORT_PLUGIN2(Itemcapturer, ItemcapturerPlugin) + diff --git a/tools/pngdumper/pngdumper_plugin.h b/tools/pngdumper/pngdumper_plugin.h new file mode 100644 index 0000000..524bee6 --- /dev/null +++ b/tools/pngdumper/pngdumper_plugin.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ITEMCAPTURER_PLUGIN_H +#define ITEMCAPTURER_PLUGIN_H + +#include <QtDeclarative/QDeclarativeExtensionPlugin> + +class ItemcapturerPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + +public: + void registerTypes(const char *uri); +}; + +#endif // ITEMCAPTURER_PLUGIN_H + diff --git a/tools/pngdumper/qmldir b/tools/pngdumper/qmldir new file mode 100644 index 0000000..a4519f1 --- /dev/null +++ b/tools/pngdumper/qmldir @@ -0,0 +1,2 @@ +plugin pngdumper + |