Professional Web Applications Themes

NSImage and transparency - Mac Programming

Hello! I have a very basic question regarding NSImage. When compositing an NSImage on a NSView using the NSCompositeOver composoting mode, how do I tell the computer which parts of the NSImage should be transparent? To be more specific, this is what I want to do: I have some pixmap files in the xpm format. Each pixmap consists of three colours; black, white and green. I want all green pixels to be transparent. -- Tord Romstad...

Sponsored Links
  1. #1

    Default NSImage and transparency

    Hello!

    I have a very basic question regarding NSImage. When compositing an
    NSImage on a NSView using the NSCompositeOver composoting mode, how do
    I tell the computer which parts of the NSImage should be transparent?

    To be more specific, this is what I want to do: I have some pixmap
    files in the xpm format. Each pixmap consists of three colours;
    black, white and green. I want all green pixels to be transparent.

    --
    Tord Romstad

    Sponsored Links
    Tord Guest

  2. #2

    Default Re: NSImage and transparency

    > To be more specific, this is what I want to do: I have some pixmap 

    I'm sure there is a way that I don't know about, but I've always used
    TIFF files which have "their own" transperancy settings, (as done in
    Photoshop, or something).

    Works like a charm. Is there anyway you could use TIFF files instead of
    xpm files, or is that impossible? mb.
    M Guest

  3. #3

    Default Re: NSImage and transparency

    com (M) writes:
     
    >
    > I'm sure there is a way that I don't know about, but I've always used
    > TIFF files which have "their own" transperancy settings, (as done in
    > Photoshop, or something).
    >
    > Works like a charm. Is there anyway you could use TIFF files instead of
    > xpm files, or is that impossible? mb.[/ref]

    Thanks for your input. I can use TIFF files instead of xpm files, but
    the problem remains the same: How do I make the green-coloured pixels
    transparent? I really don't want to buy Photoshop in order to do
    something as basic as this. Is there some freeware program which can
    do the same?

    --
    Tord Romstad
    Tord Guest

  4. #4

    Default Re: NSImage and transparency

    On 12/14/03 4:35 PM, in article uio.no, "Tord
    Kallqvist Romstad" <uio.no> wrote:
     

    You can use GIMP (a Photoshop alternative) to change the green pixels to
    transparent. Here's the URL:

    http://www.versiontracker.com/dyn/moreinfo/macosx/9866

    Don't know if it will load an XPM (my guess is it will), but it should be
    easy to find a converter if not.

    Another alternative is to do the conversion yourself. Once you have the
    image loaded in an NSImage instance, lock the focus on the representation
    and change the pixels manual. Then save it back out. A faster alternative is
    to get the actual image data from the representation in a buffer, run
    through that buffer and make your change, and then set the representation's
    buffer to be the image information you modified.

    Cheers, Kevin

    --
    Kevin Hamilton
    www.ethereal1.net

    Kevin Guest

  5. #5

    Default Re: NSImage and transparency

    Tord Kallqvist Romstad <uio.no> wrote in message news:<uio.no>... 

    I have taken to writing little Cocoa command-line tools to do things
    like this. I don't have anything that does exactly what you want
    (I think), but I'd be willing to send you the source, provided you
    don't get upset at really ugly source that I did not write intending
    someone else to see it. Given the framework, you should be able to
    do what you want fairly easily.
    Eric Guest

  6. #6

    Default Re: NSImage and transparency

    Thanks a lot for the suggestions, Kevin!

    I hope I'll manage to make it work.

    --
    Tord Romstad
    Tord Guest

Similar Threads

  1. Help with transparency
    By Tracie_VH@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 4
    Last Post: August 10th, 08:12 PM
  2. Transparency in 3D
    By yael h webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 2
    Last Post: January 10th, 06:42 PM
  3. Transparency
    By rache2000 in forum Macromedia Fireworks
    Replies: 6
    Last Post: December 8th, 07:15 PM
  4. Replies: 5
    Last Post: September 25th, 09:34 PM
  5. Need help with transparency
    By John T in forum Macromedia Fireworks
    Replies: 3
    Last Post: July 8th, 04:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139