Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Uniquely identifying Images from Resource files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sean Aitken - 20 Jun 2007 16:06 GMT
Good morning,

Does anyone know of a way to extract a unique hashcode or identifier
from an Image that comes from a typed Resource file? I am trying to
optimize a routine that takes the actual image object itself.
Currently, the Equals operator seems to compare the image pixel for
pixel to determine equality. This VERY slow!  Maybe just a way to
compare references would be nice.. (Since the Image exposed from the
Resource file exists as a single reference).

Ultimately, I would like a way to map these ID's to the actual image
itself (ultimately mapping unique instances to an ImageList).

Any pointers? have I confused everyone?
:)

Thanks!
-Sean
Kevin Spencer - 21 Jun 2007 14:16 GMT
The only way to be sure that 2 images are identical is to compare them pixel
by pixel.This is because 2 images may have all the same characteristics
otherwise, but still have different pixel values.

And yes, I do have a "pointer" - use pointers to compare the images. Here's
an excellent article on the subject:

http://www.bobpowell.net/lockingbits.htm

Signature

HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

> Good morning,
>
[quoted text clipped - 14 lines]
> Thanks!
> -Sean
Sean Aitken - 27 Jun 2007 16:24 GMT
Thanks, Kevin!

Reflecting into the Image class I see no override on the GetHashcode
method...  so I can't use GetHashcode. I'll take a look at using the
pointer to compare. For the situation I'm in (and to stay away from
the unmanaged business), I think I'm going to create a dictionary of
keys to images that can be used for specifying images in my list.

Cheers!
-Sean

> The only way to be sure that 2 images are identical is to compare them pixel
> by pixel.This is because 2 images may have all the same characteristics
[quoted text clipped - 34 lines]
> > Thanks!
> > -Sean

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.