FrostedGlass is a translucent frosted glass effect widget, that creates a context with the background behind it.

Overview

FrostedGlass

FrostedGlass is a translucent frosted glass effect widget, that creates a context with the background behind it.

The effect is drawn on the FrostedGlass canvas, based on the widget passed in as the background.

Github Build Status PyPI

Install

pip install kivy_garden.frostedglass

Import

from kivy_garden.frostedglass import FrostedGlass

Example:

Image:
    id: bg_image
    pos_hint: {'center_x': 0.5,'center_y': 0.5}
    size_hint: (None, None)
    size: (350, 350)
    source: 'live/kivy_logo.png'

FrostedGlass:
    pos_hint: {'center_x': 0.5, 'center_y': 0.5}
    size_hint: (None, None)
    size: (180, 150)
    background: bg_image
    blur_size: 25
    luminosity: 1.1
    overlay_color: 0.75, 0.75, 0, 0.65
    border_radius: 0, 150, 0, 150
Label:
    text: 'FrostedGlass'
    color: 'black'
    font_size: '26sp'
    bold: True

You can find more usage examples, including uses with ScrollView in the examples folder.


FrostedGlass creation process, guidelines and contribuition

To reach the final result of the FrostedGlass widget, the steps described in the image below are followed

Guidelines

  • When using FrostedGlass with static backgrounds, it is not necessary to update the FrostedGlass effect, but if necessary at some point, just call the update_effect() method.
  • If the background moves relative to FrostedGlass, or FrostedGlass moves relative to the background, it is necessary to call the start_auto_update_effect method to update the effect automatically. Don't forget to call the stop_auto_update_effect method, to avoid FPS drop, when the movement stops and it is not necessary to keep the effect updating continuously. The recommended way to do this is found in the examples folder.
  • In the current version (v0.1.1rc1) the less FrostedGlass you use, the smaller they are, and the less you need to continually update them, the better the performance, and you will notice very few changes in the FPS.
  • If you use FrostedGlass efficiently, there will be no performance drop, and you will still enjoy a modern look in your apps.

