[Scilab-users] How to create transparent polygon

Chin Luh Tan chinluh.tan at bytecode-asia.com
Tue Nov 12 04:53:11 CET 2019


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 <chinluh.tan at bytecode-asia.com> 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 <mailto:acj119 at nifty.com> wrote ----










_______________________________________________ 
users mailing list 
users at lists.scilab.org 
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 
mailto:users at lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191112/746006a0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1573530752660000_2099359832.png
Type: image/png
Size: 11364 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20191112/746006a0/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.png
Type: image/png
Size: 8541 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20191112/746006a0/attachment-0001.png>


More information about the users mailing list