Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  scale image  (Read 2796 times)
0 Members and 1 Guest are viewing this topic.
Offline aNt

Senior Devvie


« Posted 2006-11-27 09:46:44 »

anyone know how to scale and image (up or down) under midp2?
Offline Abuse

JGO Ninja

Medals: 57

falling into the abyss of reality

« Reply #1 - Posted 2006-11-27 14:13:13 »

There are 2 solutions :-

Solution 1

1) create the source image. (Image.createImage(...).
1) use Image.getRGB(...) to get the pixels from the source image.
2) scale the RGB pixel array using what-ever scaling algorithm you wish (this is not a J2ME problem)
3) pass the scaled pixels into Image.createRGBImage(...)

Be warned, a significant number of handsets have faulty implementations of Image.getRGB(...), and there are likely some with faulty Image.createRGBImage(...) implementations too.
However, this is the simpler of the 2 solutions.

Solution 2

1) Grab the pixel data directly from the raw png data.
2) Scale the pixel data using what-ever scaling algorithm you wish (this is not a J2ME problem)
3) regenerate the necessary png wrapper structure.
3) create the image.

This solution will work on both MIDP1 & 2.
You will need to ensure your source png images store their IDAT chunk uncompressed. (unless you want to write a zlib decompressor too!)
Also, depending on the scaling algorithm you choose for part 2, you may want to impose some restrictions on the color type & bitdepth used in the source image)
You will need to examine the following specifications :-

a) PNG file format specification ( )
b) RFC 1950 - ZLIB specification ( )
c) RFC 1951 - Deflate specification ( )
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Archive (172 views)
2017-02-27 19:41:49

numerical (515 views)
2017-02-21 07:32:16

numerical (517 views)
2017-02-21 07:31:46

theagentd (630 views)
2017-02-18 13:42:33

theagentd (624 views)
2017-02-18 13:35:16

h.pernpeintner (1797 views)
2017-01-24 22:39:11

h.pernpeintner (1738 views)
2017-01-24 22:38:32

Galdo (2304 views)
2017-01-12 13:44:09

Archive (2193 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2725 views)
2016-12-16 03:58:39
SF/X Libraries
by philfrei
2017-03-01 20:21:46

SF/X Libraries
by philfrei
2017-03-01 20:21:24

SF/X Libraries
by philfrei
2017-03-01 20:17:31

SF/X Libraries
by philfrei
2017-03-01 20:16:43

SF/X Libraries
by philfrei
2017-03-01 20:15:36

SF/X Libraries
by philfrei
2017-03-01 20:14:20

SF/X Libraries
by philfrei
2017-03-01 20:12:46

List of Learning Resources
by elect
2016-09-09 09:47:55 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!