LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-02-2004, 05:37 AM   #1
rolf_mueller
LQ Newbie
 
Registered: Oct 2004
Location: Bundoora, Australia
Distribution: Fedora Core 2 on Dell PE700
Posts: 12

Rep: Reputation: 0
Java: Text into Image: works on windows, fails on Linux...


Usually I don't do this, but I do not seem to get any attention on sun's Java Forum...

I have a piece of code, which uses the java awt library to insert
some text into an image. This piece of code runs perfectly fine
on a windows machine, but on a Linux box with Fedora Core 2,
a BufferedImage.getRGB() method call fails with the following
exception:

Code:
java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
        at sun.awt.image.IntegerInterleavedRaster.getDataElements(IntegerInterleavedRaster.java:202)
        at java.awt.image.BufferedImage.getRGB(BufferedImage.java:862)
        at ThumbnailGenerationTestX.doThumbnailGenerationTest(ThumbnailGenerationTestX.java:94)
        at ThumbnailGenerationTestX.main(ThumbnailGenerationTestX.java:29)
Here is the link to the thread at the sun forum:
http://forum.java.sun.com/thread.jsp...rt=0&trange=15
(You will find the code there....)

Does anyone have an idea?
Would hate to switch back to Windows just because
a small piece of code does not work...

PS: X-Server is running, DISPLAY variable is set, and I did xhost +...

Thanks, Rolf
 
Old 11-02-2004, 08:03 AM   #2
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
Just an idea, can you compare output of
java -version
on your linux and windows installations? Are you trying with the same versions of JRE?
 
Old 11-02-2004, 08:19 AM   #3
rolf_mueller
LQ Newbie
 
Registered: Oct 2004
Location: Bundoora, Australia
Distribution: Fedora Core 2 on Dell PE700
Posts: 12

Original Poster
Rep: Reputation: 0
Here is the Windows output:


sizeW = 1024
sizeH = 768

myText = (c) by Rolf Mueller
fontName = serif
fontSize = 32

textWidth = 260
textHeight = 28
textAscent = 32
textDescent = 7

offset = 7
textXPos = 757
textYPos = 733

Finished successfully!


and here is the Linux output:


sizeW = 1024
sizeH = 768

myText = (c) by Rolf Mueller
fontName = serif
fontSize = 32

textWidth = 293
textHeight = 31
textAscent = 30
textDescent = 6

offset = 7
textXPos = 724
textYPos = 730

java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.IntegerInterleavedRaster.getDataElements(IntegerInterleavedRaster.java:202)
at java.awt.image.BufferedImage.getRGB(BufferedImage.java:862)
at ThumbnailGenerationTestX.doThumbnailGenerationTest(ThumbnailGenerationTestX.java:94)
at ThumbnailGenerationTestX.main(ThumbnailGenerationTestX.java:29)


As you can see, the textWidth and textHeight are different
(260 <-> 293, 28 <-> 31 etc...), but this is something I would excpect,
since the X-environment is different and has different fonts and rendering.

Java-Version is slightly different:
Windows: 1.4.2_03
Linux: 1.4.2_05
I am using the SDK on both machines, because of Tomcat...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
converting Windows text to Linux text joshknape Linux - Software 3 09-11-2005 12:52 PM
Can't enter text in certain Java text fields TheBelush Linux - Software 4 04-27-2005 05:29 PM
Web start java not working (java works fine) powadha Debian 5 06-05-2004 12:57 PM
create windows image from within linux BalaclavaBoB Linux - Software 5 09-08-2003 06:20 PM
linux fails where windows works boots147 Linux - Software 15 01-31-2002 07:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration