Search code examples
codenameone

defaultSourceDPIInt in the default theme.css of CodenameOne


In the new Codename One bare-bones project (https://start.codenameone.com/), there is a default theme.css that starts with:

#Constants {
    includeNativeBool: true;
    defaultSourceDPIInt: "0";
}

What is defaultSourceDPIInt: "0";? I couldn't find anything in the blog about this.


Solution

  • It's discussed here: https://www.reddit.com/r/cn1/comments/p0utte/defaultsourcedpiint_css_theme_constant_can_make/

    The defaultSourceDPIInt constant which you can use as:

    #Constants {
        /* ... */
         defaultSourceDPIInt: 0; 
    }
    

    Sets the default DPI of images you use in the theme. This is very important as the default is the creation of multi images. With 0 we're essentially importing all images as regular images by default which means you need to explicitly state the source DPI to prevent mistakes. Check out the git commit for the full story: https://github.com/codenameone/CodenameOne/commit/f31fb8a046759ed884ab61b2d34b42a614b2dbd2