[Scilab-users] How to create transparent polygon

classic Classic list List threaded Threaded
5 messages Options
jaipur jaipur
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] How to create transparent polygon

Dear all

When making a polygon by xpoly for example, can we set transparency effect
as the following polygon?
If it's possible, could you suggest the way of doing?

Regards
Hiroshi Tachihara

<http://mailinglists.scilab.org/file/t497089/transparency.png>



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: How to create transparent polygon

Le 09/11/2019 à 14:19, jaipur a écrit :
Dear all

When making a polygon by xpoly for example, can we set transparency effect
as the following polygon?
No, AFAIK it is not properly possible.
There is just the gcf().pixel_drawing_mode property, but it's a global one for the whole figure,
and it is not easy to manage. This way is rather a hack.
help.scilab.org/docs/6.0.2/en_US/pixel_drawing_mode.html




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: How to create transparent polygon

In reply to this post by jaipur
Hi,

If it is not necessary to have real transparent color mixing, but just want to have the transparent effect, you could try to play with the "pixel_drawing_mode". 
f = figure("background", 1,"pixel_drawing_mode", "or");
plot2d(0,0,-1,"010"," ",[-2,-2,2,2]);

x=sin(2*%pi*(0:4)/5);
y=cos(2*%pi*(0:4)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2]);
gca().foreground = 12;
xfpoly(x,y);
gca().foreground = 27;
xfpoly(x+0.3,y+0.3)



example from https://help.scilab.org/docs/6.0.2/en_US/pixel_drawing_mode.html

rgds,
CL


---- On Sat, 09 Nov 2019 21:19:44 +0800 jaipur <[hidden email]> wrote ----

Dear all

When making a polygon by xpoly for example, can we set transparency effect
as the following polygon?
If it's possible, could you suggest the way of doing?

Regards
Hiroshi Tachihara

<http://mailinglists.scilab.org/file/t497089/transparency.png>



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: How to create transparent polygon

the previous method is the implementation as suggested by Samuel, another approach would be using Matplot.

you could play with the last line obj1 and obj2 (alpha blending) to get the desired intersection color. 

x = zeros(100,100,3);

obj1 = x;
obj2 = x;

obj1(21:60,21:60) = 1;
obj1(:,:,2:3) = 0;

obj2(41:80,41:80,2) = 1;
obj2(:,:,[1,3]) = 0;

Matplot(obj1+obj2)




---- On Tue, 12 Nov 2019 11:39:38 +0800 Chin Luh Tan <[hidden email]> wrote ----

Hi,

If it is not necessary to have real transparent color mixing, but just want to have the transparent effect, you could try to play with the "pixel_drawing_mode". 
f = figure("background", 1,"pixel_drawing_mode", "or");
plot2d(0,0,-1,"010"," ",[-2,-2,2,2]);

x=sin(2*%pi*(0:4)/5);
y=cos(2*%pi*(0:4)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2]);
gca().foreground = 12;
xfpoly(x,y);
gca().foreground = 27;
xfpoly(x+0.3,y+0.3)



example from https://help.scilab.org/docs/6.0.2/en_US/pixel_drawing_mode.html

rgds,
CL


---- On Sat, 09 Nov 2019 21:19:44 +0800 jaipur <[hidden email]> wrote ----




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Dear all

When making a polygon by xpoly for example, can we set transparency effect
as the following polygon?
If it's possible, could you suggest the way of doing?

Regards
Hiroshi Tachihara

<http://mailinglists.scilab.org/file/t497089/transparency.png>



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jaipur jaipur
Reply | Threaded
Open this post in threaded view
|

Re: How to create transparent polygon

In reply to this post by Chin Luh Tan
Thank you all.

I understand that scilab has the ability to draw transparent polygon any
way.
But changing of pixel_drawing_mode property affect already existent way of
drawing, we have to be careful when doing.
Especially when changing of pixel_drawing_mode property two or more times.

Thank you.

H.T.



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users