I am having problems with multi image in the new GUI builder. It doesn't scale as should with individual skin or device screen. Is there another way to add multi image to scale according to screen size in the code?
I got this done very well in the old GUI builder. This is preventing me from having my app update.
Open the designer and verify that the image is indeed a multi-image and that resolutions exist for all the right DPI's.
Look at the code and verify that the image is fetched using getImage(String) and isn't manipulated in any way.
Verify that you are using Label and not ScaleImageLabel or some similar class.
The Phoenix demo was created using the new GUI builder and uses a lot of multi-images.
Related
The CodenameOne GUI Builder seems to have a mind of its own..
I created a simple form with a button that has a green image when it is enabled and red when disabled. In my code I use another button to call an event function that enables and disables the button.
This seems pretty simple, yet it doesn't work reliably. The button's image changes between green and transparent as it toggles. Other times it works correctly. After I make a change I always do a 'save' and a 'regen' in the GUI Builder and then 'Clean and Build' in NetBeans.
Also, the size of my image is much smaller in the simulator than in the GUI Builder.
GUI Builder is sooo frustrating; I wish I could just code the for using html and css :(
Any suggestions would be appreciated.
Please see my video capture (https://siscocircuits.com/cno_gui_builder_problem.wmv) which shows the problem in action.
You can write code in Java to represent the GUI. In fact that's what the GUI builder does under the surface and that's what most of our demos do. We also support a form of CSS.
The problem with the image sizes is probably due to the fact that you used regular images instead of multi-images to adapt to the various DPIs. I suggest reviewing the generated code to see what went wrong it's a bit difficult to see in the video but you can put a breakpoint in the debugger and step over the generated code.
I am looking for a Deep Zoom Image (DZI) viewer in CPP.
Currently, we have a viewer designed in javascript (Open Seadragon), java, and C# for the dzi images.
I am looking for the open-source viewer that can be integrated in my CPP application.
I made a tiny example program that displays a libvips image in a window:
https://github.com/libvips/vipsdisp-tiny
It's about 300 lines for the entire thing. It uses gtk+3, but it should be simple to adapt for other toolkits.
The cool thing is that it doesn't just display an image, it displays the end of a libvips pipeline, and it does it asynchronously. You can scroll around the image and the display will be updated in the background by a threadpool as chunks of the image are computed.
For your application, you could use vips_arrayjoin() to join up the tiles of the DZI image, then display the output of arrayjoin in the window.
There's a more complete image viewer here:
https://github.com/jcupitt/vipsdisp
Though I still haven't got around to finishing it, unfortunately.
Is codenameone support add flash file.
Is codenameone support add Gif Image programmatically.
how to use create Graphics object.
Codename One or any modern mobile doesn't support adding flash files as those aren't designed for the mobile world.
You can add a gif image by using the "Add Animation" option in the designer tool and then using the getImage(String) method of the Resources object. That means you can't download an arbitrary gif off the internet but you can convert it to a res file and download that dynamically.
You can get a graphics object either by overriding paint(Graphics), implementing a painter etc. or by getGraphics on a mutable image see more here.
My app is too large for the 50 meg limit so I am looking at some ways to significantly reduce the file size.
If I discard a dpi what happens when it runs on that dpi? I have some HUGE backgrounds making my app very bloated, I was wondering if I can remove them all but say the HD one and it would scale or would it be simply empty? Or would I need to change the background image scaling to make it do this?
Also CN1 seems to use png, can I use jpg for selected items to save space? Backgrounds that are 2.3 meg pngs could be 35k jpgs.. Even if I wrote a script that jpeged them after I press save in the gui designer, this could work I assume?
Any any further final tips for reducing the size of cn1 apps?
A 50mb app is not only big, but prone to be slow on devices (performance wise).
To reduce your App size tremendously, do the following:
All my answers are based on old GUI Builder
For background image, use a single image (not multi-image) and style the form UIID to use the image and type IMAGE_TO_FILL.
Avoid using png image whenever possible, CN1 supports jpg perfectly.
Don't use images for basic icons, use fonticon. Thousand of icons could be made 100kb and of high quality svg image that doesn't pixelate. I will explain at the end of this list how to create your custom fonticons.
Avoid using 9-piece border image where it's not really needed, try to use solid background color if it won't ruin your design.
Delete unused images, they also take a lot of space. On your GUI Builder.
Re-use UIIDs, instead of creating multiple similar UIIDs.
Migrate your GUI Builder forms to code, I posted a sample form Class to answer another question here and also talk about similar thing here.
Delete UIIDs you're not using and in most cases, copy and paste UUID of unselected style to selected, instead of creating similar.
Be Careful with this. Keep your GUI Builder open, make sure Xml team mode is checked under File, save the GUI Builder after deleting Unused Images, without closing the GUI Builder, go to your project folder -> res -> delete theme.xml and the theme folder inside res folder (The name might be different if you've renamed your theme.res file). Now go back to your app and save again. A fresh copy of your res files would be saved in the same folder.
Minimise the amount of background images you use, Modern good looking apps are simple plain background apps. E.g, Facebook, Twitter, Uber, AirBnB, BBC News App and many others. Unless your app is actually a game or necessarily require rich images that have to be static.
Watch this video about performance tuning, It's a bit old but still contains useful information
If your app is bigger than 20 mb on iOS and 5mb on android, you should be worried about it's performance.
Creating fonticons:
Go to fontello.com and check the icons present, if there are icons you need that are not there...
Go to flaticon.com and search for it there, download it as svg and drag'n'drop the svg on fontello webpage. If the icon doesn't look as expected...
Go back to flaticon.com and download the image as black 512px png image and go to online-convert.com, convert the png to Monochrome svg file, this helps you to create a compound image that works well with fontello.
download the fonticon as zip on fontello and follow Shai's chat app example to use it. the zip contains demo html file to preview your icons and also a config.json that can be drag'n'drop on fontello.com to continue where you stopped.
it is possible to display a picture on a window created by winmain i mean using GDI,
i want do create a window that captures my whole screen i have done that by using GDI but unable to show an image on it how can i do so?
There are lots of good tutorials on the web.