Joined: May 25, 2003 Posts: 4752 Location: Santa Barbara, CA
Posted: Wed Jun 18, 2003 12:25 am Post subject: Ximian icon importing HowTo
Well, after four days of misery I finally figured out how to move in the Ximian icon set into OOo/Neo. I figured out several bad things along the way, and figured I should write them down before I forget what I did.
-- Photoshop (or other automatable graphics engine)
-- ImageMagick. These are command line utilities that perform graphics rotation, scaling, etc. Used by the Ximian scripts. I downloaded a prepackaged version from this dude.
-- Ximian icons & patches, etc. These are all LGPLd, and I used the convienent ooo-build-1.0.7 set.
-- Lots of beer. For venting frustration.
-- Lots of Grateful Dead concert recordings to relieve frustration.
-- The "basename" command. Very helpful.
-- Knowledge of "find | xargs csh -c" evil, usually combined with basename, for processing these thousand or so icons that live in an involved directory structure.
General things discovered:
-- Moving in the Ximian 32 bit alpha bitmap support into Neo proved difficult. There were actually a number of bugs conspiring together, but my final approach got rid of this.
-- The default bitmap SvStream write function does not properly write 32 bit BMP files. It actually dumps information in the alpha channel. I fixed this in Neo.
-- The Ximian icons woudl really look better with alpha support, but even without it they look a hell of a lot nicer then stock icons.
-- Some raw bitmap files that are part of OOo are themselves hosed.
-- To actually rebuild the .res files, you should "find . -name \*.srs | xargs -n 1 touch". Simply changing .bmp files or touching them does not always result in the .res files being recompiled (dependency issue?)
The final process was incredibly convoluted:
-- Ximian icon conversion:
First, all transparency in the Ximian icons uses alpha masks, while OOo does not use alpha in Bitmap objects (unless Ximian patches are applied). So I cheated. Using batch actions in Photoshop, I created fill layers for all of the dark portions of alpha channels in each file, fill layers with the standard OOo grey style masking color (c0c0c0, i think...I just eyedroppered it off of another icon image). Then I proceeded to remove the alpha channel, change the format to Indexed color, and saved it as an 8 bit per channel BMP file.
Note that there are some files that are Grayscale, and some files that do not have alpha channels. This causes photoshop's Actions to get unwieldy, so I would up having to do three batch runs actually with some doing different bit depth conversions, some removing alpha channels that actually didn't contain any information (causing creation of the fill layer to fail), and others doing bit depth conversion on files that originally had no alpha channels.
-- Resizing bogus icons:
The process of constructing res files is a bit awkward...the "bmp" program is actually used to create an "ImageList". Basically, in the .srs file (created from .src, IIRC) is a list of all of the icon IDs of bitmap files referenced in toolbars, menus, etc. The bmp program gloms all of these individual icons into one single really wide image.
For this really wide single image to be created properly, all of the source bitmaps for that image must have the same height, width, and bit depth (though I hacked bmp to scale up all source images to 24 bit RGB since I didn't feel like figuring out how to convert all of the OOo icons that aren't covered by Ximian).
The main problem is that the Ximian icons are generally 16x16 or 24x24, reasonable sizes. Not all of the OOo icons are that size, and some of them are different sizes. Thankfully in the Ximian build library there's a script "scale-icons" that is a shell script that uses the ImageMagick "convert" command line tool to crop all of the unwieldy size pics. Had I known about these command line tools earlier, I may have been able to skip using photoshop for the first big part and just came up with another unholy use for "find".
-- Fixing OOo:
The BMP writing streams in OOo can't properly export 32 bit images...they mistakenly put information in the alpha channel even when unpatched OOo bitmaps don't have alpha channel info. Basically, for every 32 bit stride the OOo code used to write 24. This was fun to track down in Neo since visually it isn't really clear that the problem is inside of the ImageList generation during compile instead of in the actual bitmap drawing code.
Getting the icons into OOo was easiest done as: get standard icon set, run the resize script from the above, copy in massaged Ximian icons to proper locations in the source tree.
So now I'm at the point where I'm compiling the full Neo tree with all the new bitmaps. I got it working for Draw, and the toolbars looked a lot better, so I hope the process above works everywhere. They're still not Cocoa icons, but until they can be redesigned in a more photorealistic fashion they are a heck of a lot less cheesy then the old Win95 look against an Aqua background
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum