[PLUGIN] AGS Fake Screen + Box Blur (OPEN SOURCE) - v1.0

Started by Dualnames, Wed 12/06/2019 18:53:06

Previous topic - Next topic

Dualnames

1. Prologue:

So, what this module basically does is it perfectly replicates your screen MINUS the UIS and the mouse and other overlays. This can be used essentially for capturing screenshots. And essentially for BOX BLUR.
And it's faster and better than the module that already exists. I can do a boxblur of 3 iterations with zero framedrop. Most of the code is based on Steve's wonderful idea almost a decade ago with the FakeScreen, so this is essentially an up from that. The code is open sourced, for those that want to improve it and such.



2. Instructions/Going through the functions

1. Import the module in your project (AGS Fake Screen.scm)
2. Import and enable the plugin (AGSFakeScreen.dll)

AGS Fake Screen Functions


  • int FakeScreenUpdate();

    This returns a graphic sprite number where everything is drawn to as a replica of the screen.

Code: AGS


function TakeScreenShot()
{  
  int getGraphic=FakeScreenUpdate(); 
  DynamicSprite*screenshot=DynamicSprite.CreateFromExistingSprite(getGraphic,false);
  int setSlot=5;
  screenshot.SaveToFile(String.Format("$SAVEGAMEDIR$/%d.bmp",setSlot));
}
//this will draw a replica of the screen and save it 



DrawBoxBlur(int sprite, int radius)

This takes a sprite as a parameter, in this example case it will take the sprite that we'll be using to BoxBlur our entire screen, but it can blur any sprite. Radius defines how many times BoxBlur will be applied. Ranges from 1-however many u like/your pc can support

Code: AGS

Overlay*screenlay;

function repeatedly_execute_always()
{  
  int getgraph = FakeScreenUpdate();
  DrawBoxBlur(getgraph, 3);  
  screenlay=Overlay.CreateGraphical(0, 0, getgraph, true);
}
//this will box blur with 3 iterations your entire screen every frame.





3. Download links

AGSFAKESCREEN.dll
AGSFakeScreen.scm

*ZIP file containing both*

4. Source

The source files can be found on GITHUB



Box Blur 3 iterations
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

selmiak

nice. And very quick <3

does this work on other operating systems than windows as it requires a dll?

henrikes

Love it....

Just 2 questions :D

1- How do i revert the blur (im looking for the ability to blur and unblur)
2- Can we do a gradual blur? For instance take 1 second from start to finish?

Thank you

Dualnames

Code: ags

bool BlurEnabled=false;
function repeatedly_execute_always()
{  
  int getgraph = FakeScreenUpdate();
  if (BlurEnabled) DrawBoxBlur(getgraph, 3);  
  screenlay=Overlay.CreateGraphical(0, 0, getgraph, true);
}

[code]

Something like that would work.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

henrikes

Got the On and Off working.... but im still struggling with the gradual blured effect..

At this moment to get that effect i use two images (1 normal and 1 blurred) and i use the tween module (TweenTransparency with a delay value) to affect the visibility of the normal one. What i would like to do is use your module to achieve the same effect.

Bellow its a video using "AGS Fake Screen" and the techniques im now using "Images" (and would love to replace with AGS Fake Screen)



You can see two things:
1. In the AGS FakeScreen the blur occurs instantaneously (couldnt figure out how to make it gradual)
2. In the AGS FakeScreen when the blur is completed the image shifts a bit


Does anyone has an ideia how to solve this? I would love to use AGS Fake Screen because then i wouldn't need to use to backgound images (One clear and one blurred)

Thanks in advance :)

SMF spam blocked by CleanTalk