xfangfang / borealis

Hardware accelerated, Nintendo Switch inspired UI library for PC, Android, iOS, PSV, PS4 and Nintendo Switch
Apache License 2.0
31 stars 21 forks source link

Separate the clear color from the application background #64

Closed xfangfang closed 8 months ago

xfangfang commented 8 months ago

Used for Android development:

  1. Usebrls::Application::getTheme().addColor("brls/clear", nvgRGBA(0, 0, 0, 0)); to set the Borealis background to transparent.
  2. Use mSurface.getHolder().setFormat(PixelFormat.RGBA_8888); in the onCreate function of the Android Activity to set the SurfaceView bound to Borealis to allow transparency.

Now you can freely control what can be drawn behind Borealis. In my own application, I use this method to bind ffmpeg to another SurfaceView and place it behind Borealis, instead of directly using OpenGL to draw on Borealis. This reduces copying and greatly improves performance when using hwdec.