From: Alan Alpert Date: Mon, 1 Apr 2013 20:45:21 +0000 (-0700) Subject: Embed some default particles. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=3dbbcc09e98d768a5b7b6c0a498f8aefd9e25b9e;p=konrad%2Fqtdeclarative.git Embed some default particles. Most prototype level particle effects, at least in our example code, uses basic and generic particles. Embedding these images into the particles plugin will facilitate prototyping with the particles API. Currently finding an image and copying it between projects is a relatively large development cost for quick particle system prototypes. Change-Id: I077104915353ab298e2aabd36e2a0a2070030914 Reviewed-by: Gunnar Sletta --- diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/content/attractor.qml index fd7fd65..349132e 100644 --- a/examples/quick/particles/affectors/content/attractor.qml +++ b/examples/quick/particles/affectors/content/attractor.qml @@ -77,7 +77,7 @@ Rectangle { ImageParticle { id: stars groups: ["stars"] - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color: "white" colorVariation: 0.1 alpha: 0 @@ -96,7 +96,7 @@ Rectangle { ImageParticle { id: shot groups: ["shot"] - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color: "#0FF06600" colorVariation: 0.3 @@ -104,7 +104,7 @@ Rectangle { ImageParticle { id: engine groups: ["engine"] - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" color: "orange" SequentialAnimation on color { diff --git a/examples/quick/particles/affectors/content/groupgoal.qml b/examples/quick/particles/affectors/content/groupgoal.qml index 19fa041..cf4361e 100644 --- a/examples/quick/particles/affectors/content/groupgoal.qml +++ b/examples/quick/particles/affectors/content/groupgoal.qml @@ -124,7 +124,7 @@ Rectangle { id: smoke anchors.fill: parent groups: ["smoke"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0 color: "#00111111" } @@ -132,7 +132,7 @@ Rectangle { id: pilot anchors.fill: parent groups: ["pilot"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" redVariation: 0.01 blueVariation: 0.4 color: "#0010004f" diff --git a/examples/quick/particles/affectors/content/move.qml b/examples/quick/particles/affectors/content/move.qml index b4d8331..e90f8c6 100644 --- a/examples/quick/particles/affectors/content/move.qml +++ b/examples/quick/particles/affectors/content/move.qml @@ -50,7 +50,7 @@ Rectangle { ImageParticle { groups: ["A"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color:"#FF1010" redVariation: 0.8 } @@ -80,7 +80,7 @@ Rectangle { ImageParticle { groups: ["B"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color:"#10FF10" greenVariation: 0.8 } @@ -112,7 +112,7 @@ Rectangle { ImageParticle { groups: ["C"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color:"#1010FF" blueVariation: 0.8 } diff --git a/examples/quick/particles/affectors/content/spritegoal.qml b/examples/quick/particles/affectors/content/spritegoal.qml index 78b161f..ab108bb 100644 --- a/examples/quick/particles/affectors/content/spritegoal.qml +++ b/examples/quick/particles/affectors/content/spritegoal.qml @@ -66,7 +66,7 @@ Item { ImageParticle { system: sys groups: ["starfield"] - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" colorVariation: 0.3 color: "white" } @@ -170,7 +170,7 @@ Item { z:0 system: sys groups: ["exhaust"] - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" color: "orange" SequentialAnimation on color { diff --git a/examples/quick/particles/affectors/content/turbulence.qml b/examples/quick/particles/affectors/content/turbulence.qml index d7a8603..eacedbe 100644 --- a/examples/quick/particles/affectors/content/turbulence.qml +++ b/examples/quick/particles/affectors/content/turbulence.qml @@ -75,13 +75,13 @@ Rectangle { ImageParticle { groups: ["smoke"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "#11111111" colorVariation: 0 } ImageParticle { groups: ["flame"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "#11ff400f" colorVariation: 0.1 } diff --git a/examples/quick/particles/customparticle/content/imagecolors.qml b/examples/quick/particles/customparticle/content/imagecolors.qml index 130518a..3fb4c9f 100644 --- a/examples/quick/particles/customparticle/content/imagecolors.qml +++ b/examples/quick/particles/customparticle/content/imagecolors.qml @@ -71,7 +71,7 @@ Rectangle { } Image { id: particle - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" } //! [vertex] vertexShader:" diff --git a/examples/quick/particles/emitters/content/burstandpulse.qml b/examples/quick/particles/emitters/content/burstandpulse.qml index 18d1c43..28c56b3 100644 --- a/examples/quick/particles/emitters/content/burstandpulse.qml +++ b/examples/quick/particles/emitters/content/burstandpulse.qml @@ -67,7 +67,7 @@ Rectangle { id: particles anchors.fill: parent ImageParticle { - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" alpha: 0 colorVariation: 0.6 } diff --git a/examples/quick/particles/emitters/content/customemitter.qml b/examples/quick/particles/emitters/content/customemitter.qml index 966c78e..9ad504e 100644 --- a/examples/quick/particles/emitters/content/customemitter.qml +++ b/examples/quick/particles/emitters/content/customemitter.qml @@ -90,7 +90,7 @@ ParticleSystem { } ImageParticle { - source: "../../images/particle4.png" + source: "qrc:///particleresources/fuzzydot.png" alpha: 0.0 } } diff --git a/examples/quick/particles/emitters/content/emitmask.qml b/examples/quick/particles/emitters/content/emitmask.qml index 08c04f6..1c2e7b4 100644 --- a/examples/quick/particles/emitters/content/emitmask.qml +++ b/examples/quick/particles/emitters/content/emitmask.qml @@ -51,7 +51,7 @@ Rectangle { anchors.centerIn: parent ImageParticle { - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" z: 2 anchors.fill: parent color: "#336666CC" diff --git a/examples/quick/particles/emitters/content/maximumemitted.qml b/examples/quick/particles/emitters/content/maximumemitted.qml index df92f05..4bd9079 100644 --- a/examples/quick/particles/emitters/content/maximumemitted.qml +++ b/examples/quick/particles/emitters/content/maximumemitted.qml @@ -53,7 +53,7 @@ Rectangle { ImageParticle { system: sys id: cp - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0.4 color: "#000000FF" } diff --git a/examples/quick/particles/emitters/content/shapeanddirection.qml b/examples/quick/particles/emitters/content/shapeanddirection.qml index 1dec5b2..0ca433c 100644 --- a/examples/quick/particles/emitters/content/shapeanddirection.qml +++ b/examples/quick/particles/emitters/content/shapeanddirection.qml @@ -58,7 +58,7 @@ Rectangle { ImageParticle { groups: ["center","edge"] anchors.fill: parent - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0.1 color: "#009999FF" } diff --git a/examples/quick/particles/emitters/content/trailemitter.qml b/examples/quick/particles/emitters/content/trailemitter.qml index a4972b7..3186b51 100644 --- a/examples/quick/particles/emitters/content/trailemitter.qml +++ b/examples/quick/particles/emitters/content/trailemitter.qml @@ -56,7 +56,7 @@ Rectangle { system: particles anchors.fill: parent groups: ["A", "B"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0 color: "#00111111" } @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent system: particles groups: ["C", "D"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorVariation: 0.1 color: "#00ff400f" } diff --git a/examples/quick/particles/emitters/content/velocityfrommotion.qml b/examples/quick/particles/emitters/content/velocityfrommotion.qml index 1f1d660..d325f9b 100644 --- a/examples/quick/particles/emitters/content/velocityfrommotion.qml +++ b/examples/quick/particles/emitters/content/velocityfrommotion.qml @@ -61,7 +61,7 @@ Rectangle { ParticleSystem { id: sys1 } ImageParticle { system: sys1 - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "cyan" alpha: 0 SequentialAnimation on color { @@ -127,7 +127,7 @@ Rectangle { } } colorVariation: 0.5 - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" } Emitter { id: trailsStars @@ -149,7 +149,7 @@ Rectangle { } ParticleSystem { id: sys3; } ImageParticle { - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" system: sys3 color: "orange" alpha: 0 @@ -191,7 +191,7 @@ Rectangle { ParticleSystem { id: sys4; } ImageParticle { system: sys4 - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" color: "green" alpha: 0 SequentialAnimation on color { diff --git a/examples/quick/particles/imageparticle/content/colored.qml b/examples/quick/particles/imageparticle/content/colored.qml index 939ec7e..236cc0f 100644 --- a/examples/quick/particles/imageparticle/content/colored.qml +++ b/examples/quick/particles/imageparticle/content/colored.qml @@ -50,7 +50,7 @@ Rectangle { ImageParticle { groups: ["stars"] anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" } Emitter { group: "stars" @@ -64,7 +64,7 @@ Rectangle { // ![0] ImageParticle { anchors.fill: parent - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" alpha: 0 alphaVariation: 0.2 colorVariation: 1.0 diff --git a/examples/quick/particles/imageparticle/content/colortable.qml b/examples/quick/particles/imageparticle/content/colortable.qml index 4090163..87b5ae2 100644 --- a/examples/quick/particles/imageparticle/content/colortable.qml +++ b/examples/quick/particles/imageparticle/content/colortable.qml @@ -55,7 +55,7 @@ Rectangle { alpha: 0 //! [0] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" colorTable: "../../images/colortable.png" sizeTable: "../../images/colortable.png" //! [0] diff --git a/examples/quick/particles/images.qrc b/examples/quick/particles/images.qrc index 9f284a0..1f75483 100644 --- a/examples/quick/particles/images.qrc +++ b/examples/quick/particles/images.qrc @@ -12,10 +12,8 @@ images/meteor.png images/meteors.png images/nullRock.png - images/particle.png images/particle2.png images/particle3.png - images/particle4.png images/particleA.png images/portal_bg.png images/realLeaf1.png @@ -27,7 +25,6 @@ images/sizeInOut.png images/snowflake.png images/sparkleSize.png - images/star.png images/starfish_0.png images/starfish_1.png images/starfish_2.png diff --git a/examples/quick/particles/system/content/dynamiccomparison.qml b/examples/quick/particles/system/content/dynamiccomparison.qml index 247a25a..9db7c0a 100644 --- a/examples/quick/particles/system/content/dynamiccomparison.qml +++ b/examples/quick/particles/system/content/dynamiccomparison.qml @@ -52,7 +52,7 @@ Rectangle { ImageParticle { system: sys - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "white" colorVariation: 1.0 alpha: 0.1 @@ -90,7 +90,7 @@ Rectangle { property int lifeSpan: 10000 width: 32 height: 32 - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" y: 0 PropertyAnimation on y {from: -16; to: root.height-16; duration: container.lifeSpan; running: true} SequentialAnimation on opacity { diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/content/dynamicemitters.qml index 10ac33b..72ec1ff 100644 --- a/examples/quick/particles/system/content/dynamicemitters.qml +++ b/examples/quick/particles/system/content/dynamicemitters.qml @@ -51,7 +51,7 @@ Rectangle { } ImageParticle { system: sys - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" color: "white" colorVariation: 1.0 alpha: 0.1 diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/content/multiplepainters.qml index 8a38874..e0a1288 100644 --- a/examples/quick/particles/system/content/multiplepainters.qml +++ b/examples/quick/particles/system/content/multiplepainters.qml @@ -91,6 +91,6 @@ Rectangle { height: 240 width: root.width z: 1 - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" } } diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/content/startstop.qml index 5ce8729..e787919 100644 --- a/examples/quick/particles/system/content/startstop.qml +++ b/examples/quick/particles/system/content/startstop.qml @@ -69,7 +69,7 @@ Rectangle { ImageParticle { anchors.fill: parent system: particles - source: "../../images/star.png" + source: "qrc:///particleresources/star.png" sizeTable: "../../images/sparkleSize.png" alpha: 0 colorVariation: 0.6 diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/content/timedgroupchanges.qml index 6443878..7131633 100644 --- a/examples/quick/particles/system/content/timedgroupchanges.qml +++ b/examples/quick/particles/system/content/timedgroupchanges.qml @@ -119,7 +119,7 @@ Rectangle { ImageParticle { groups: ["works", "fire", "splode"] - source: "../../images/particle.png" + source: "qrc:///particleresources/glowdot.png" entryEffect: ImageParticle.Scale } } diff --git a/examples/quick/particles/images/particle4.png b/src/particles/particleresources/fuzzydot.png similarity index 100% copy from examples/quick/particles/images/particle4.png copy to src/particles/particleresources/fuzzydot.png diff --git a/examples/quick/particles/images/particle.png b/src/particles/particleresources/glowdot.png similarity index 100% copy from examples/quick/particles/images/particle.png copy to src/particles/particleresources/glowdot.png diff --git a/examples/quick/particles/images/star.png b/src/particles/particleresources/star.png similarity index 100% copy from examples/quick/particles/images/star.png copy to src/particles/particleresources/star.png diff --git a/src/particles/particles.qrc b/src/particles/particles.qrc index 344f948..5825204 100644 --- a/src/particles/particles.qrc +++ b/src/particles/particles.qrc @@ -1,5 +1,8 @@ particleresources/noise.png + particleresources/fuzzydot.png + particleresources/glowdot.png + particleresources/star.png diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index e0572ef..9a0601b 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -623,6 +623,22 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) The source image to be used. If the image is a sprite animation, use the sprite property instead. + + Since Qt 5.2, some default images are provided as resources to aid prototyping: + \table + \row + \li qrc:///particleresources/star.png + \li \inlineimage particles/star.png + \row + \li qrc:///particleresources/glowdot.png + \li \inlineimage particles/glowdot.png + \row + \li qrc:///particleresources/fuzzydot.png + \li \inlineimage particles/fuzzydot.png + \endtable + + Note that the images are white and semi-transparent, to allow colorization + and alpha levels to have maximum effect. */ /*! \qmlproperty list QtQuick.Particles2::ImageParticle::sprites diff --git a/examples/quick/particles/images/particle4.png b/src/quick/doc/images/particles/fuzzydot.png similarity index 100% rename from examples/quick/particles/images/particle4.png rename to src/quick/doc/images/particles/fuzzydot.png diff --git a/examples/quick/particles/images/particle.png b/src/quick/doc/images/particles/glowdot.png similarity index 100% rename from examples/quick/particles/images/particle.png rename to src/quick/doc/images/particles/glowdot.png diff --git a/examples/quick/particles/images/star.png b/src/quick/doc/images/particles/star.png similarity index 100% rename from examples/quick/particles/images/star.png rename to src/quick/doc/images/particles/star.png