When Lukas Morawietz posted the first version of his “Blur script” without the picture.
When Lukas Morawietz posted the first version of his “Blur script” without the picture. I thought he made something like this.
This is just a little PoC too. Scaling this thing is harder then I imagined.
]]>« KRACE (Previous Post)
(Next Post) Hi, not sure if it’s a bug or just me doing something wrong, but if i try to select run a script from swipe up or… »
< ![CDATA[
/* Test PoC
*/
LL.bindClass(“android.graphics.Bitmap”);
LL.bindClass(“android.graphics.Canvas”);
LL.bindClass(“android.renderscript.RenderScript”);
LL.bindClass(“android.renderscript.Allocation”);
LL.bindClass(“android.renderscript.ScriptIntrinsicBlur”);
var img = null;
var bmp = null;
var pnt = null;
var d = LL.getCurrentDesktop();
var bb = d.getBoundingBox();
var bmp = d.getItemByName(“BG”).getBoxBackground(“n”).getBitmap();
var evt = LL.getEvent();
//var itm = evt.getItem();
var itm = d.getItemByName(“blur”);
var rs=RenderScript.create(LL.getContext());
var a=Allocation.createFromBitmap(rs,bmp);
var blur=ScriptIntrinsicBlur.create(rs,a.getElement());
blur.setInput(a);
blur.setRadius(14);
blur.forEach(a);
a.copyTo(bmp);
var itmW = itm.getWidth();
var itmH = itm.getHeight();
if (itm.getProperties().getBoolean(“i.onGrid”))
{
var itmL = (itm.getCell().getLeft() * itm.getParent().getCellWidth() ) ; //- bb.getLeft();
var itmT = (itm.getCell().getTop() * itm.getParent().getCellHeight()) ; //- bb.getTop() ;
}else{
var itmL = itm.getPositionX() + bb.getLeft();
var itmT = itm.getPositionY() + bb.getTop() ;
}
pnt = new Paint(Paint.ANTI_ALIAS_FLAG);
img = LL.createImage(itmW, itmH);
img.draw().drawBitmap(bmp, -itmL, -itmT, pnt);
img.save();
itm.setBoxBackground(img, “ns”, true);
img = null;
bmp = null;
pnt = null;
]]>
< ![CDATA[
Needs:
a pinned item with name “BG”.
a panel with name “blur”.
I did set the tab-event of “BG” to run the script.
]]>
< ![CDATA[
Nice blur effect 😊
]]>
< ![CDATA[
Nice work
]]>
< ![CDATA[
Cool! What’s the name of the brightness slider widget you put on your settings screecn? I’ve been looking for something like that for years.
]]>
< ![CDATA[
Glenn Thomson that’s from my custom rom. I cannot remember any custom rom without this feature.
]]>
< ![CDATA[
Thanks, Jappie Toutenhoofd. I haven’t gotten around to rooting my phone yet. I’ll have to give it a try
]]>
< ![CDATA[
I’m trying to use this script, and it’s not throwing any errors, but it’s not doing anything visually. I have the BG object acting as a wallpaper, stretched to the full size of my desktop, amd sent to the back layer. The image I’ve put on it I did so by setting as the normal, selected, and focused background images. I’ve tried opening the folder, then tapping the BG object (I assigned the script to tap), and it isn’t doing anything.
Does it maybe not work with folders?
Is there something else I need to do?
]]>
< ![CDATA[
I’ve done it again with a panel. It’s doing odd things like this
https://lh3.googleusercontent.com/6RbX-szP3RCNKubZVla4RgBjCrMu5_tv2K9J8B0o0dctOFtSCV22BPUPiaLtlFiH7y2kbpbZvw
]]>
< ![CDATA[
Detaching the item (just the panel, or both) from the grid, then running the script, leave a panel with a completely transparent background.
]]>
< ![CDATA[
So your first pic shows the PoC still works with a panel.
It also shows what i ment with: “Scaling it right is hard”.
I think it can be done to set it to a folder but I will have to fidle with it, to find out how.
]]>
< ![CDATA[
https://lh3.googleusercontent.com/lq9Mkf225lF_qRICcFpbIxUyWpl9OJgJhG6zdYFp_-9Yf6AvHwtfL4AfMOyAq4OrLNNl2y2GmQ
]]>
< ![CDATA[
If you pause my video on the moment with the blur effect, you can see it is actually way off too.
And trust me, I tried many our to set it right. On the thread from Lucas, Pierre explains that you can not exactly predict the scaling.
The many ’empty’ results probably come from the black parts of your background.
]]>
< ![CDATA[
Here’s an album of it all.
https://imgur.com/a/7X6PI
]]>
< ![CDATA[
Here’s an album of it all.
https://imgur.com/a/7X6PI
]]>
< ![CDATA[
Here’s another gif
https://lh3.googleusercontent.com/tsID5LWO-1608GpoKCuufkOQm55EllDfIIapfVsXExGlsqDuB26F8dlAVC76OqbSGssE9CFaLQ
]]>
< ![CDATA[
Now i see….and remember..
Detach from grid.
Tap once = resize panel
Tap again = scaling it.
Try fiddle with that.
]]>
< ![CDATA[
When the panel is detached from grid, tapping the BG object at all appears to just erase the panel background. Would it make a difference if the BG object is pinned?
]]>
< ![CDATA[
It does a different calculation if the “bur’-item is detached from grid.
]]>
< ![CDATA[
I’ve figured it out. It lines up correctly for me now if the background image is exactly the size of my screen.
]]>
< ![CDATA[
Photo to proof 😉
]]>
< ![CDATA[
https://lh3.googleusercontent.com/F_QPY3H9-xeaT3_zX_MtGAvsMFCwoItXVM58OtufnQzJo1UXExI-edC7tfzWQC86Drl7urAArg
]]>
< ![CDATA[
https://lh3.googleusercontent.com/sLc7XiQSYdRXxlYVfIL5HLBeutOCANV8R-C1eqD13GvSQ9aPtets0eddToRlXD6Id2SjeesbRQ
]]>
< ![CDATA[
Nice job!
One question : when you say:exactly the screensize. That is the screenresolution like 800×480 or do you correct for top bottom bar?
]]>
< ![CDATA[
Playing with the “14” in the script will give you more or less blur!
]]>
< ![CDATA[
The image file that I’ve got set as the background for the BG object is the same dimensions as my screen resolution (1560×2440)
The bottom bar down there is just icons I’ve put. I have tactile back, square, and home buttons.
]]>