Jonathan King wrote:
It seems that if I have an app icon resource created programmatically
with only a double density member, it will be displayed far off center
to the left. I got the same results when creating such an icon in Palm
OS Resource Editor, and just adding a single density member fixed the
problem. To fix the problem, I must add another dummy bitmap before the
actual dummy, so that the first one has correct width, height and
rowBytes values, depth of 1 (I assume my app won't be running on a
monochrome device) with no actual data and whose nextDepthOffset points
to the real dummy. Why is this? Is this a bug?
I ran into this issue a while back.
My theory is the following:
1. According to the rules, it is not a valid bitmap family unless
the first member of the bitmap family is a standard-density
bitmap.
2. Because the first member of the bitmap family is always
standard-density, a valid (and, it just so happens,
efficient...) implementation of BmpGetDimensions()
is to just read the width and height out of the struct
for the first bitmap in the bitmap family.
3. Palm OS actually does the implementation as described in #2.
4. Therefore, when you put some other-density bitmap as the first
member of the family, the implementation doesn't bother to
read its density (or check if it's a bitmap format version
that can even have a density -- earlier versions can't),
and if you have a 20x20 (actual pixels) double-density bitmap,
that should come out as 10x10 in standard density, but it
comes out as 20x20.
So, assuming that the rules really do state that a valid bitmap
family must have a standard-density bitmap as the first member,
then it's NOT a bug. It's not very robust behavior, but it's not
a bug either.
- Logan
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/