Gaps between rows of polka dots when using filter?

Here is my code, you will only need to substitute the image on line 15 to run it: 

local \_W = display.contentWidth local \_H = display.contentHeight local snapshot = display.newSnapshot(\_W, \_W \* 0.5) snapshot.fill.effect = "filter.polkaDots" snapshot.fill.effect.numPixels = \_W / 10 snapshot.fill.effect.dotRadius = 1 snapshot.fill.effect.aspectRatio = snapshot.width / snapshot.height snapshot.x = \_W \* 0.5 snapshot.y = \_H \* 0.5 display.setDefault( "textureWrapX", "repeat" ) display.setDefault( "textureWrapY", "mirroredRepeat" ) local scoreBG = display.newRect(snapshot.group, 0, 0, snapshot.width, snapshot.height) scoreBG.fill = { type="image", filename="wood7.jpg" } display.setDefault( "textureWrapX", "clampToEdge" )

The polka dots are next to one another horizontally, but there is an extra empty row between each row of polka dots. I don’t see any properties which would allow me to control how many rows would appear. Changing the pixel size simply increases the size of each cell, but also increases the size of the empty row as well so you cannot “fill” the empty space.

Is there something wrong in my implementation? Or is this something that has been overlooked in the filter?

Edit: Also, on certain devices (seems to be on 1080p+ devices), the polka dots seem distorted. Even when using the aspect ratio to try and keep them round, they get altered into weird squared shapes. I’ve seen this happen on a Galaxy S4, and a colleague has seen it on an ipad 5 and I believe a Nexus 7 2013. 

Hi @AlanPlantPot,

I’m not sure that you should be directly “filling” a snapshot. It does seem to work, at least partially, but why not just add a filled polka-dot rectangle to the snapshot?

Brent

I haven’t ever seen anywhere in the docs that we can’t fill a snapshot. The reason I’m directly filling the snapshot is because I want to use the snapshots invalidate() function to redraw the snapshot each frame, with the fill of the scoreBG object rotated, but the polkadots NOT being rotated.

local function update(e) scoreBG.fill.rotation = scoreBG.fill.rotation + 1 snapshot:invalidate() end Runtime:addEventListener( "enterFrame", update )

This causes each polka dot to change colour each frame (based on the colour of the scoreBG objects behind it).

Does anyone at Corona have another solution for the effect I’m trying to achieve (it’s quite possible that I’ve overlooked something obvious)?

Hi @AlanPlantPot,

I’m not sure that you should be directly “filling” a snapshot. It does seem to work, at least partially, but why not just add a filled polka-dot rectangle to the snapshot?

Brent

I haven’t ever seen anywhere in the docs that we can’t fill a snapshot. The reason I’m directly filling the snapshot is because I want to use the snapshots invalidate() function to redraw the snapshot each frame, with the fill of the scoreBG object rotated, but the polkadots NOT being rotated.

local function update(e) scoreBG.fill.rotation = scoreBG.fill.rotation + 1 snapshot:invalidate() end Runtime:addEventListener( "enterFrame", update )

This causes each polka dot to change colour each frame (based on the colour of the scoreBG objects behind it).

Does anyone at Corona have another solution for the effect I’m trying to achieve (it’s quite possible that I’ve overlooked something obvious)?

This one. no real information yet,  it almost seems like filter.polkaDots is scaling on x.

This one. no real information yet,  it almost seems like filter.polkaDots is scaling on x.