• java exporting traslucent image to clipboard bug
    7 replies, posted
  • Hi! So, while working on I/O of my formulaes rendered in Java Latex API I encountered a rather annoying problem: [url]http://stackoverflow.com/questions/9050480/bug-4720930-walkaround-system-clipboard-and-alpha-image-support[/url] [IMG]http://shrani.si/f/1k/13Z/2yqZr6I0/untitled.png[/IMG] I tried searching for solution but so far no luck :( Has anyone any ideas what I could do to make this work? Thank you! [CODE] TeXFormula fomule = new TeXFormula(math); TeXIcon ti = fomule.createTeXIcon( TeXConstants.STYLE_DISPLAY, sizeSlider.getValue()); BufferedImage b = new BufferedImage(ti.getIconWidth(), ti.getIconHeight(), BufferedImage.TYPE_4BYTE_ABGR); ti.paintIcon(new JLabel(), b.getGraphics(), 0, 0); ... TransferableImage transferableImage = new TransferableImage(b); clipboard.setContents(transferableImage, this); [/CODE] PS: Exporting this image to png works flawlessly.
  • [QUOTE=dajoh;36343840]Last time I checked Paint didn't support transparency.[/QUOTE] Doesnt work in Photoshop either :(
  • [QUOTE=Jinx786;36343855]Doesnt work in Photoshop either :([/QUOTE] I'm pretty sure the clipboard generally doesn't support transparent bitmaps.
  • [QUOTE=Overv;36343876]I'm pretty sure the clipboard generally doesn't support transparent bitmaps.[/QUOTE] Oh damn, I thought that clipboard is just "a place" where anything can be put. Thanks! I can still preserve half-functional export by using white background. Any ideas how I would get rid of translucency and replace it with white? Thanks!
  • [QUOTE=Jinx786;36344439]Oh damn, I thought that clipboard is just "a place" where anything can be put. Thanks! I can still preserve half-functional export by using white background. Any ideas how I would get rid of translucency and replace it with white? Thanks![/QUOTE] I'm pretty sure it is "a place" where anything can be put. You should really be able to put a transparent bitmap in it. You just have to be careful about formatting, since different programs interpret the data differently. I could be wrong though. Look at MSDN it will probably say something about this.
  • [QUOTE=Overv;36343876]I'm pretty sure the clipboard generally doesn't support transparent bitmaps.[/QUOTE] You can put whatever data you want in to the clipboard, it's up to the software to interpret it.
  • Then either Im doing something wrong (which I started to question after I found that post [url]http://stackoverflow.com/questions/9050480/bug-4720930-walkaround-system-clipboard-and-alpha-image-support[/url] and several other which describe background turning blue after export) or there is a bug with java's handling of transparent images regarding clipboard. The image itself is genuine as I can save it to transparent png with no problem at all. Maybe some kind of additional conversion is needed before I can save it to clipboard and a lot of people posting on those forums didnt know that either. Hmm... Im pretty sure java itself should be able to handle technicals behind the transfer with its built-in libraries.