Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (602)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (650)
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] 2
1  Java Game APIs & Engines / Java 2D / Re: JPEG Patent on: 2004-11-16 18:45:15
I know that it's an old news but it has not been settled yet. Here is a more recent article.

The article says that Sun is also being involved with the law suit.

2  Java Game APIs & Engines / Java 2D / JPEG Patent on: 2004-11-16 17:13:29
Is JPEG format NOT  free ?  As Java developers, will we be impacted if we developed software, games  using JPEG ?

See the link below :,1367,53981,00.html

First it was gif, now it comes JPG.  The software patents are really suck
3  Java Game APIs & Engines / Java 2D / Re: Save Image data on: 2004-11-02 13:00:50
Thanks for the response.  I’m not looking for saving image data as any kind of image format as described in imageIO. I just need  to save a buffered image data using simple IO and  restore back if needed.  By doing this way, I can get much better IO performance when I create multiple levels of undo image on disk.

Basically, I can undo an image changes by using the following sequence :

//copy image original data into int[] data

BufferedImage.getRGB(0, 0, w,h, data, 0, w);      

//Make some changes to bufferedImage

//undo the changes by restoring back data
BufferedImage.setRGB(0, 0, w,h, data, 0, w);

This works fine except that I have to use a lot of memory to store  multiple undo data for creating  multiple undo. In order to avoid that, I want to save data array not the entire image on disk.  I tried with BufferedInputStream to read back the saved data as int type but it appears that the data was changed when it was saved using BufferedOutputStream.

Does anyone know a better way to create multiple undo for a large image without consuming too much memory while maintaining relatively good performance ?

4  Java Game APIs & Engines / Java 2D / Save Image data on: 2004-11-01 17:48:59
I want to save an image data into a file via FileOutputStream and restore back as needed through FileInputStream, such as :

     Save :

     int[] data;
     BufferedImage.getRGB(0, 0, w,h, data, 0, w);

     Save data via FileOutputStream


     Get  data back via FileInputStream
     BufferedImage.setRGB(0, 0, w,h, data, 0, w);

The problem is both FileInputStream and FileOutputStream require byte[] not int[].  How can I convert int[] to bye[] and visa efficiently  or Java has something allow you to save buffered image data into a file and restore back as needed ?

5  Java Game APIs & Engines / Java 2D / Re: animated selection border on: 2004-10-14 17:27:40
Yes, I'm using swing.

6  Java Game APIs & Engines / Java 2D / animated selection border on: 2004-10-14 12:03:36
Does anyone know how to create an animated selection highlight ?  I do not know what it is called it but it’s very common in window applications.  The one with short black and white lines chase each other along the border of a selection. One example can be seen when a cell in Microsoft Excel is marked for copy.

7  Java Game APIs & Engines / Java 2D / Release of Tiger on: 2004-09-30 11:56:50
Just downloaded a copy of Tiger. Not very impressive. Still require large footprint when loading images. But it appears to be that applications startup is  much faster.

The ‘setTooltipText’ nolonger works under 1.5, which works fine under 1.4. In order to show the tool tip text under 1.5, the panel where the component reside has to get focused. I reported this prior to the release, but apparently they did not address this issue.

8  Java Game APIs & Engines / Java 2D / Re: standard indexed color table on: 2004-08-14 16:47:23
The optimal palette.  Where can I find more information about it ?  I tried different color reducing algorithms such as octree along with dithering process.
But I found that using bufferedimage is the pretty easy, efficient and produces good results.  
9  Java Game APIs & Engines / Java 2D / standard indexed color table on: 2004-08-13 17:26:13
The following color table can be used to convert a RGB image to an IndexColorModel image with 16 colors.  Does anyone know  how to create the color tables of 32, 64, 128 ,256 colors  for IndexcolorModel image. ?

int[] cmap = { 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, //8 primary colors
                      0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff, // ...
                  0xff1c1c1c, 0xff383838, 0xff555555, 0xff717171, //8 shades of gray
                  0xff8e8e8e, 0xffaaaaaa, 0xffc7c7c7, 0xffe3e3e3      };

10  Java Game APIs & Engines / Java 2D / Re: deal with large buffered image on: 2004-05-13 15:08:35
The original image size varies with the largest one about 1.2M.  This is what I tried to implement in my code :

Image origImage=new ImageIcon(imageName).getImage();

BufferedImaeg drawCanvas = gc.createCompatibleImage(imgW, imgH,Transparency.TRANSLUCENT);


BufferedImage backupCanvas = gc.createCompatibleImage(imgW, imgH,Transparency.TRANSLUCENT);


backup_g2.drawImage(drawCanvas, 0,0, this); // create undo

