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
vsketch is a Python generative art toolkit for plotters

Generative plotter art environment for Python

Antoine Beyeler 380 Dec 29, 2022
A functional and efficient python implementation of the 3D version of Maxwell's equations

py-maxwell-fdfd Solving Maxwell's equations via A python implementation of the 3D curl-curl E-field equations. This code contains additional work to e

Nathan Zhao 12 Dec 11, 2022
Create QR Code for link using Python

Quick Response QR is short and named for a quick read from a cell phone. Used to view information from transitory media and put it on your cell phone.

Coding Taggers 1 Jan 09, 2022
Random collage/montage generator with drop-shadow

Random Collage Example Usage These are the sample input files in $PWD for the below examples: 1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10

M B 1 Dec 07, 2021
QR-Generator - An awesome QR Generator to create or customize your QR's

QR Generator An awesome QR Generator to create or customize your QR's! Table of

Tristán 1 Jan 28, 2022
An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C.

vizh An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C. Overview Her

Sy Brand 228 Dec 17, 2022
EmbedToolV2 - 2.0 Version of DraKenCodeZ/ImageEmbedTool

EmbedToolV2 - 2.0 Version of DraKenCodeZ/ImageEmbedTool

DraKenCodeZ 1 Dec 07, 2021
Blender addon - convert empty image reference to image plane

Reference to image plane Convert reference images to a textured image mesh plane. As if it was imported with import image as plane Use on drag'n'dropp

Samuel Bernou 6 Nov 25, 2022
Py3D - A 3d rendering engine written entirely in python

Py3D is a 3d rendering engine written entirely in python. It is a simple and eas

1up Community 2 Nov 14, 2022
kikuchipy is an open-source Python library for processing and analysis of electron backscatter diffraction (EBSD) patterns

kikuchipy is an open-source Python library for processing and analysis of electron backscatter diffraction (EBSD) patterns. The library builds on the

pyxem 53 Dec 29, 2022
An open source image editor which can manipulate an image in many ways!

Image Editor - An open source image editor which can manipulate an image in many ways! If you need any more modes in repo or I

TroJanzHEX 44 Nov 17, 2022
Simple AI app that is guessing color of apple in picture

Apple Color Determinant Application that is guessing color of apple from image Install Pillow, sklearn and numpy, using command for your package manag

Gleb Nikitin 1 Oct 25, 2021
A simple python script to reveal the contents of a proof of vaccination QR code.

vaxidecoder A simple python script to reveal the contents of a proof of vaccination QR code. It takes a QR code image as input, and returns JSon data.

Hafidh 2 Feb 28, 2022
Hacking github graph with a easy python script

Hacking-Github-Graph Hacking github graph with a easy python script Requirements git latest version installed. A text editor (eg: vs code, sublime tex

SENPAI LEGEND 1 Nov 01, 2021
This will help to read QR codes using Raspberry Pi and Pi Camera

Raspberry-Pi-Generate-and-Read-QR-code This will help to read QR codes using Raspberry Pi and Pi Camera Install the required libraries first in your T

Raspberry_Pi Pakistan 2 Nov 06, 2021
sK1 2.0 cross-platform vector graphics editor

sK1 2.0 sK1 2.0 is a cross-platform open source vector graphics editor similar to CorelDRAW, Adobe Illustrator, or Freehand. sK1 is oriented for prepr

sK1 Project 238 Dec 04, 2022
Group of interfaces interesting for users

Project: Interface to create GIF animation based on Fourier Series.

5 Aug 17, 2021
Gallery written in Python to manage your photos

GalleryMan Gallery written in Python to manage your photos Installation

Asian Cat 24 Dec 18, 2022
Hide sensitive information in images

Data-Preserved Script allowing to blur the most sensitive information on images. Prerequisites Before you begin, ensure you have met the following req

2 Dec 01, 2021
Vignette is a Python library to create and manage thumbnails following the FreeDesktop standard.

Vignette Vignette is a Python library to create and manage thumbnails following the FreeDesktop standard. Thumbnails are stored in a shared directory

3 Feb 06, 2022