Images generated with Flamingo tool have wrong size on iOS

67 views
Skip to first unread message

P5music

unread,
May 1, 2021, 8:09:35 AM5/1/21
to CodenameOne Discussions
My CN1 app has some buttons on the interface with images created with the Flamingo tool, that is, they are created in Java code from SVG files.
On the simulator and on Android the user interface is almost good, with right buttons image (see attached image right_button_image_dimension_example.png)

On iOS the buttons have the right size but the images are huge or tiny
(see attached image wrong_button_image_dimension_example
for the huge case)

This is the code for the most recognizable one:
saveIconImageSoliciting=new SaveIconSoliciting().scaled(normalButtonSize,normalButtonSize).toImage();
saveButton=new ScaleImageButton(saveIconImageSoliciting);
where
SaveIconSoliciting is the class created by Flamingo.

see also these thread
Can my app be affected by that on iOS?
Otherwise what could be the cause and how to fix?
Thanks in advanvce

P5music

unread,
May 1, 2021, 10:36:05 AM5/1/21
to CodenameOne Discussions
Here are the images (see previous message)
Regards
wrong_button_image_dimension_example.png
right_button_image_dimension_example.png

Shai Almog

unread,
May 1, 2021, 9:37:11 PM5/1/21
to CodenameOne Discussions
What's normalButtonSize ?
I'm assuming it's huge on iOS.

P5music

unread,
May 2, 2021, 3:29:07 AM5/2/21
to CodenameOne Discussions
No, normalButtonSize is not huge. Maybe my written explanation was not clear enough in regard of the images.

As you can see from the attached images the buttons have the right size, so
I can say that
the image itself is not huge, but the internal drawing is out of scale so

the resulting picture has the right size but it depicts only a small fraction of the total area of the drawing.

You can see that in one image in particular a detail is "magnified", so you recognize the shape of the icon and it is clear that
it is like
the image is huge but the viewport just shows a portion of it.

The viewport is the button
and it is the size of the resulting image:
it has the right size in pixels but the drawing exceedes it.
Regards

Shai Almog

unread,
May 2, 2021, 9:58:32 PM5/2/21
to CodenameOne Discussions
I don't understand the logic of your app here.
You're scaling a font icon.
Converting it to a non-scalable png.
Then placing that in a self scaling button to scale again.

I suggest isolating this to a runnable test case.

P5music

unread,
May 3, 2021, 2:37:26 AM5/3/21
to CodenameOne Discussions
Maybe you answered to another thread by mistake.
This is what my problem is:
I created icons in my app by means of the Flamingo tool. They originate from svg files and then they become Java classes. It is so also because some new icons are created, and also they have to be injected in HTML.

I am not using material font in this case.
The images resemble the material icons but as you can see in the example the icon is a new one, it is modified, so it is assigned to the button like an image.

The image (I am referring to the object) has the right size, but the drawing, or the scaling, or whatever internal method is doing something wrong.
Indeed just a tiny part is visible of the original shape, because it is in big size (but in normal viewport size), as you can see in the detail of the attached image.

Regards

Shai Almog

unread,
May 3, 2021, 9:56:13 PM5/3/21
to CodenameOne Discussions
What's in the paint() method of SaveIconSoliciting()?

P5music

unread,
May 4, 2021, 3:48:05 AM5/4/21
to CodenameOne Discussions
I think you have more convenience checking the entire class, as in the attached txt file.
Notice that normalButtonSize=48 for iPad II simulator skin (and so it seems for the real device).
Regards
saveIconSoliciting.txt

Shai Almog

unread,
May 4, 2021, 10:23:50 PM5/4/21
to CodenameOne Discussions
This looks fine. Can you isolate a test case that reproduces the problem?
Message has been deleted

P5music

unread,
May 7, 2021, 11:08:27 AM5/7/21
to CodenameOne Discussions
I created two test cases that reproduce the issue.
You find the images and java files in attachment.
As you can see the screenshots from CN simulator show images with the right size
while the screenshots from iOS simulator show images with wrong size and wrong positioning of the drawing within the "viewport" of the button (the button has the right size).
One of the iOS screenshots show less images but it is from another build.
In general you can see that size can be wrong both bigger or smaller.
Regards
DuplicateIcon.java
Simulator Screen Shot - iPad (8th generation) - 2021-05-07 at 15.27.47.png
MyApp.java
SaveIconSoliciting.java
CodenameOne Screenshot 2.png
Simulator Screen Shot - iPad (8th generation) - 2021-05-07 at 09.29.41.png
MyApp2.java
CodenameOne Screenshot 3.png

Shai Almog

unread,
May 8, 2021, 12:16:18 AM5/8/21
to CodenameOne Discussions
Can you submit this as an issue? I'll assign it for evaluation.

P5music

unread,
May 9, 2021, 4:49:31 AM5/9/21
to CodenameOne Discussions
I submitted the issue:
Please notice that testing my app I see that the button size is almost but not completely right or stable, indeed if the image (from Flamingo tool classes) of a button changes (same size but slightly different drawing) the size also slightly changes and layout rearranges.
This happens also in the CN simulator. Maybe it is a separate issue.
Regards
Reply all
Reply to author
Forward
0 new messages