• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

BufferedImage TYPE_CUSTOM to TYPE_INT_ARGB

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,

I'm trying to load a PNG image in that has transparency in it using JDK 1.6 u10 and manipulate the image data (pixels). The problem is if I do this:



Or this:



Or this:



The type is always TYPE_CUSTOM and not TYPE_INT_ARGB - which seems odd because the PNG file that I am loading has transparency in it.

What I want is the BufferedImage (which has the PNG image data I'm interested in) so that I can play with the image data (e.g. perform a projective transformation) :




Any advice would be greatly appreciated!
 
Arron Ferguson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the funny thing ...

I tried this:


And it drew a black pixel ... which means that it is in fact TYPE_INT_ARGB not TYPE_CUSTOM. Funny those Sun engineers wouldn't call it what it is but treat it as it is.

 
Arron Ferguson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay this is the last post from me in this thread - I just figured I would share so as to help anyone else from making the same mistake. The PNG with transparency is correctly set to TYPE_INT_ARGB (i.e. with alpha). What I did wrong (and it was my fault), was that I made the following instance method call in the class GraphicsConfiguration:

gc.createCompatibleImage(w, h, Transparency.BITMASK);

This resulted in being considered a "TYPE_CUSTOM " BufferedImage. As soon as I said:

gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);

The BufferedImage.getType returned TYPE_INT_ARGB (== 2)

Sorry for all the posts.
 
eat bricks! HA! And here's another one! And a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic