Path: news.mathworks.com!not-for-mail
From: Loren Shure <loren@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Interesting problem with image alpha data
Date: Tue, 22 Sep 2009 07:49:30 -0400
Organization: The MathWorks
Lines: 37
Message-ID: <MPG.252283d34115c611989a2c@news.mathworks.com>
References: <h1fj4i$7ln$1@fred.mathworks.com> <h99et9$5as$1@fred.mathworks.com>
NNTP-Posting-Host: shurel.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1253620170 4433 172.31.57.214 (22 Sep 2009 11:49:30 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 22 Sep 2009 11:49:30 +0000 (UTC)
User-Agent: MicroPlanet-Gravity/2.70.2067
Xref: news.mathworks.com comp.soft-sys.matlab:572061


In article <h99et9$5as$1@fred.mathworks.com>, 
whichpart.wwinter.isnotanemail@uci.edu says...
> "Michael " <michael.bennett@lineone.net> wrote in message <h1fj4i$7ln$1@fred.mathworks.com>...
> >  I have come across an interesting problem with setting the alpha data for an image, which I can't quite get my head around.
> > 
> >  To explain, consider the following example:
> > 
> >  h1 = figure(1);
> >  h1a = axes('DataAspectRatio', [1 1 1], 'DrawMode', 'fast', 'Parent', h1);
> >  h1b = image('Parent', h1a);
> > 
> >  All works as expect, then:
> > 
> >  set(h1b, 'CData', imread('Peppers.png'));  % load a test image.
> > 
> >  This works just as would be expected.  So, I then try:
> > 
> >  set(h1b, 'AlphaData', 0.75);
> > 
> >  Which has the right effect.  However, this image isn't positioned very nicely within the axes, so I use:
> > 
> >  set(h1a, 'XLim', [1 512], 'YLim', [1 384], 'YDir', 'reverse');
> > 
> >  Which makes everything look nice.  But now if I set the alpha data to anything other than 1, the image just dissappears completely.  Can anyone tell me what is going wrong here?
> > 
> >  I'm using Matlab R2009a with version 6.3 of the Image Processing toolbox.
> > 
> >  Many thanks!
> 
> Has anyone else seen this problem?  More importantly, has anyone identified a viable solution?
> 

It works for me in both R2009a and R2009b.

-- 
Loren
http://blogs.mathworks.com/loren