Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
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 2182 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:

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;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
GameLizard.com
Play Rimscape!    |    Play Conquer!
Pages: [1]
  ignore  |  Print  
 
 

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

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

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

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

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

nelsongames (981 views)
2018-04-24 18:14:32

ivj94 (1545 views)
2018-03-24 14:47:39

ivj94 (557 views)
2018-03-24 14:46:31

ivj94 (1327 views)
2018-03-24 14:43:53

Solater (560 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
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!