Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (856)
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  
  Color Keying and Bitmap Fonts  (Read 2265 times)
0 Members and 1 Guest are viewing this topic.
Offline Ceranith

Senior Newbie

« Posted 2005-01-12 00:25:23 »

I can create bitmap fonts just fine, but I'd like to have bitmap fonts of different colors. In my image file the characters are white, and I want to replace the white color with any color of my choice. The problem is that I don't even know if there's a way to do this while maintaining hardware acceleration. I searched some older posts but I found no hardware accelerated versions. Is there a way to do it?

Also, just a side question. In order for images to be accelerated, they must not exceed 65536 bytes. Is there any advantage to making images squares? An image that's 128x128 vs. 256x64... should I expect any difference in performance? Thanks a lot Smiley
Offline jbanes

JGO Coder

Projects: 1

"Java Games? Incredible! Mr. Incredible, that is!"

« Reply #1 - Posted 2005-01-12 00:47:38 »

Well, this thread might be interesting:;action=display;num=1091616545;start=5#5

With 1.4+, however, you may look into using a palletized BufferedImage. It won't be hardware accelerated (unless you copy it into another image after changing the pallette), but it should be more than fast enough for most uses.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Ceranith

Senior Newbie

« Reply #2 - Posted 2005-01-12 21:48:12 »

Ok, I'll look into a that... copying it into another image doesn't sound so bad as I'm not going to be loading fonts that much.

Thanks Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ceranith

Senior Newbie

« Reply #3 - Posted 2005-01-13 19:31:27 »

Hmm, I just had a thought. Could I just call bufferedImage.getGraphics() and replace all the white pixels with another color by using drawLine(x, y, x, y)? Would this be an acceptable solution? Or at least be more efficient than copying the entire BufferedImage into another one?

Obviously I couldn't use this technique for replacing pixels so that they're transparent, but I don't even need that.

Don't tell me if I call getRGB(x, y) my image won't be accelerated anymore Tongue
Offline Malohkan

Senior Devvie

while (true) System.out.println("WOO!!!!");

« Reply #4 - Posted 2005-01-14 10:02:52 »

sure you can set the pixels to be transparent, I think... dunno how though Wink  Maybe I'm wrong.  Using the getRGB()/setRGB() methods will not make you lose your acceleration.  Calling .getDataRaster() will.

Admin and Game Developer at
Play Rimscape!    |    Play Conquer!
Pages: [1]
  ignore  |  Print  

hadezbladez (728 views)
2018-11-16 13:46:03

hadezbladez (363 views)
2018-11-16 13:41:33

hadezbladez (715 views)
2018-11-16 13:35:35

hadezbladez (180 views)
2018-11-16 13:32:03

EgonOlsen (2376 views)
2018-06-10 19:43:48

EgonOlsen (2528 views)
2018-06-10 19:43:44

EgonOlsen (1466 views)
2018-06-10 19:43:20

DesertCoockie (2132 views)
2018-05-13 18:23:11

nelsongames (1928 views)
2018-04-24 18:15:36

nelsongames (2609 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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!