Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
T_J_Arakeri

Junior Member
Registered:
Posts: 10
Reply with quote  #1 
Hi Jaewon,
I was just wondering if it is possible to change the alpha value of a graphic created inside an adapter? For example, using mgladdcircle.

Thanks,
Tapas
0
Jaewon

Administrator
Registered:
Posts: 855
Reply with quote  #2 
I keep telling this to people. A better way to ask this kind of questions is to just explain what you want to do, not how you want to do it.
0
T_J_Arakeri

Junior Member
Registered:
Posts: 10
Reply with quote  #3 
Sorry Jaewon. Essentially I want to create an array of dots which are translucent, such that if they overlap, they appear darker. Here is an example:
  dot_array.png 

0
Jaewon

Administrator
Registered:
Posts: 855
Reply with quote  #4 
Shapes drawn by MGL already have fixed alpha channel values, but you can use the ImageGraphic adapter and provide a bitmap data, including the alpha channel, as you want. In MGL, you can use a matrix of Y-by-X-by-4 to represent an ARGB bitmap or load from PNG files. See the example below.

By the way, I found a typo in the ImageGraphic adapter. You need to make a change that I posted in the following link or download the new package, to run the example.
http://forums.monkeylogic.org/post/nimh-monkeylogic-2-8444337?pid=1308247017

--- Beginning of example -----
radius = 1.5;  % in degrees
imdata = make_circle(radius*Screen.PixelsPerDegree,[1 1 1],1);  % make_circle(radius_in_pixels,color,fill)
imdata(:,:,1) = imdata(:,:,1) / 2;  % imdata(:,:,1): alpha
                                    % imdata(:,:,2): red
                                    % imdata(:,:,3): green
                                    % imdata(:,:,4): blue

crc = ImageGraphic(null_);
crc.ImageList = {imdata,[-1 -0.7]; imdata,[1 -0.7]; imdata,[0 1]};
tc = TimeCounter(crc);
tc.Duration = 5000;
scene = create_scene(tc);

run_scene(scene);
idle(0);

----- End of example -----


0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.