//perform drawing tasks ..

//undo the changes

draw_g2.drawImage(backupCanvas, 0,0,this);

This works fine except it uses too much memory when the original image is large.  I’m trying to figure out a way to reduce the memory usage by not to create a buffered image for storing the image backup.  Creating an undo stack may be an option but I do not know if the undo stack would work if the changes are the actual pixels changes of the original image.

Yes you are correct. I do not have issue if I increase the heap space but I want to see if there better solution in the code itself.

11  Java Game APIs & Engines / Java 2D / deal with large buffered image on: 2004-05-13 13:58:44
What is the effect way to create an image undo? I have a large buffered image, which I need to manipulate but also want to be able to undo the changes.  I create another buffered image to save the original image prior to the changes. But I constantly get out off memory error.  Maybe I can save some memory by creating the undo image as a non-buffered image.

What is the difference between an image and buffered images in terms of sizes?   How can I create a new non-buffered image from a buffered image?

I use to follow method to try to create a new image from a buffered image. But what I get is the same image object being converted from buffered to non-buffered :


I need to create a new non-buffered image from a buffered image.


12  Java Game APIs & Engines / Java 2D / Re: copy a part of component image on: 2004-05-10 18:35:23
Yes, you are the best. Thanks.
13  Java Game APIs & Engines / Java 2D / Re: copy a part of component image on: 2004-05-10 16:35:58
Thanks for  the response. But how do you pass an affinetransform to paint ?  I must have done something wrong :

public static BufferedImage partOfImage(JComponent comp, int x, int y, int w, int w)
     BufferedImage bimage;
     AffineTransform atX=new AffineTransform();                  
     Graphics2D g=(Graphics2D) comp.getGraphics();
     return bimage;

This does not give what I need. I probably need to pass atX to paint not via g.setTransform(atX).


14  Java Game APIs & Engines / Java 2D / copy a part of component image on: 2004-05-10 13:39:49
Is there any way to get  part of  a component  image ?    This is the way to copy entire component image to a buffered image :


If I do this, I have to create a large buffered image and then cut off the part of image that I need.  I  wonder if it is possible to only copy the part of a component image to small buffered image ?

15  Java Game APIs & Engines / Java 2D / coordinate transformation on: 2004-05-05 12:17:16
What is the correct method to calculate each pixel’s coordinate translation after an image is zoomed around center ?   I’m using the following steps to zoom an image around it’s center :

AffineTransform atT=new AffineTransform();

int dx=img.getWidth()/2;
int dy=img.getHeight()/2;

atT.preConcatenate(AffineTransform.getTranslateInstance(-dx, -dy));

atT.preConcatenate(AffineTransform.getScaleInstance(scale, scale));

atT.preConcatenate(AffineTransform.getTranslateInstance(dx, dy));

g.drawImage(img,atT, this);

How can find out each pixel’s coordinate translation after zooming ?


16  Java Game APIs & Engines / Java 2D / keep application on top on: 2004-04-09 11:36:30
Does anyone know how to keep a Java application always on top in a window desktop environment?  And also how to add the application icon to the window toolbars at bottom of the screen?


17  Discussions / Miscellaneous Topics / Java License on: 2003-12-22 13:44:58
Does anyone know where I can find a list of Java technologies, which are free for commercial usage?   From Sun  web site, it looks like that J2SE,  J2EE and J2ME are free.

I'm thinking about using JAI (Java Advanced Image) in my application, but do not know if JAI APIs are free. If they are not, how can I acquire the license from Sun ?

18  Discussions / Miscellaneous Topics / Re: traversing all pixels in an area on: 2003-11-10 16:49:27
Tom, can you post a working version of this ? This is very interesting .


19  Java Game APIs & Engines / Java 2D / Re: get the polygon around a point on: 2003-11-07 14:51:53
Thanks Tom for leading me to flood fill. I think that I understand basically how flood fill works.

But how can I detect a border color?   For instance, if a polygon has 12 line segments and each line segment has a different color. In order to  fill this polygon with a color using flood fill ,  I have to detect all 12 colors and keep track each pixel as the color filling moves toward the polygon border.

20  Java Game APIs & Engines / Java 2D / Re: get the polygon around a point on: 2003-11-06 15:28:09
Thanks tom. That's what I need. I'll go around the thread;ac tion=display;num=1066999281

21  Java Game APIs & Engines / Java 2D / Re: get the polygon around a point on: 2003-11-06 11:47:11
Tom,  basically, I need to implement the same function as "fill with color tool" of MS paint. Draw any polygons on a canvas and then selectively fill them with colors after all the polygons are drawn on the canvas.

Try to find a better way to do it without keeping track of all the polygons drawn and their intersections.

