realbasic-nug
[Top] [All Lists]

RE:smooth graphics+transparency

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: RE:smooth graphics+transparency
From: Ian <steeley at btinternet dot com>
Date: Thu, 11 Jul 2002 22:12:39 +0000
Ok...


> Subject: Re: smooth graphics+transparency
> From: "Frank Bitterlich"
> Date: Tue, 09 Jul 2002 14:22:50 +0200
>
> Ian wrote:
> > Tried a few things, but no decent results.
> >
> > Any good tips?
>
> Yep. Tip #1: Tell us what you've already tried. ;)
>
> Cheers,
>    Frank+++
>

If the following 3 lines of code worked that would be great ( it flickers too 
much).

>From a slider valuechanged():

dim x as Integer
  x=me.value
  oval1.FillColor=rgb(x,x,x)


--mess around with pixels, works, but could be a bit slow, also need to add 
ability to read a slider
value
maybe have to add a timer to "slow down" the sliders output so the repaint 
works-hmm getting messy:

dim rLoop,cLoop as Integer
  dim c as color
  dim p as picture
  dim  as integer
  p=newpicture(w,h,32)
  p.graphics.drawpicture apic,0,0
  for rLoop=1 to p.Width
    for cLoop=1 to p.height
      c=p.rgbsurface.pixel(rloop,cLoop)
      if c=rgb(0,0,0) then
        p.rgbsurface.pixel(rLoop,cLoop)=rgb(255,255,255)
      end if
    next
  next
  canvas2.backdrop= p


--Try this (in a slider)-no it is nice and flickery:

  dim x,w,h as Integer
  x=me.value
  w=canvas3.width
  h=canvas3.height
  canvas3.backdrop.Mask.Graphics.ForeColor=rgb(x,x,x)
  canvas3.backdrop.Mask.Graphics.FillRect 0,0,w,h
  canvas3.refresh

I see the transparency property can be either 0 or 1, and the mask gives access 
to
"a  256-grey level mask that controls the transparency of the picture" to quote 
the manual.
shame you can't go canvas1.mask = x

I need to fade images(mostly jpegs, sometimes drawn graphics) in and out 
smoothly, and
vary the transparency smoothly so images underneath will become visible.

cheers,

Ian.

--
Ian Steele. Senior Engineer, National Film & TV School UK.




<Prev in Thread] Current Thread [Next in Thread>