NSStatusItem's Image transparency

  • Hi guys. I would like to ask if any of you could come up with a solution on
    setting the status item's transparency. I'm kinda new to doing lockFocus on
    NSImages, and setting transparency / alpha stuff in them.

    I would like to have a status item that "softly blinks" when a background
    process is being done inside the application.

    Many thanks in advance :D
  • Do it the easy way, in photoshop.

    To cycle your newly created transparent images, call [myStatusItem
    setImage:nextImage]; on a timer

    Nick

    On 6 Oct 2006, at 14:23, <cocoa-dev-request...> wrote:

    > Message: 16
    > Date: Fri, 6 Oct 2006 21:22:12 +0800
    > From: "Jofell Gallardo" <jofell...>
    > Subject: NSStatusItem's Image transparency
    > To: <cocoa-dev...>
    > Message-ID:
    > <6eeeb2b10610060622j1aba0916w53fd1eb114aab6dc...>
    > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
    >
    > Hi guys. I would like to ask if any of you could come up with a
    > solution on
    > setting the status item's transparency. I'm kinda new to doing
    > lockFocus on
    > NSImages, and setting transparency / alpha stuff in them.
    >
    > I would like to have a status item that "softly blinks" when a
    > background
    > process is being done inside the application.
    >
    > Many thanks in advance :D
  • The Photoshop approach may yield better looking results.

    But, if you want to do it in code, something along these lines should
    do it. Completely untested.

    -(NSImage*) imageFromImage:(NSImage*) image withOpacity:(float) newOpacity {
      NSImage* new = [[NSImage alloc] initWithSize:[image size]];
      [new lockFocus];
      [image disolveToPoint:NSZeroPoint fraction:newOpacity];
      [new unlockFocus];
      return [new autorelease];
    }

    Someone wiser may have a slicker approach.

    Note - you'll want to cache those images up in advance or else your
    animation would probably be choppy.

    -Jim...

    On 10/6/06, Jofell Gallardo <jofell...> wrote:
    > Hi guys. I would like to ask if any of you could come up with a solution on
    > setting the status item's transparency. I'm kinda new to doing lockFocus on
    > NSImages, and setting transparency / alpha stuff in them.
    >
    > I would like to have a status item that "softly blinks" when a background
    > process is being done inside the application.
    >
    > Many thanks in advance :D
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<jim...>
    >
    > This email sent to <jim...>
    >
  • Thanks! This really worked... many thanks!

    On 10/7/06, Jim Thomason <jim...> wrote:
    >
    > The Photoshop approach may yield better looking results.
    >
    > But, if you want to do it in code, something along these lines should
    > do it. Completely untested.
    >
    > -(NSImage*) imageFromImage:(NSImage*) image withOpacity:(float) newOpacity
    > {
    > NSImage* new = [[NSImage alloc] initWithSize:[image size]];
    > [new lockFocus];
    > [image disolveToPoint:NSZeroPoint fraction:newOpacity];
    > [new unlockFocus];
    > return [new autorelease];
    > }
    >
    > Someone wiser may have a slicker approach.
    >
    > Note - you'll want to cache those images up in advance or else your
    > animation would probably be choppy.
    >
    > -Jim...
    >
    > On 10/6/06, Jofell Gallardo <jofell...> wrote:
    >> Hi guys. I would like to ask if any of you could come up with a solution
    > on
    >> setting the status item's transparency. I'm kinda new to doing lockFocus
    > on
    >> NSImages, and setting transparency / alpha stuff in them.
    >>
    >> I would like to have a status item that "softly blinks" when a
    > background
    >> process is being done inside the application.
    >>
    >> Many thanks in advance :D
    >> _______________________________________________
    >> Do not post admin requests to the list. They will be ignored.
    >> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/<jim...>
    >>
    >> This email sent to <jim...>
    >>
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    >
    > http://lists.apple.com/mailman/options/cocoa-dev/<jofell.gallardo...>
    m

    >
    > This email sent to <jofell.gallardo...>
    >
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today