Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICOFamily is no longer broken - writing ICO files works. #3

Merged
merged 1 commit into from Nov 22, 2011

Conversation

matheweis
Copy link
Collaborator

Functional in simple tests, but needs more testing for edge cases; it
makes heavy assumptions about the internal format of the
NSBitmapImageReps and has no error checking. At least it works now.

Functional in simple tests, but needs more testing for edge cases; it
makes heavy assumptions about the internal format of the
NSBitmapImageReps and has no error checking.
alexzielenski pushed a commit that referenced this pull request Nov 22, 2011
ICOFamily is no longer broken - writing ICO files works. - Thanks metheweis
@alexzielenski alexzielenski merged commit ce6bfd5 into alexzielenski:master Nov 22, 2011
@alexzielenski
Copy link
Owner

Wow, thanks I just merged it. I would have worked on this class more but the project I was using it in is no longer in development.

@alexzielenski
Copy link
Owner

Can you tell me the function of the andBuf?

@matheweis
Copy link
Collaborator Author

Hi Alex,

Sure, it is basically a 1-bit mask... It makes more sense if you think about the 1-bit and 8-bit icons.

It is confusing that it is still required for 32-bit formats since they have their own 8-bit alpha as well... I have tried making 32-bit ico bitmaps without the and mask but many applications have trouble parsing them.

By the way, what were you planning to make out of ICOFamily?

Please let me know if you need any more info.

Thanks,

-Mathew Eis

On 17 Dec 2011, at 09:22, Alex Zielenski wrote:

Can you tell me the function of the andBuf?


Reply to this email directly or view it on GitHub:
#3 (comment)

@matheweis
Copy link
Collaborator Author

I should add that I took advantage of that fact and hacked the andBuf... really the data should be generated based on the 8-bit alpha channel, but since most apps will ignore the andBuf it didn't matter.

I just wanted to get it working to see if ICOFamily would work for my application and thought I might as well contribute that source back up.

-Mathew Eis

On 17 Dec 2011, at 09:47, Mathew Eis wrote:

Hi Alex,

Sure, it is basically a 1-bit mask... It makes more sense if you think about the 1-bit and 8-bit icons.

It is confusing that it is still required for 32-bit formats since they have their own 8-bit alpha as well... I have tried making 32-bit ico bitmaps without the and mask but many applications have trouble parsing them.

By the way, what were you planning to make out of ICOFamily?

Please let me know if you need any more info.

Thanks,

-Mathew Eis

On 17 Dec 2011, at 09:22, Alex Zielenski wrote:

Can you tell me the function of the andBuf?


Reply to this email directly or view it on GitHub:
#3 (comment)

@alexzielenski
Copy link
Owner

Ok that makes sense. Also, why does the and mask require double height? And I was planning on making ICOFamily an ICO counterpart to IconFamily.

@matheweis
Copy link
Collaborator Author

The double height seems to be a (painfully undocumented) way to indicate that the image data contains two images; the actual data, then the mask... I can't really be sure. It is not mentioned on MSDN at all, but every ICO reader/writer I have seen uses it, and if it is left out some apps have trouble reading the data.

I found that for my app I need an ICO writer that uses CGImageRef natively, so I am writing my own from scratch. IconFamily uses NSBitmapImageRep which stores data in premultiplied alpha format - convenient for use with NSImage, but data is lost over time.

If you need some more guidance on reading/writing ICO directly, you should look at these three programs:
http://www.macupdate.com/download/9477/Iconverterv09.zip
http://savannah.nongnu.org/download/icoutils/icoutils-0.29.1.tar.bz2
http://www.ibiblio.org/pub/linux/libs/graphics/libico-1.2.tar.gz

Hope this helps,

-Mathew Eis

On 17 Dec 2011, at 10:06, Alex Zielenski wrote:

Ok that makes sense. Also, why does the and mask require double height? And I was planning on making ICOFamily an ICO counterpart to IconFamily.


Reply to this email directly or view it on GitHub:
#3 (comment)

@alexzielenski
Copy link
Owner

NSBitmapImageRep has a -CGImage method

@matheweis
Copy link
Collaborator Author

NSBitmapImageRep does not support unpremultiplied alpha format, so data will be lost when converting from CGImageRef (unpremultiplied alpha) to NSBitmapImageRep (premultiplied alpha)

On 17 Dec 2011, at 11:21, Alex Zielenski wrote:

NSBitmapImageRep has a -CGImage method


Reply to this email directly or view it on GitHub:
#3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants