Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: RenderingHints ignored by affineTransform on: 2006-11-08 09:45:19
Hallo Chris

Thanks for your hints. There really doesn't seem to be a silver bullet around. (-: The results are very slightly better then the results from getScaledInstance. (We set all posssible rendering hints)




Thank you all for your help!



2  Java Game APIs & Engines / Java 2D / Re: RenderingHints ignored by affineTransform on: 2006-11-07 13:03:06
Hallo Chris

Here is our example: Java Version is:


C:\>java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

Windows XP SP 2



  public static void main(String[] args) throws FileNotFoundException, IOException {
    BufferedImage original = ImageIO.read(SimpleScaleDemo.class.getResource("/ch/weblica/core/image/img/empros.jpg"));
   
    BufferedImage scaledResultImage = createResizedCopy(original, original.getWidth()/5, original.getHeight()/5, true);
   
    ImageIO.write(scaledResultImage, "jpg", new File("out.jpg"));
  }
 
  private static BufferedImage createResizedCopy(Image originalImage, int scaledWidth, int scaledHeight, boolean preserveAlpha)  {
    int imageType = preserveAlpha ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
    BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight, imageType);
    Graphics2D g = scaledBI.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
   
    if (preserveAlpha) {
      g.setComposite(AlphaComposite.Src);
    }
    g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null);
    g.dispose();
    return scaledBI;
  }


These produces always bad loocking results. We are scalling the image down, original has a size of 2272 x 1704.
3  Java Game APIs & Engines / Java 2D / Re: RenderingHints ignored by affineTransform on: 2006-11-06 14:50:38
Thanks for the tip, that seems to work! Thanks

But question remains, why doesn't the java2d thinks work? How can I scale down an image with java2d??? (in a good quality!)

I tried the AffineTransformOP stuff too.
4  Java Game APIs & Engines / Java 2D / RenderingHints ignored by affineTransform on: 2006-11-06 13:13:40
Hi