FrostedGlass is currently under development, and some issues can be noticed in version 0.1.1rc1:

  • FPS drop when using large or multiple FrostedGlass widgets, which need to be continuously automatically updated.
  • Temporary FPS drop when you touch the screen, even using static FrostedGlass widgets (which don't need to be automatically updated). The FPS goes up right after touch up.

πŸ”΄ Encouraged contributions and starting point guides πŸ”΄

  • Considering the issues mentioned above, it is recommended that work be done to resolve these issues.
  • Improving shader performance in performing Gaussian blur can significantly increase FrostedGlass performance. Knowledge in OpenGL can help a lot here!
  • Adding manipulations to the Vertex Shader, in addition to what is done here (only Fragment Shader), can be important in improving performance.
  • FBO manipulations are a hypothetical point for performance improvement.
  • Perhaps saving the effect temporarily in cache, and computing just its position can be an important factor. Other caching implementations may also be useful.

API

background

Target widget/layout that will be used as a background to FrostedGlass. The recomended way to pass the widget is through the widget/layout id.

background is defaults to None.


blur_size

Size of the gaussian blur aplied to the background.

blur_size is defaults to 60.


luminosity

Luminosity boost that will be aplied to the background.

luminosity is defaults to 1.25.


overlay_color

Color/tint overlay.

overlay_color is defaults to [1, 1, 1, 0.6].


noise_opacity

Opacity of the noise texture layer.

noise_opacity is a defaults to 0.1.


downscale_factor

Determine how many times the FBO size will be reduced. This property affects the performane directly. As bigger the FBO is, more slow will be the process to compute the gaussian blur resulting in significative fps drop.

downscale_factor is defaults to 8.


border_radius

Border radius that will be used by the default canvas shape (RoundedRectangle).

border_radius is defaults to [0, 0, 0, 0].


update_effect()

Updates the effect only once with each method call. If you only need to change the effect once in a while, it is recommended that you call this method. If you need constant updates, it is recommended to use start_auto_update_effect and start_auto_update_effect to manage this.


start_auto_update_effect()

Start automatic update of effect. The automatic update will remain active until you call the stop_auto_update_effect() method. Can be called multiple times without problems, but will only run once.


stop_auto_update_effect()

Stop automatic update of effect. It is recommended that you call this method whenever you do not need the effect to keep updating automatically. As this prevents FPS drop.


CI

Every push or pull request run the GitHub Action CI. It tests the code on various OS and also generates wheels that can be released on PyPI upon a tag. Docs are also generated and uploaded to the repo as well as artifacts of the CI.

Contributing

Check out our contribution guide and feel free to improve the FrostedGlass flower.

πŸ”΄ If you have a bug or an idea, create a report to help us improve or suggest an idea for this project by opening an issue

πŸ”΄ Every contribution is welcome and appreciated!!!

License

This software is released under the terms of the MIT License. Please see the LICENSE.txt file.

You might also like...
A simple program to recolour simple png icon-like pictures with just one colour + transparent or white background. Resulting images all have transparent background and a new colour.

A simple program to recolour simple png icon-like pictures with just one colour + transparent or white background. Resulting images all have transparent background and a new colour.

ABT aka Animated Background Tool is a windows only python program that makes it that you can have animated background.

ABT ABT aka Animated Background Tool is a windows only python program that makes it that you can have animated background. 𝓑𝓔𝓐𝓓 π“œπ“”, An Important

DexterRedTool - Dexter's Red Team Tool that creates cronjob/task scheduler to consistently creates users

DexterRedTool Author: Dexter Delandro CSEC 473 - Spring 2022 This tool persisten

Neural Magic Eye: Learning to See and Understand the Scene Behind an Autostereogram, arXiv:2012.15692.
Neural Magic Eye: Learning to See and Understand the Scene Behind an Autostereogram, arXiv:2012.15692.

Neural Magic Eye Preprint | Project Page | Colab Runtime Official PyTorch implementation of the preprint paper "NeuralMagicEye: Learning to See and Un

Learning Intents behind Interactions with Knowledge Graph for Recommendation, WWW2021

Learning Intents behind Interactions with Knowledge Graph for Recommendation This is our PyTorch implementation for the paper: Xiang Wang, Tinglin Hua

CloudProxy is to hide your scrapers IP behind the cloud
CloudProxy is to hide your scrapers IP behind the cloud

Hide your scrapers IP behind the cloud. Provision proxy servers across different cloud providers to improve your scraping success.

XHacks 2021 Startup Track Winner: Be Heard. Educate, Enact, Empower. No voice left behind. (backend)
XHacks 2021 Startup Track Winner: Be Heard. Educate, Enact, Empower. No voice left behind. (backend)

Be Heard: X Hacks 2021 Submission Educate, Enact, Empower. No voice left behind. Inspiration To say 2020 was an eventful year would be an understateme

Learn meanings behind words is a key element in NLP. This project concentrates on the disambiguation of preposition senses. Therefore, we train a bert-transformer model and surpass the state-of-the-art.

New State-of-the-Art in Preposition Sense Disambiguation Supervisor: Prof. Dr. Alexander Mehler Alexander Henlein Institutions: Goethe University TTLa

graphw00f is Server Engine Fingerprinting utility for software security professionals looking to learn more about what technology is behind a given GraphQL endpoint.
graphw00f is Server Engine Fingerprinting utility for software security professionals looking to learn more about what technology is behind a given GraphQL endpoint.

graphw00f - GraphQL Server Fingerprinting graphw00f (inspired by wafw00f) is the GraphQL fingerprinting tool for GQL endpoints. Table of Contents How

CloudFlare reconnaissance, tries to uncover the IP behind CF.

CloudFlare reconnaissance, tries to uncover the IP behind CF.

The code behind sqlfmt.com, a web UI for sqlfmt

The code behind sqlfmt.com, a web UI for sqlfmt

Behind the Curtain: Learning Occluded Shapes for 3D Object Detection

Behind the Curtain: Learning Occluded Shapes for 3D Object Detection Acknowledgement We implement our model, BtcDet, based on [OpenPcdet 0.3.0]. Insta

Keep your company's passwords behind the firewall

TeamVault TeamVault is an open-source web-based shared password manager for behind-the-firewall installation. It requires Python 3.3+ and Postgres (wi

Alt1-compatible widget host for RuneScape 3

RuneKit Alt1-compatible toolbox for RuneScape 3, for Linux and macOS. Compatibility macOS installation guide Running This project use Poetry as packag

Multi-handle range slider widget for PyQt/PySide
Multi-handle range slider widget for PyQt/PySide

QtRangeSlider The missing multi-handle range slider widget for PyQt & PySide The goal of this package is to provide a Range Slider (a slider with 2 or

Location field and widget for Django. It supports Google Maps, OpenStreetMap and Mapbox
Location field and widget for Django. It supports Google Maps, OpenStreetMap and Mapbox

django-location-field Let users pick locations using a map widget and store its latitude and longitude. Stable version: django-location-field==2.1.0 D

A better and faster multiple selection widget with suggestions
A better and faster multiple selection widget with suggestions

django-searchable-select A better and faster multiple selection widget with suggestions for Django This project is looking for maintainers! Please ope

Django model field that can hold a geoposition, and corresponding widget
Django model field that can hold a geoposition, and corresponding widget

django-geoposition A model field that can hold a geoposition (latitude/longitude), and corresponding admin/form widget. Prerequisites Starting with ve

Location field and widget for Django. It supports Google Maps, OpenStreetMap and Mapbox
Location field and widget for Django. It supports Google Maps, OpenStreetMap and Mapbox

django-location-field Let users pick locations using a map widget and store its latitude and longitude. Stable version: django-location-field==2.1.0 D

Comments
  • Use BoxLayout instead of FloatLayout

    Use BoxLayout instead of FloatLayout

    Is your feature request related to a problem? Please describe.

    Just came across FrostedGlass today and assumed it would be trivially possible to put widgets into the FrostedLayout. I see, however, that FrostedLayout is (as of very recently) based on FloatLayout. I do feel bad for saying this right after #1 was closed.

    The problem with using FloatLayout, from what I can tell : - The FrostedGlass needs to be of a predetermined size or sized to fill available space. It's not easy to make it scale to fit the contents. - Children need to manually positioned / sized so that it can fit into the FrostedGlass

    Describe the solution you'd like

    If you were to base FrostedLayout on a BoxLayout, then children can be trivially added to the BoxLayout to build a complex layout which can also push out the size of the FloatLayout to contain the children. If you really did want a FloatLayout in some context, such a Layout can be added to the FrostedLayout(BoxLayout) and used as normally. It would also be possible to insert a RelativeLayout inside the BoyLayout instead, to get a Float-like arrangement of children which remains confined to the area of the FrostedGlass

    As an example, this is how I make BoxLayouts have colors:

    https://github.com/chintal/ebs-iot-linuxnode/blob/108eb20c67430c8b7d74b9dd75903304309e75c3/ebs/iot/linuxnode/widgets/colors.py#L77

    opened by chintal 2
  • Feature to add widgets to the container `FrostedGlass`

    Feature to add widgets to the container `FrostedGlass`

    I've been testing the FrostedGlass widget for a while... Sure, this is a great job, but the widget itself has no practical use whatsoever. Because there is no way to place other widgets in it. Also, you cannot place other widgets OVER the FrostedGlass widget. Without this feature, I don't know how a user can use FrostedGlass in their application.

    opened by HeaTTheatR 2
  • Performance improvement, minor bug fixes and more

    Performance improvement, minor bug fixes and more

    Widget:

    • General performance improvement with new rules for widget update. Now, only widgets inside the window, or on the current screen (when using screenmanager) will be updated. Avoiding unnecessary computation of widgets that are not being viewed.
    • Improved integration with ModalView.
    • Significant performance improvement when using multiple moving FrostedGlass widgets (like inside a ScrollView).
    • Removal of the FrostedGlass children's "final effect widget" (only the canvas will be added to the FrostedGlass canvas widget).
    • Improved performance when animating the blur_size property.
    • Added support for auto-update when using videos as background.
    • Minor bug fixes

    Docs:

    • Added usage example with ModalView
    • Updated overview video with new example using ModalView
    opened by DexerBR 0
Releases(0.2.0)
  • 0.2.0(Mar 9, 2022)

    Highlights

    • Significant improvements in overall performance.
    • Improved blur quality.
    • Automatic effect update to keep it in sync with the background.
    • Improved noise texture quality and consistency of its appearance on different devices.

    Added

    • Added saturation property.
    • Added outline_color property.
    • Added outline_width property.
    • Added refresh_effect() method.
    • Added feature to add widgets to the container FrostedGlass #1.

    Changed

    • Default luminosity value changed from 1.25 to 1.3.
    • Default overlay_color value changed from [1, 1, 1, 0.75] to [0.5, 0.5, 0.5, 0.5].
    • Default luminosity value changed from 1.25 to 1.3.
    • Default blur_size value changed from 60 to 25.
    • update_effect() does not need to be called manually to update the effect. This is already managed by the widget.

    Removed

    • Removed downscale_factor property.
    • Removed start_auto_update_effect() method.
    • Removed stop_auto_update_effect() method.

    Fixed

    • Temporary FPS drop when there was a touch on the screen (even using static FrostedGlass widgets).
    Source code(tar.gz)
    Source code(zip)
    kivy_garden.frostedglass-0.2.0-py2.py3-none-any.whl(9.36 KB)
    kivy_garden.frostedglass-0.2.0.tar.gz(10.63 KB)
Owner
Kivy Garden
Kivy Garden
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Kizdude 2 Jan 22, 2022
Rembg is a tool to remove images background.

Rembg is a tool to remove images background.

Daniel Gatis 7.8k Jan 5, 2023
Remove Background from Image With Python

Install Library pypi $ pip3 install xremovebg

krypton 4 May 26, 2022
Tool to create a Phunk image with a custom background

Create Phunk image Tool to create a Phunk image with a custom background Installation Clone the repo git clone https://github.com/albanow/etherscan_sa

Albano Pena Torres 6 Mar 31, 2022
This Github Action automatically creates a GIF from a given web page to display on your project README

This Github Action automatically creates a GIF from a given web page to display on your project README

Pablo Lecolinet 28 Dec 15, 2022
Magic-Square - Creates a magic square by randomly generating a list until the list happens to be a magic square

Magic-Square Creates a magic square by randomly generating a list until the list happens to be a magic square. Done as simply as possible... Frequentl

Nick 2 Jan 1, 2022
[CVPR2021] The source code for our paper γ€ŠRemoving the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Learning》.

TBE The source code for our paper "Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Le

Jinpeng Wang 150 Dec 28, 2022
Fully Automated YouTube Channel ▢️with Added Extra Features.

Fully Automated Youtube Channel β–’β–ˆβ–€β–€β–ˆ β–ˆβ–€β–€β–ˆ β–€β–€β–ˆβ–€β–€ β–€β–€β–ˆβ–€β–€ β–ˆβ–‘β–‘β–ˆ β–ˆβ–€β–€β–„ β–ˆβ–€β–€ β–ˆβ–€β–€β–ˆ β–’β–ˆβ–€β–€β–„ β–ˆβ–‘β–‘β–ˆ β–‘β–‘β–ˆβ–‘β–‘ β–‘β–’β–ˆβ–‘β–‘ β–ˆβ–‘β–‘β–ˆ β–ˆβ–€β–€β–„ β–ˆβ–€β–€ β–ˆβ–„β–„β–€ β–’β–ˆβ–„β–„β–ˆ β–€β–€β–€β–€ β–‘β–‘β–€β–‘β–‘ β–‘β–’β–ˆβ–‘β–‘ β–‘β–€β–€β–€ β–€β–€β–€β–‘

sam-sepiol 249 Jan 2, 2023
An audio guide for destroying oracles in Destiny's Vault of Glass raid

prophet An audio guide for destroying oracles in Destiny's Vault of Glass raid. This project allows you to make any encounter with oracles without hav

null 24 Sep 15, 2022
An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

Brian Peiris 12 Nov 2, 2022