Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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  
  Image editing issues  (Read 1203 times)
0 Members and 1 Guest are viewing this topic.
Offline K.I.L.E.R

Senior Devvie




Java games rock!


« Posted 2005-12-12 20:41:09 »

This is supposed to create a large image out of a smaller one.
It does this by:
Creating a temporary power of 2 image.
It grabs the pixels of the original image and pastes it into the PO2 temporary image.
Should work but it doesn't. Anyone know why?


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
private BufferedImage convertToPO2(BufferedImage img) {
      BufferedImage tmpImg = null;
      tmpImg = new BufferedImage(img.getWidth() * 2, img.getHeight() * 2, BufferedImage.TYPE_INT_ARGB);
     
      double[] rPix = new double[img.getWidth() * img.getHeight() * 4];
     
      for (int i = 0; i < 4; i++) {
         rPix = img.getData().getSamples(0, 0, img.getWidth(), img.getHeight(), i, rPix);  
         tmpImg.getRaster().setSamples(0, 0, img.getWidth(), img.getHeight(), i, rPix);
      }
   
     
      return tmpImg;
   }

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline tom
« Reply #1 - Posted 2005-12-12 21:35:15 »

It would be easier to just draw img on tmpImg:
tmpImg.getGraphics().drawImage(img, ...);

Offline Ask_Hjorth_Larsen

Junior Devvie




Java games rock!


« Reply #2 - Posted 2005-12-13 12:45:51 »

1) I agree with tom

2) Always specify *how* something doesn't work, otherwise no one has a clue what's going on.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ryanm

Senior Devvie


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #3 - Posted 2005-12-13 15:34:56 »

Also, the output image will only be of power-of-two size if the input image is also power-of-two.
Maybe this is as intended, but in that case the method name could be said to be misleading...
Offline K.I.L.E.R

Senior Devvie




Java games rock!


« Reply #4 - Posted 2005-12-14 05:05:13 »

The problem is that I cannot get an output image.
In other words the PO2 image isn't displayed as in it's as though I have an empty image.

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline K.I.L.E.R

Senior Devvie




Java games rock!


« Reply #5 - Posted 2005-12-14 14:07:21 »

Just fixed the problem.
I was looking in the wrong place.

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (37 views)
2014-12-15 09:26:44

Mr.CodeIt (30 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (98 views)
2014-12-08 04:46:31

JscottyBieshaar (59 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (77 views)
2014-11-29 21:32:03

toopeicgaming1999 (138 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (38 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org 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‑gaming.org
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!