Coder Social home page Coder Social logo

cabin-demo's Introduction

cabin_demo

Flutter example app developed by KDAB, adapted from a Qt example application.

Building & Running

$ git clone https://github.com/KDAB/cabin_demo
$ cd cabin_demo
$ flutter run

Updating the images

The cabin demo uses subset images in all places, to lower the memory bandwidth requirements.

Subset Images

Often, images / icons only have a little amount visible pixels in the middle, and the rest is just transparent pixels.

When drawing images like these using flutter, alpha-blending those transparent pixels at the border still takes up valuable memory bandwidth.

To combat this problem, we clip all images to their visible pixels (== subsetting) and then add padding around the subset image, so it still renders the same as the original image.

Image Subsetting Tool

The tool that does that is in the tools/image_subset directory.

When run, the tool:

  • produces one image in assets/.../image.png that's clipped to its visible pixels for each image in the tools/image_subset/input/.../image.png directory

  • generates a lib/widgets/subset_images.dart file which contains

    • a SubsetImageData class, containing info about the subset, so we can make the subset image render exactly the same as the original image
    • a SubsetImage widget, which will take a SubsetImageData and use it to render a subset image exactly the same as the original image
    • a SubsetImages class, containing the static const SubsetImageData for each image

The add a new image that should be subset, add it to tools/image_subset/input/... and rerun the tool, like this:

$ dart run tools/image_subset/bin/image_subset.dart

cabin-demo's People

Contributors

ardera avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rafaband

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.