From: Mike Williams on
"Larry Serflaten" <serflaten(a)gmail.com> wrote in message
news:i1ds1d$a12$1(a)news.eternal-september.org...

> nar�cis�sism - noun
> 1.inordinate fascination with oneself; excessive self-love; vanity.

Yes, I know what narcissism means, Larry. There is no need for you to post
an extract from the dictionary in order to imply that you know what it means
but others do not. Your superiority complex is showing ;-)

Mike




From: Kevin Provance on

"Larry Serflaten" <serflaten(a)gmail.com> wrote in message
news:i1ds1d$a12$1(a)news.eternal-september.org...
:
: nar7cis7sism - noun
: 1.inordinate fascination with oneself; excessive self-love; vanity.
: 2.Psychoanalysis. erotic gratification derived from admiration of one's
: own physical or mental attributes, being a normal condition at the
: infantile level of personality development.


O_o

Dayum, that's my ex-wife to a bloody T.

Now I have something else to taunt her with. Thanks! <g>


--
Customer Hatred Knows No Bounds at MSFT
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc

Bawwk! Paulie want a dingleball, bawwk!

From: Mike Williams on
"Larry Serflaten" <serflaten(a)gmail.com> wrote in message
news:i1ds1d$a12$1(a)news.eternal-september.org...

> Are you not quite all grown up yet Mike?

Yes, I'm all grown up Larry. When do you plan on growing up?

Mike




From: Ulrich Korndoerfer on
Hi,

Mike Williams schrieb:

> ...
> Full colour 24 bit Bitmaps that occupy an /exact/ multiple of 4KB of DIB
> data are in fact quite common (1024 x 768, 2048 x 1536, 3072 x 2304 and 3200
> x 2400 and some others are all fairly common bitmap sizes that fall into
> this category) and Ulrich's code, as it stands, will crash on all of those
> bitmaps.
> ...

I did some rework of my code. It does not crash on those sizes. I have
setup a test project, available under

<http://www.prosource.de/Temp/CountUniqueColors.zip>

This tester allows to time and test your version and three of my
versions (in module MFinal). Just double click anywhere in the window to
start a test. For a new picture file just drag and drop a file from
Explorer anywhere on the window.

My three versions use different access methods. gUniqueColorCountFromDIB
has complicated code and is as fast as your version,
gUniqueColorCountFromDIB1 has less complicated code and is a bit slower,
gUniqueColorCountFromDIBByte has easy code and is nearly as fast as
gUniqueColorCountFromDIB.

gUniqueColorCountFromDIB andgUniqueColorCountFromDIB1 both can treat the
last pixel problem. There is a compilation constant
(LASTPIXELSPECIALTREATMENT) in MFinal, which switches special treatment
of the last pixel on or off. When off, for the sizes you mentioned
above, the code does access a byte that lies outside the memory occupied
by the DIB data, but does not crash.

BTW, your code counts wrong on bitmaps having a width of either 1, 2 or
3 pixels. And, when run in the IDE, would most probably crash on a
system with more than 2 GB process memory.

--
Ulrich Korndoerfer

VB tips, helpers, solutions -> http://www.prosource.de/Downloads/
MS Newsgruppen Alternativen -> http://www.prosource.de/ms-ng-umzug.html
From: Ulrich Korndoerfer on
Hi,

sorry for replying so late.

charles schrieb:

> ...
> Thanks Ulrich. That's almost as fast as Mike's code so it should be
> quite useful. There is one little problem with your code though in
> that it crashes on some bitmaps and I get the "Send Error Report to
> Microsoft" message box. Any idea what might be causing that?
> ...

No. I reworked my code a little bit. You can download a test project from

<http://www.prosource.de/Temp/CountUniqueColors.zip>

See also my reply to Mike. My code versions now can be switched to treat
the access to the last pixel problem or not, which was suspected by Mike
that this could cause a crash due to a memory access violation. However
I can not replicate it.

You could test it on your own machine, with your own pixels. Just set in
module MFinal the compilation constant (LASTPIXELSPECIALTREATMENT) to 1
(then the last pixel is accessed in a special way to not exceed the
memory needed for the bitmap pixel data) or to 0 (then no special
measures are taken). Then run it in the IDE and also compile it and run
compiled too. I would be interseted if you then still see crashes.

BTW, there are 3 versions of mine to demonstrate, that complex code may
often give some speed gains, but also often not so much that it is worth
to fiddle around. The straight forward and simple version
gUniqueColorCountFromDIBByte is nearly as fast as the most complicated one.

--
Ulrich Korndoerfer

VB tips, helpers, solutions -> http://www.prosource.de/Downloads/
MS Newsgruppen Alternativen -> http://www.prosource.de/ms-ng-umzug.html