# Screehshot (display.captureScreen) behaiviour

**URL:** <https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873>\
**Category:** Advanced Graphics\
**Created:** [July 20, 2020, 8:25am UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873 "2020-07-20T08:25:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrey5045](https://forums.solar2d.com/user_avatar/forums.solar2d.com/andrey5045/32/146_2.png) [@Andrey5045](https://forums.solar2d.com/u/Andrey5045)\
**Post date:** [July 20, 2020, 8:25am UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873/1 "2020-07-20T08:25:06Z")

</div>

Somewhere I read that it is possible to make the whole screen blurry. A blurry background is a good base for a menu. The idea is to make a screenshot, and then apply a filter. Works for me well. Here is a simple code.

```
local Top_Menu_group
Top_Menu_group = display.newGroup()

function top_menu_button_click(event)
	if event.phase == "ended" then
		-- Capture the screen
		local Screen_shot
		Top_Menu_group:removeSelf()
		Top_Menu_group = display.newGroup()
		-- first phase
    		Screen_shot = display.captureScreen( false )
		Screen_shot.x = display.contentCenterX
		Screen_shot.y = display.contentCenterY
		Screen_shot.fill.effect = "filter.grayscale"
		local Screen_shot2 = display.captureScreen( false )
		-- phase 2 (Possibly, there is a way how to apply TWO filters...)
		Screen_shot2.fill.effect = "filter.blurGaussian"
 		Screen_shot2.fill.effect.horizontal.blurSize = 20
		Screen_shot2.fill.effect.horizontal.sigma = 50
		Screen_shot2.fill.effect.vertical.blurSize = 20
		Screen_shot2.fill.effect.vertical.sigma = 50

		Screen_shot2.x = display.contentCenterX
		Screen_shot2.y = display.contentCenterY
		Screen_shot:removeSelf()
		Top_Menu_group:insert(Screen_shot2)
	end
end

```

The result looks wonderful! Now on top of it I can draw a colorful menu.

 ![image](https://forums.solar2d.com/uploads/default/original/1X/9dc0ac7fb7316dcc561fc8bded0cd0417b572bd1.jpeg)

But, there is just a small peculiarity, must be a bug. If at this stage I suspend and then resume the application. On a real device the **Screen\_shot2** object just disappears revealing the real background. But in the emulator everything is OK, the **Screen\_shot2** is still there.

The situation does not change if I avoid using a display-group. Also, I got no function to monitor suspend/resume events, so there is no code which works with the mentioned objects.

Build 2020.3601

---

<div class="post-metadata">

**Author:** ![bgmadclown](https://forums.solar2d.com/user_avatar/forums.solar2d.com/bgmadclown/32/490_2.png) [@bgmadclown](https://forums.solar2d.com/u/bgmadclown)\
**Post date:** [July 20, 2020, 8:50am UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873/2 "2020-07-20T08:50:16Z")

</div>

> ### Android
> 
> When an app is suspended, the Android OS removes all OpenGL textures from memory. When the app is resumed, Corona must reload all images, but the capture image no longer exists in memory.

> **[Solar2D Documentation — API Reference | Libraries | display | captureScreen](https://docs.coronalabs.com/api/library/display/captureScreen.html#gotchas)**
>
> Captures the contents of the screen and returns it as a new display object. You can optionally save the capture as a file to the device’s photo library. | Solar2D lets you build games/apps for all major platforms including iOS, Android, Kindle, Apple...

After that quote, docs also offer a workaround. You should take a look at that.

---

<div class="post-metadata">

**Author:** ![Andrey5045](https://forums.solar2d.com/user_avatar/forums.solar2d.com/andrey5045/32/146_2.png) [@Andrey5045](https://forums.solar2d.com/u/Andrey5045)\
**Post date:** [July 20, 2020, 9:28am UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873/3 "2020-07-20T09:28:50Z")

</div>

> [@bgmadclown](#):
>
> OpenGL

Thank you ⚜

---

<div class="post-metadata">

**Author:** ![Andrey5045](https://forums.solar2d.com/user_avatar/forums.solar2d.com/andrey5045/32/146_2.png) [@Andrey5045](https://forums.solar2d.com/u/Andrey5045)\
**Post date:** [July 20, 2020, 10:55am UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873/4 "2020-07-20T10:55:01Z")

</div>

I just thought that it would be good that in emulator of a device and on a real device things would work similarly…

---

<div class="post-metadata">

**Author:** ![bgmadclown](https://forums.solar2d.com/user_avatar/forums.solar2d.com/bgmadclown/32/490_2.png) [@bgmadclown](https://forums.solar2d.com/u/bgmadclown)\
**Post date:** [July 20, 2020, 12:41pm UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873/5 "2020-07-20T12:41:17Z")

</div>

If I knew my way around the engine source code, I could have implemented this though I assume this was on purpose. It seems that the specific API has different gotchas for every other platform. Instead of making it work skin-specific, they probably thought it was a good idea to encourage device testing.

---

<div class="post-metadata">

**Author:** ![roaminggamer](https://forums.solar2d.com/user_avatar/forums.solar2d.com/roaminggamer/32/134_2.png) [@roaminggamer](https://forums.solar2d.com/u/roaminggamer)\
**Post date:** [July 20, 2020, 3:28pm UTC](https://forums.solar2d.com/t/screehshot-display-capturescreen-behaiviour/351873/6 "2020-07-20T15:28:32Z")

</div>

I supply this kind of feature in SSK2: [https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/misc/#easyblur](https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/misc/#easyblur)

Works the same in simulator and on device. I haven’t run on an emulator however.

Note: Now however I’ll have to go and verify this after a suspend/resume. Interesting.