22  Java Game APIs & Engines / Java 2D / Re: get the polygon around a point on: 2003-11-05 18:14:21
What if I just need to fill colors for a map, pretty much like coloring book.  Is there any better way to do it other than try to detect polygons within the map ?


23  Java Game APIs & Engines / Java 2D / Re: get the polygon around a point on: 2003-11-03 15:20:10
That's what I thought. I was just trying to avoid to keep track all the polygons drawn on the screen and the intersections among all the polygons.

24  Java Game APIs & Engines / Java 2D / Re: get the polygon around a point on: 2003-11-03 14:44:45
I want to be able to detect a ploygon surround a point if there is any.  For example, if I do a mouse click, I would like to get back a  ploygon surround that point if there is one or null if there is none.

25  Java Game APIs & Engines / Java 2D / get the polygon around a point on: 2003-11-03 14:02:19
I wonder if anyone knows how to retrive a 2D polygon around a point ?  Something  like :

public Polygon getPolygon(Point2D pt){}


26  Java Game APIs & Engines / Java 2D / JMF and flash on: 2003-10-07 16:02:19
Does anyone know how to play flash .swf file in a Java
application ?   What is status of JMF ? Is Sun going to continue with JMF ?
27  Java Game APIs & Engines / Java 2D / Re: bright only non-transparent pixels on: 2003-09-26 11:07:28
The problem was caused by the way that the color indexed images were converted to RGB images .  If I use BufferedImage.TYPE_INT_ARGB instead of BufferedImage.TYPE_INT_RGB , the transparent pixels work fine with ConvolveOp operation.  But with Rescale, I got nothing drawn on the screen if the buffered image was created using BufferedImage.TYPE_INT_ARGB .

public static BufferedImage rgbImage(Image image)
     BufferedImage bimage=new BufferedImage(image.getWidth(null),image.getHeight(null),BufferedImage.TYPE_INT_ARGB);

     Graphics2D g=bimage.createGraphics();
     return bimage;

public static BufferedImage brightImage(BufferedImage bI, float scaleFactor)
     BufferedImage bi;

BufferedImageOp op=new RescaleOp(scaleFactor,0,null);

28  Java Game APIs & Engines / Java 2D / Re: bright only non-transparent pixels on: 2003-09-19 12:34:38
Thanks for the response.  The reason that I only want to bright the non-transparent pixels  is that  all the transparent color shows up as black when I apply the RescaleOp to a gif image which has transparent background .  It appears that RescaleOp alters alpha channels as well.  

When I followed your suggestion by creating a new RescalOp as

new RescaleOp(new float[]{scaleFactor,scaleFactor,scaleFactor,0},new float[]{1,1,1,0},null);

I received the following error:

java.lang.IllegalArgumentException: Number of scaling constants does not equal the number of color or color/alpha  components
     at java.awt.image.RescaleOp.filter(
29  Java Game APIs & Engines / Java 2D / bright only non-transparent pixels on: 2003-09-18 16:28:05
Does anyone know how to make only the non-transparent part of an image bright or dark ?   I tried the following code but it appears that rescalOp  applies to every pixel of an image ,  non-transparent as well as transparent:

public static BufferedImage brightImage(BufferedImage bufferedImage)
     BufferedImage bi;

         float scaleFactor = 1.2f;
         RescaleOp op = new RescaleOp(scaleFactor, 1, null);
         bi = op.filter(bufferedImage, null);

30  Java Game APIs & Engines / Java 2D / Re: stack buttons on: 2003-07-28 15:19:41
Thanks guys. Yes, it works by creating a JPanel with null option and then placing the buttons wihtin the jpanel. But I have one little issue. I could not make one button always remaining behind the other one, even I set the button behind to none focusable. When I cliked the button behind, it shows up in front :

import java.awt.*;
import java.awt.event.*;
import javax.swing.JPanel;
import javax.swing.JButton;

public class ButtonStack
   public static void main (String args[])
     final JButton jb1,jb2;

     Frame frame = new Frame("Example of  Overlap Buttons");
     frame.setBounds (100, 100, 300, 300);

     jb1=new JButton();

     jb2=new JButton();
     JPanel jPanel=new JPanel(null);
           (new WindowAdapter()
                   public void windowClosing (WindowEvent e)
                       System.exit (0);

By the way, there is an exmaple about using TableLayout to create overlap buttons:
Pages: [1] 2
Jesse (16 views)
2015-07-29 04:35:27

Riven (37 views)
2015-07-27 16:38:00

Riven (19 views)
2015-07-27 15:35:20

Riven (22 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (30 views)
2015-07-25 00:14:37

BurntPizza (42 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53

NoxInc (20 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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!