Skip to content Skip to sidebar Skip to footer

Finding Android Equivalent Code For Graphics2d

I have been trying to get an Android equivalent code for the following: private BufferedImage user_space(BufferedImage image) { BufferedImage new_img = new BufferedImage(image

Solution 1:

android does not have BufferedImage or Graphics2D as you probably already found out.

I'm not a java developer (just android) so I'm not 100% sure on what you're trying to achieve, but it seems to me that you're simply creating a copy of the image.

here a few classes that you'll be using for those type of manipulation:

  • Bitmap: that's like the BufferedImage, it's the object that actually stores all the bytes from the image (possibly large object with potential for memory crash). There're some static methods here for copy bitmaps, create new mutable or immutable bitmaps, scale, or compress as PNG or JPG to a stream.

  • BitmapFactory: lots of static methods to create new bitmaps from resources, files, streams, etc.

  • Canvas: You'll actually only use this one if you want to draw on the image (overlay image, put some text, or a line, stuff like that)

Post a Comment for "Finding Android Equivalent Code For Graphics2d"