iOS Question return bitmap from sknode?

ilan

Expert
Licensed User
Longtime User
hi

i want to return a bitmap (UIimage) from an sknode with all his childrens.

i found this:

B4X:
CGRect bounds = self.scene.view.bounds;
UIGraphicsBeginImageContextWithOptions(bounds.size, NO, [UIScreen mainScreen].scale);
[self drawViewHierarchyInRect:bounds afterScreenUpdates:YES];
UIImage* screenshotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

https://stackoverflow.com/questions/20625378/how-to-render-a-sknode-to-uiimage

how could i use this in b4i?

thank you
 

ilan

Expert
Licensed User
Longtime User
SpriteKit has no built-in method for this.

actually, there is a function (as far as i understand it)

B4X:
Dim bmp As Bitmap = GameScene.View.TextureFromNode(sknode).Image

the problem is that i am getting an error:

 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Hi,

this method will only return a value if you have set a texture before to the node. However, it will not return a rendered image with all the node's children.

Jan

ohhh ok i misunderstood it then (was too good to be true )
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…