Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (762)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (847)
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  
  transform image  (Read 2315 times)
0 Members and 1 Guest are viewing this topic.
Offline Valodim

Junior Devvie




*sigh*


« Posted 2005-02-23 18:24:03 »

hey there Smiley

self-explaining, I guess Tongue

AffineTransform[[2.0, 0.0, 382.0], [0.0, 2.0, 195.0]]

1  
2  
3  
4  
5  
6  
7  
8  
Exception in thread "Thread-2" java.awt.image.ImagingOpException: Unable to transform src image
      at java.awt.image.AffineTransformOp.filter(Unknown Source)
      at sun.java2d.pipe.DrawImage.renderImageXform(Unknown Source)
      at sun.java2d.pipe.DrawImage.transformImage(Unknown Source)
      at sun.java2d.pipe.DrawImage.transformImage(Unknown Source)
      at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
      at core.Display$subdisplay.draw(Display.java:199)
      at core.Display.draw(Display.java:78)


AffineTransform[[1.0, 0.0, 382.0], [0.0, 1.0, 195.0]] works fine, though...

any ideas? as soon as m00, m10, m01, or m11 are non-default, I get this error Sad
Offline Valodim

Junior Devvie




*sigh*


« Reply #1 - Posted 2005-03-31 00:04:55 »

viewed 55 times and no idea? It still refuses to do anything else than translating coordinates, whenever I try to get it to shear or rotate any image it gives that very same error. I don't need this now, but sooner or later I'm bound to need it, and I've really ran out of ideas what could be causing this Sad
Offline trembovetski

Senior Devvie




If only I knew what I'm talking about!


« Reply #2 - Posted 2005-03-31 01:49:25 »

Platform, jdk version, source/destination image types?

It could be one of the manifestations of
 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723021

Thanks,
Dmitri
Java2D Team
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Valodim

Junior Devvie




*sigh*


« Reply #3 - Posted 2005-03-31 10:28:57 »

oh, right, I should have given more info... Tongue

win2ksp4, jre1.5.0 (which is not reported to have that bug), source image is built like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
palette = new IndexColorModel(8, 256, palR, palG, palB, 0);

imageData = new byte[imageBytes];

model = new MultiPixelPackedSampleModel(DataBufferInt.TYPE_BYTE, this.pcxwidth, this.pcxheight, 8);
buffer = new DataBufferByte(imageData, imageBytes);
raster = WritableRaster.createWritableRaster(model, buffer, zeropoint);

new BufferedImage(palette, raster, false, null);


the transform can be any with non-null shear or scale values:

1  
2  
3  
4  
5  
AffineTransform gt = new AffineTransform();
gt.translate (0, bi.getHeight());
gt.scale (1, -1d);
g.transform (gt);
g.drawImage (image, null, null);


the flipping destination image is the code from the jumping into jogl tutorial (I think that's what it was called), to get a drawPixels() compatible raster

1  
2  
3  
4  
5  
6  
raster = Raster.createInterleavedRaster (DataBuffer.TYPE_BYTE, bi.getWidth(), bi.getHeight(), 4, null);

colorModel= new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8,8,8,8}, true, false, ComponentColorModel.TRANSLUCENT, DataBuffer.TYPE_BYTE);

new BufferedImage (colorModel,
raster, false, null);


heh, seems to be more or less the same as in the bug report... *tries the workaround*

\\ edit

forgot to mention, it's the same problem if srcImg == dstImg

1  
2  
3  
4  
5  
6  
7  
Graphics2D g = bi.createGraphics();

AffineTransform gt = new AffineTransform();
gt.translate (0, bi.getHeight());
gt.scale (1, -1d);
g.transform (gt);
g.drawImage(bi, null, null);

or
1  
g.drawImage(bi, gt, null);
Offline Malohkan

Senior Devvie




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


« Reply #4 - Posted 2005-03-31 12:55:38 »

ummm... what the heck?  You're drawing the image onto itself.

Graphics2D g = bi.createGraphics();
g.drawImage(bi, gt, null);

Is that even possible?

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline Valodim

Junior Devvie




*sigh*


« Reply #5 - Posted 2005-03-31 19:31:15 »

don't know, but guess yes, the transforming needs to be done with a copy of the raster anyways, so why not?

but that doesn't really matter, as the error message is the same if I draw it to another image >_>
Pages: [1]
  ignore  |  Print  
 
 

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

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

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

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

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

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

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

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

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

Solater (443 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!