Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to grab IconRef from a .tiff file.



On 8/22/03 12:15 PM, Mike Kluev didst favor us with:

> On 22/08/2003 01:21, Laurence Harris wrote:
>
>> It turns out that some TIFFs need the InvertRect and some don't, and both
>> look fine in Preview. Is there some QuickTime API I can use to determine
>> when I need to use InvertRect()? Thanks,
>
> The image that you sent me (presumably the one that requires
> InvertRect) looks wrong (inverted) in Preview app on my computer -
> white opaque rectangle in background and translucent area in
> center. It looks as wrong in the sample app that grabs picture
> with GraphicsImportGetAsPicture and just draws it. I think the
> question is - why it is showed correctly in Preview app on your
> computer.

Don't know. It's not the best test image and maybe I didn't create it
correctly. I've since created another an it works as expected without
inverting so I'll assume pilot error on that one.

However, the code you posted has a couple of subtle problems:

1) When you create the picture, you specify that it should use the alpha
channel with

GraphicsImportSetGraphicsMode( gic, graphicsModeStraightAlpha, NULL );

So when SetIconFamilyData creates the initial IconFamilyHandle, it draws the
image respecting the alpha channel. Then the mask is created which basically
replicates the alpha channel, so when the icon is drawn, the alpha channel
is used twice, which doesn't yield the right image. I've changed it to
create two pictures: one without the alpha for creating the icon data, and
one *with* the alpha channel for use in creating the mask, and this yields a
more accurate result.

2) The mask has significant banding in it. I haven't solved this yet, but I
have an idea or two I'm going to try.

Larry



Larry
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: How to grab IconRef from a .tiff file. (From: Mike Kluev <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.