Transparent RSyntaxTextArea background

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Transparent RSyntaxTextArea background

Postby jrose » Tue Jul 17, 2012 12:00 am

I am trying to experiment with painting graphics behind an RSyntaxTextArea but I can't get it to work. After looking through the docs I think I should be able to pass a transparent Image or something but I can't figure it out.
jrose
 
Posts: 15
Joined: Wed Jun 06, 2012 6:26 pm

Re: Transparent RSyntaxTextArea background

Postby robert » Mon Jul 23, 2012 4:02 am

What would you want to show behind the image? I believe you're correct that if you pass an image with translucency or transparent pixels, it will render it as-is if you just call setBackgroundImage(Image). Do you have problems with this feature?
User avatar
robert
 
Posts: 794
Joined: Sat May 10, 2008 5:16 pm

Re: Transparent RSyntaxTextArea background

Postby jrose » Mon Jul 23, 2012 5:55 am

There are a couple things I would like to do with the transparent background. For one, some like http://www.pawfal.org/fluxus/ which basically lets you program graphics while viewing them behind the code. There is a cool library for Clojure called Quil which is a Clojure implementation of the Processing.org graphics programming library and I want to display it behind rsta buffers. I have sorted out the overlayed components I just can't get the setBackgroundImage to work. I am not sure if this is a Clojure/Java interoperability issue but here is the error I get when i try to set the background image

sketchpad.user=> (.setBackgroundImage (current-buffer) img)
IllegalArgumentException Can't call public method of non-public class: public void org.fife.ui.rtextarea.RTextAreaBase.setBackgroundImage(java.awt.Image) clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:87)

It seems that the setBackgroundImage is from the RTextAreaBase abstract class and for some reason I can't make a call to it...

The other thing I am really hoping to do is incorporate graphics in the rsta components directly. In brief, I want to be able to add paintable components into the TextAreas. I know StyledDocuments support icons and images, how would RSyntaxDocuments handle this? Could I create a new subclass of RSyntaxDocument that implements StyledDoc?

Sorry for so many questions ;-) Really grateful for the awesome work you've done on this project.

jon
jrose
 
Posts: 15
Joined: Wed Jun 06, 2012 6:26 pm

Re: Transparent RSyntaxTextArea background

Postby robert » Mon Jul 23, 2012 1:14 pm

I'll take a look at the RTextAreaBase issue. I know it has caused problems in the past with NetBeans' Matisse editor, as well (wasn't happy using introspection on a non-public class, which sounds like the same problem here).

As for the images in RSyntaxDocument, that's going to be a lot more difficult. I'm not sure off the top of my head how we could support that. DefaultStyledDocument caches a lot more information than RSyntaxDocument does (and "natively" supports non-text contents) so it might prove difficult to port such a feature to RSTA without a major rewrite of the Document structure...
User avatar
robert
 
Posts: 794
Joined: Sat May 10, 2008 5:16 pm

Re: Transparent RSyntaxTextArea background

Postby jrose » Mon Jul 23, 2012 5:05 pm

Awesome, thanks for looking into the setBackgroundImage issues. This would be a huge feature for me to be able to use!

I am looking through the docs for RSyntaxDocument and DefaultStyledDocument and I see what you mean...In a couple weeks I might take a shot at extending RSyntaxDocument and implementing the StyledDoc interface on top of it. It seems like somehow I would need to get the TokenMaker classes to work with StyledDoc Attributes.

For now it would be awesome if i could have the transparent background. After that I am hoping to create a simple api for having popup widgets based on tokens. Since my project deals with media, I am hoping to be able to do something like a masked click on a token pops up a gui widget. For example, clicking a float value in a give form, (param my-float), could popup a slider, or masked clicking a vector which looks like a java Array, could open a step sequencer (param [0 1 0 0 1 0 0 1]). I don't think this will interfere with RSTA so hopefully it won't be too difficult.
jrose
 
Posts: 15
Joined: Wed Jun 06, 2012 6:26 pm


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron