Transparent background for SCWindow

View: New views
6 Messages — Rating Filter:   Alert me  

Transparent background for SCWindow

by Eirik Blekesaune :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there any way to make the background for a window transparent while keeping the image drawn by Pen still visible? I want to have the white background transparent, but keep the blue oval in the middle visible in this code:

(
w = Window.new("circleSelector", Rect(800,300,300,300), border: false);
w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));

w.drawHook = {
    Pen.addOval(w.view.bounds.insetBy(30));
    Pen.fillRadialGradient(w.view.bounds.center, w.view.bounds.center,
        0, w.bounds.width, Color.blue, Color.cyan);
};

w.front;
)

-eirik

Re: Transparent background for SCWindow

by thelych :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Eirik,

on OS X only
you can try this SCWindow extension:

+SCWindow {
asNSWindow {
var view, window;
view = SCNSObject.newFromRawPointer(dataptr);
window = view.invoke("window");
view.release;
^window; // you own it - call release once you do not need it anymore
}
}

then try to hack something with the cocoa bridge like that :

(
w = SCWindow.new("circleSelector", Rect(200,400,300,300), border: false);

t = w.asNSWindow;
t.invoke("setOpaque:", [false]);
t.invoke("setBackgroundColor:", [Color.clear]);
w.view.background_(Color.clear);
//w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));


w.drawHook = {
    SCPen.addOval(w.view.bounds.insetBy(30));
    SCPen.fillRadialGradient(w.view.bounds.center, w.view.bounds.center, 0, w.bounds.width, Color.blue, Color.cyan);
};

w.onClose_({t.release});
w.front;
)


// ...ect...
w.close; // needed

and your window should be now transparent... seems to work (intel Leopard 10.5.6)

i know --- kinda hacky :)
hth anyway

best,
charles


Le 16 avr. 09 à 16:11, Eirik Arthur Blekesaune a écrit :

Is there any way to make the background for a window transparent while keeping the image drawn by Pen still visible? I want to have the white background transparent, but keep the blue oval in the middle visible in this code:

(
w = Window.new("circleSelector", Rect(800,300,300,300), border: false);
w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));

w.drawHook = {
    Pen.addOval(w.view.bounds.insetBy(30));
    Pen.fillRadialGradient(w.view.bounds.center, w.view.bounds.center,
        0, w.bounds.width, Color.blue, Color.cyan);
};

w.front;
)

-eirik


Re: Transparent background for SCWindow

by Sciss-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

here's the trick for swingOSC, but i think that only works on OS X:

w = JSCWindow.viewPalette;
~comp = JavaObject.basicNew( w.id, w.server ).getWindow__;  
~comp.setBackground( Color.clear ); ~comp.destroy;

ciao, -sciss-

Am 17.04.2009 um 00:23 schrieb thelych@...:

> Hi Eirik,
>
> on OS X only
> you can try this SCWindow extension:
>
> +SCWindow {
> asNSWindow {
> var view, window;
> view = SCNSObject.newFromRawPointer(dataptr);
> window = view.invoke("window");
> view.release;
> ^window; // you own it - call release once you do not need it  
> anymore
> }
> }
>
> then try to hack something with the cocoa bridge like that :
>
> (
> w = SCWindow.new("circleSelector", Rect(200,400,300,300), border:  
> false);
>
> t = w.asNSWindow;
> t.invoke("setOpaque:", [false]);
> t.invoke("setBackgroundColor:", [Color.clear]);
> w.view.background_(Color.clear);
> //w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));
>
>
> w.drawHook = {
>     SCPen.addOval(w.view.bounds.insetBy(30));
>     SCPen.fillRadialGradient(w.view.bounds.center,  
> w.view.bounds.center, 0, w.bounds.width, Color.blue, Color.cyan);
> };
>
> w.onClose_({t.release});
> w.front;
> )
>
>
> // ...ect...
> w.close; // needed
>
> and your window should be now transparent... seems to work (intel  
> Leopard 10.5.6)
>
> i know --- kinda hacky :)
> hth anyway
>
> best,
> charles
>
>
> Le 16 avr. 09 à 16:11, Eirik Arthur Blekesaune a écrit :
>
>> Is there any way to make the background for a window transparent  
>> while keeping the image drawn by Pen still visible? I want to have  
>> the white background transparent, but keep the blue oval in the  
>> middle visible in this code:
>>
>> (
>> w = Window.new("circleSelector", Rect(800,300,300,300), border:  
>> false);
>> w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));
>>
>> w.drawHook = {
>>     Pen.addOval(w.view.bounds.insetBy(30));
>>     Pen.fillRadialGradient(w.view.bounds.center,  
>> w.view.bounds.center,
>>         0, w.bounds.width, Color.blue, Color.cyan);
>> };
>>
>> w.front;
>> )
>>
>> -eirik
>


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: Transparent background for SCWindow

by Eirik Blekesaune :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank charles and sciss for solutions!



-eirik


Den 17. april. 2009 kl. 00.32 skrev Sciss:

> here's the trick for swingOSC, but i think that only works on OS X:
>
> w = JSCWindow.viewPalette;
> ~comp = JavaObject.basicNew( w.id, w.server ).getWindow__;  
> ~comp.setBackground( Color.clear ); ~comp.destroy;
>
> ciao, -sciss-
>
> Am 17.04.2009 um 00:23 schrieb thelych@...:
>
>> Hi Eirik,
>>
>> on OS X only
>> you can try this SCWindow extension:
>>
>> +SCWindow {
>> asNSWindow {
>> var view, window;
>> view = SCNSObject.newFromRawPointer(dataptr);
>> window = view.invoke("window");
>> view.release;
>> ^window; // you own it - call release once you do not need it  
>> anymore
>> }
>> }
>>
>> then try to hack something with the cocoa bridge like that :
>>
>> (
>> w = SCWindow.new("circleSelector", Rect(200,400,300,300), border:  
>> false);
>>
>> t = w.asNSWindow;
>> t.invoke("setOpaque:", [false]);
>> t.invoke("setBackgroundColor:", [Color.clear]);
>> w.view.background_(Color.clear);
>> //w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));
>>
>>
>> w.drawHook = {
>>     SCPen.addOval(w.view.bounds.insetBy(30));
>>     SCPen.fillRadialGradient(w.view.bounds.center,  
>> w.view.bounds.center, 0, w.bounds.width, Color.blue, Color.cyan);
>> };
>>
>> w.onClose_({t.release});
>> w.front;
>> )
>>
>>
>> // ...ect...
>> w.close; // needed
>>
>> and your window should be now transparent... seems to work (intel  
>> Leopard 10.5.6)
>>
>> i know --- kinda hacky :)
>> hth anyway
>>
>> best,
>> charles
>>
>>
>> Le 16 avr. 09 à 16:11, Eirik Arthur Blekesaune a écrit :
>>
>>> Is there any way to make the background for a window transparent  
>>> while keeping the image drawn by Pen still visible? I want to have  
>>> the white background transparent, but keep the blue oval in the  
>>> middle visible in this code:
>>>
>>> (
>>> w = Window.new("circleSelector", Rect(800,300,300,300), border:  
>>> false);
>>> w.view.background_(Color.new(1.0, 1.0, 1.0, 1.0));
>>>
>>> w.drawHook = {
>>>    Pen.addOval(w.view.bounds.insetBy(30));
>>>    Pen.fillRadialGradient(w.view.bounds.center,  
>>> w.view.bounds.center,
>>>        0, w.bounds.width, Color.blue, Color.cyan);
>>> };
>>>
>>> w.front;
>>> )
>>>
>>> -eirik
>>
>
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

SCBerlinMonMtg200409 Presentation

by hatam@drfz.de :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear All,

This coming Monday April 20th at 8pm, Chris will be presenting his
experimentations with SuperCollider.

http://www.cylob.com/home_a.html
All are welcome!

Elsenstr. 52 / 2HH
First bldg on left, 2 Etage
Please bring my handy nr. incase the doors are closed.
017620626386

www.myspace.com/enka52

Best, Farah

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: SCBerlinMonMtg200409 Presentation

by Neels Janosch Hofmeyr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Farah,

you forgot to mention which *city* you are talking about. Oh, the website
says Berlin, so it's probably Berlin.

You also posted your mail in reply to another one, which made it nest inside
another conversation, making it less visible (at least in my mail client's
threaded mail sorting).

Anyhow, have fun :)

~Neels

Farah Hatam wrote:

> Dear All,
>
> This coming Monday April 20th at 8pm, Chris will be presenting his
> experimentations with SuperCollider.
>
> http://www.cylob.com/home_a.html
> All are welcome!
>
> Elsenstr. 52 / 2HH
> First bldg on left, 2 Etage
> Please bring my handy nr. incase the doors are closed.
> 017620626386
>
> www.myspace.com/enka52
>
> Best, Farah
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
>


signature.asc (204 bytes) Download Attachment