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
HCaptcha solver using requests and an image recognition package!

HCaptcha solver using requests and an image recognition package! Report Bug · Request Feature Features Image recognition Requests base

dropout 6 Oct 22, 2021
Validate arbitrary image uploads from incoming data urls while preserving file integrity but removing EXIF and unwanted artifacts and RCE exploit potential

Validate arbitrary base64-encoded image uploads as incoming data urls while preserving image integrity but removing EXIF and unwanted artifacts and mitigating RCE-exploit potential.

A3R0 1 Jan 10, 2022
:rocket: A minimalist comic reader

Pynocchio A minimalist comic reader Features | Installation | Contributing | Credits This screenshots contains a page of the webcomic Pepper&Carrot by

Michell Stuttgart 73 Aug 02, 2022
Advance Image Steganography

Chaya Advance Image Steganography Using LSB-LPS + AES-256-GCM + FLIF Right To Privacy! United Nations Declaration of Human Rights (UDHR) 1948, Article

XeroHack 113 Dec 02, 2022
A 3D structural engineering finite element library for Python.

An easy to use elastic 3D structural engineering finite element analysis library for Python.

Craig 220 Dec 27, 2022
Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.

django-image-cropping django-image-cropping is an app for cropping uploaded images via Django's admin backend using Jcrop. Screenshot: django-image-cr

Jonas und der Wolf GmbH 546 Jan 03, 2023
Fixed Version Of Blender Low Poly Rock Generator For Blender 3.0.0

Blender (3.0.0) - Low Poly Rock Generator This is an addon for Blender 3.0.0 to generate low poly rocks. It was based on an addon that unfortunately h

3 Mar 24, 2022
Viewer for NFO files

NFO Viewer NFO Viewer is a simple viewer for NFO files, which are "ASCII" art in the CP437 codepage. The advantages of using NFO Viewer instead of a t

Osmo Salomaa 114 Dec 29, 2022
Bot by image recognition simulating (random) human clicks

bbbot22 bot por reconhecimento de imagem simulando cliques humanos (aleatórios) inb4: sim, esse é basicamente o mesmo bot de 2021 porque a Globo não t

Yuri 2 Apr 05, 2022
Image generation API.

Image Generator API This is an api im working on Currently its just a test project Im trying to make custom readme images with your discord account pr

Siddhesh Zantye 2 Feb 19, 2022
👾 Python project to help you convert any image into a pixel art.

👾 Pixel Art Generator Python project to help you convert any image into a pixel art. ⚙️ Developer's Guide Things you need to get started with this co

Atul Anand 6 Dec 14, 2022
Blender addon to generate better building models from satellite imagery.

Blender addon to generate better building models from satellite imagery.

Ivan Ereshchenko 24 Apr 14, 2022
Python Image Optimizer Script

Image-Optimizer Download and Install git clone https://github.com/stefankumpan/Image-Optimizer-Script.git cd Image-Optimizer-Script pip install -r req

Stefan Kumpan 0 Jul 15, 2021
Docbarcodes extracts 1D and 2D barcodes from scanned PDF documents or images. It can be used to automate extraction and processing of all kind of documents.

Intro Barcodes are being used in many documents or forms to enable machine reading capabilities and reduce manual processing effort. Simple 1D barcode

Arlind Nocaj 3 Jun 18, 2022
Computer art based on joining transparent images

Computer Art There is no must in art because art is free. Introduction The following tutorial exaplains how to generate computer art based on a series

Computer Art 12 Jul 30, 2022
Generates images of calendar month tables and can paste them onto suitable photos.

📆 calendizer README Generates images of calendar month tables and can paste them onto suitable photos. A quick way to make your own calendar for prin

Sean Ryan 2 Dec 14, 2022
Converting Images Into Minecraft Houses

Converting Images Into Minecraft Houses In this particular project, we turned a 2D Image into Minecraft pixel art and then scaled it in 3D such that i

Mathias Oliver Valdbjørn Jørgensen 1 Feb 02, 2022
Sombra is simple Raytracer written in pure Python.

Sombra Sombra is simple Raytracer written in pure Python. It's main purpose is to help understand how raytracing works with a clean code. If you are l

Hernaldo Jesus Henriquez Nuñez 10 Jul 16, 2022
Manipulate EXIF and IFD metadata.

Tyf Copyright Distribution Support this project Buy Ѧ and: Send Ѧ to AUahWfkfr5J4tYakugRbfow7RWVTK35GPW Vote arky on Ark blockchain and earn Ѧ weekly

16 Jan 21, 2022
Collection of SVG diagrams about how UTF-8 works

Diagrams Repository of diagrams made for articles on my blog. All diagrams are created using diagrams.net. UTF-8 Licenses Copyright 2022 Seth Michael

Seth Michael Larson 24 Aug 13, 2022