I need a fast script which prints everything which is currently visible on a desktop (or in any other given…
I need a fast script which prints everything which is currently visible on a desktop (or in any other given rectangle on the screen) to a bitmap. Has somebody something similar already / a good idea? Extra complicated: I need to exclude a specific item.
TrianguloY Jappie Toutenhoofd Lutz Linke Pierre Hébert
]]>« Latest version, 12.7b6 (Previous Post)
(Next Post) How can I show below table using html in custom view? »
< ![CDATA[
If you are interested why I need this: I’m getting closer to realtime blur, but currently the effect stacks with itself, creating a fully blurred (monocolored) screen after a short while.
]]>
< ![CDATA[
Yoo need to exclude only one? Or multiple items? Do you want the excluded item(s) to be transparent (see-through)?
]]>
< ![CDATA[
http://www.lightninglauncher.com/wiki/doku.php?id=script_full_container_screenshot
??
]]>
< ![CDATA[
Benoît de Chezelles
Lol, exactly the dev i forgot to mention answers first.
Yes, I need to exclude exactly one item. I want the excluded item to not show up in the bitmap, so a screenshot as if the excluded item wasn’t there.
Jappie Toutenhoofd The problem with that script is that it copies everything on the desktop, not just a cutout.
]]>
< ![CDATA[
What about this? (i is the item where to apply the image to test)
var d=LL.getCurrentDesktop()
var im=LL.createImage(d.getWidth(),d.getHeight());
d.getView().draw(im.draw());
i.setBoxBackground(im,”n”);
To draw everything except an item maybe set its visibility to false, use the script above, set it back to true
]]>
< ![CDATA[
Isn’t possible to add a parameter for just ignoring an item in this script ?
If there is some overlapping I think not possible
Couldn’t you just set as not visible with Bindings and use this script, setting not visible for this item ?
]]>
< ![CDATA[
I would have say like TrianguloY
But I am not 100% sure that calling draw will really draw everything due to framework optimizations. There is a View private flag that allows clean views to skip their drawing, but maybe this only apply on HW canvas and not on software like the bitmap backed one. Anyway, should this issue appear, you will have to manually call invalidate on views first.
]]>
< ![CDATA[
It’s like calling Android’s “screenshot” function?
]]>
< ![CDATA[
TrianguloY the problem with that is, that I need to call the script continuously in positionchanged. So the item would flicker.
]]>
< ![CDATA[
Lukas Morawietz tested it, and no flicking. The problem is that if the screen is big, it is a bit laggy. Consider using a matrix to scale and use a smaller image.
The best is you to try, use this: (you need an item labeled “minimap” in the container where the script is set as the position change event)
if(this.minimapupdate)return;
this.minimapupdate=true;
var d=LL.getEvent().getContainer();
var it=d.getItemByName(“minimap”);
var im=it.getBoxBackground(“n”);
if(im==null){
im=LL.createImage(d.getWidth(),d.getHeight());
it.setBoxBackground(im,”n”,true);
im=it.getBoxBackground(“n”);
}
im.draw().drawColor(0,PorterDuff.Mode.CLEAR);
it.setVisibility(false);
d.getView().draw(im.draw());
it.setVisibility(true);
im.update();
this.minimapupdate=false;
]]>
< ![CDATA[
TrianguloY
I tried that, and in fact, it doesn’t flicker. But the item isn’t always excluded.
]]>
< ![CDATA[
Anyway, I’ve got a solution now, you’ll see it soon.
]]>