After last iOS port update the image
processing is clipped to screen size.
I don't know why there is ng.applyClip() in IOSImplementation.drawImage
If my screen width is 640 and I draw on image 1880 width drawing appeared only
on left 640 points :(
For now my workaround is to comment line UIRectClip(CGRectMake(x, y, width,
height)) in function CodenameOne_GLViewController .Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingMutableImpl
To find out this bug it takes me a few days because working on iOS port is not
easy. Huge part of port is written in Java and after crosscompiling it is “hashed”.
Why you need java api level on native port? It make port not only hart to debug
but most of all working slower.
For example to make the clip from core java code iOS port need 9 function level
– only one in object C. I think that is the main cause that futures like
animation is not working as fast as it should.
public NativeGraphics getGraphics() {
if(child == null) {
child = new NativeGraphics();
child.associatedImage = this;
}
return child;
}
package eu.forann.issuetester;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Graphics;
import com.codename1.ui.Image;
import com.codename1.ui.Label;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
public class IssueTester {
private Form current;
private Resources theme;
public void init(Object context) {
theme = UIManager.initFirstTheme("/theme");
// Pro only feature, uncomment if you have a pro subscription
// Log.bindCrashProtection(true);
}
public static void callSeriallyAndWaitisEDT(Runnable aRun) {
if (Display.getInstance().isEdt()) {
aRun.run();
} else {
Display.getInstance().callSeriallyAndWait(aRun);
}
}
public static Image scaleImageRGB(Image aImage, final int newWidth, final int newHight) {
Image ii = Image.createImage(newWidth, newHight, 0);
final Graphics g = ii.getGraphics();
callSeriallyAndWaitisEDT(new Runnable() {
public void run() {
g.drawImage(aImage, 0, 0, newWidth, newHight);
}
});
return ii;
}
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Clip on iOS issue", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
Image image=theme.getImage("duke-no-logos.png");
Image bigImage=scaleImageRGB(image, image.getWidth()*10 , image.getHeight()*10);
Image littleImage=scaleImageRGB(bigImage, image.getWidth(), image.getHeight());
hi.addComponent(BorderLayout.CENTER,
LayeredLayout.encloseIn(
BoxLayout.encloseY(
new Label(image),
new Label(littleImage)
// ,new Label(bigImage)
)
)
);
hi.show();
}
public void stop() {
current = Display.getInstance().getCurrent();
}
public void destroy() {
}
}
--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/e4a88114-0479-45eb-b2a6-c00764e37784%40googlegroups.com.