In the following code snippet the rendered image looks as if no interpolation were applied. Any idea? I set the renderingHints but they seem to be ignored...


  public static void main(String[] args) throws IOException {
    BufferedImage source = ImageIO.read(SimpleScaleDemo.class.getResource("/ch/weblica/core/image/img/empros.jpg"));
   
    BufferedImage dest = new BufferedImage(source.getWidth()/5, source.getHeight()/5, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = dest.createGraphics();
    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    g2.scale(0.2f, 0.2f);
    g2.drawImage(source, 0, 0, null);
    g2.dispose();
    ImageIO.write(dest, "jpg", new File("test.jpg"));
  }
5  Java Game APIs & Engines / Java 2D / Re: OpenGL on Windows with a ATI Card on: 2006-03-05 22:14:12
sorry, I forgot: The JDK Version is: 1.5.0_04, and yes, it runs on full screen exclusive mode.

Yes, you're right: I can enable in my settings VSync and then I get a FPS of 60... Cool, thx!
6  Java Game APIs & Engines / Java 2D / OpenGL on Windows with a ATI Card on: 2006-03-05 18:15:09
I've played around with the OpenGL Pipeline on Windows with my ATI Card. (My Testmachine: Windows XP, ATI Radeon, 60 Hz LCD Monitor). If I enbale the default Pipeline (d3d on Windows isn't it?) I get a FPS of 60. (Since I use DoubleStrategy this is the FPS to expect isn't it?) If I enable the OpenGL Pipeline I get a FPS of 360. (In my Test I only paint to images - both opaque and loaded via the ImageIO so I think the Images are managed....)

 I do not understand why the OpenGL Pipeline is 6x times faster, can someone please explain me that?
7  Java Game APIs & Engines / Java 2D / Another Swing full Screen Problem on: 2005-08-01 11:47:32
Hi

I have a strange Problem with Swing and the full screen exclusive mode. I wrote a NullRepaintManager so i can paint all the Comps by hand. I do the following in my render lopp:


fFrame.getLayeredPane().paintComponents(graphics);


This works just fine, I have a Menu with two Buttons and a BoxLayout. If I click the play Button I can play the game. Now the Problem: If I show a Welcome Message before I paint the Menu, the Menu is not visible. The Welcome Message paint a String with a special Font for two Seconds and after that, the Menu should be there but it isn't. Have any one a idea?
8  Game Development / Newbie & Debugging Questions / Re: Loading images... on: 2005-04-17 12:03:05
Yes, it works finally. I found an article which says that the "Jar Classloader" won't take any -classpath command line Arguments.

Here the Article:

http://www-106.ibm.com/developerworks/java/library/j-onejar/
9  Game Development / Newbie & Debugging Questions / Re: Discerning Primitive Types on: 2005-04-14 12:57:51
I guess you have to use the wrapper types.
If you have a variable which you don't now the type it is from type Object...?


Just my 2 cents...
10  Game Development / Newbie & Debugging Questions / Re: Loading images... on: 2005-04-14 05:29:00
@tom

I tried that. I tried your version, I extracted the jar and tried, but it doesn't work.
11  Game Development / Newbie & Debugging Questions / Re: Loading images... on: 2005-04-13 17:38:12
Thx for the Hint Tom, i use the Classloader of my resource class

[code]
public static URL getFileURL(String aFile) {
 String file = "/"+ aFile;
   System.out.println(file);
   return Resource.class.getClassLoader().getResource(file);
//        return getURL("file:"+aFile);
     }
[code]

The uncomment Version was earlier - this worked. The classloader still does not... Here the List of the things that i tried:

- The Jar File is on the same Directory Level as the Image (Resources) Directories are. I put that Directory in the classpath:

D:\projects\temp>java -classpath D:\projects\temp -jar sajotris.jar

- i repleaced "/" with "\"
- i placed the resources in the same Directory where the classfiles are

Java always can't find the resource
"/fonts/Blox2.ttf"

I tried everything - except the right (-:
12  Game Development / Newbie & Debugging Questions / Re: Loading images... on: 2005-04-13 15:32:50
Hey, i have the same Problem (-:

I have opened the "Create a valid URL Object"-Thread

I havn't found the solution yet, so i can't really help you...
13  Game Development / Newbie & Debugging Questions / Re: Create a Valid Url Object on: 2005-04-13 06:03:37
I don't get it. Ok, let's make an example

you have a Project with the following structure:
  src
  images <--- resources

In your game you wright "/images/image.png"

Now we assume you have your Project in D:\projects\
so the classpath would be D:\projects\project\
If the jar is in that directory, with the that classpath, it should work... right?

Btw, sorry for my bad english ... and my stupidity (-:

greets
14  Game Development / Newbie & Debugging Questions / Re: Create a Valid Url Object on: 2005-04-10 14:20:18
Hmm,  is the directory a sub directory from a Package or is the directory in your classpath? On my machine it doesn't work and i can't see why. )-:
15  Game Development / Newbie & Debugging Questions / Re: Create a Valid Url Object on: 2005-04-10 06:25:23
The Method is static so you can not access getClass directly.


I think the Directory for the resource must be in the classpath. I tried that but it doesn't work.
16  Game Development / Newbie & Debugging Questions / Create a Valid Url Object on: 2005-04-09 22:02:49
Hi

I try to create a URL Object to load all my game resources.

The Method for this:

1  
2  
3  
public static URL getFileURL(String aFile) {
  return getURL("file:"+aFile);
}


This Method works just fine. But i thought it would be bette to create the URL Object via class Loader. So i rewrote it:

1  
2  
3  
public static URL getFileURL(String aFile) {
return new Resource().getClass().getClassLoader().getResource(file);
}


This Method doesn't work... Can someone tell me why?

Thanks & good night

greets from Switzerland
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (14 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

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

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

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

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

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

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

CopyableCougar4 (102 views)
2014-11-29 21:32:03
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!