Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: More than one Client !!!! Pin
SeMartens9-Sep-09 3:30
SeMartens9-Sep-09 3:30 
AnswerRe: More than one Client !!!! Pin
April Fans22-Sep-09 17:28
April Fans22-Sep-09 17:28 
QuestionNetwork Scanner Pin
deviao9-Sep-09 2:21
deviao9-Sep-09 2:21 
AnswerRe: Network Scanner Pin
Richard MacCutchan9-Sep-09 3:10
mveRichard MacCutchan9-Sep-09 3:10 
QuestionBinarySearch checks same element Pin
Caio19859-Sep-09 1:22
Caio19859-Sep-09 1:22 
AnswerRe: BinarySearch checks same element Pin
Luc Pattyn9-Sep-09 1:30
sitebuilderLuc Pattyn9-Sep-09 1:30 
GeneralRe: BinarySearch checks same element Pin
Caio19859-Sep-09 1:49
Caio19859-Sep-09 1:49 
GeneralRe: BinarySearch checks same element Pin
Luc Pattyn9-Sep-09 2:11
sitebuilderLuc Pattyn9-Sep-09 2:11 
OK, some comments:

1.
a general GDI+ image does not have a pallette, each pixel has ARGB values, typically 32-bit in total, and those can take any value. Your image source may be encoded by color index (e.g. 8-bit pallette) but AFAIK that is lost when the image gets loaded into an Image/Bitmap instance.

2.
with two arrays, their size would have to be the size (area) of the input image, that could be rather large. And you would have to implement your own sort algorithm to keep both arrays in sync.

3.
I would consider using a single Dictionary<Color,int> where the key is the pixel color and the value is the multiplicity. So the code to add a pixel would be: if already in dictionary increment value, else insert with value=1. Performing this on a megapixel image will be a slow operation!
BTW: make sure you allocate the dictionary with a well chosen initial capacity, I would pick image area divided by say 4 to avoid dictionary growth which would reallocate and copy all current data.

Smile | :)

Luc Pattyn

Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


GeneralRe: BinarySearch checks same element Pin
Caio19859-Sep-09 3:03
Caio19859-Sep-09 3:03 
GeneralRe: BinarySearch checks same element Pin
Caio19859-Sep-09 4:16
Caio19859-Sep-09 4:16 
GeneralRe: BinarySearch checks same element Pin
Luc Pattyn9-Sep-09 10:24
sitebuilderLuc Pattyn9-Sep-09 10:24 
QuestionWhere to POST? Pin
Jacobb Michael9-Sep-09 0:43
Jacobb Michael9-Sep-09 0:43 
QuestionDeveloping messenger Pin
Xmen Real 9-Sep-09 0:40
professional Xmen Real 9-Sep-09 0:40 
GeneralRe: Developing messenger Pin
CoderForEver9-Sep-09 23:45
CoderForEver9-Sep-09 23:45 
Questionobtain Ram and Monitor features Pin
moein.serpico9-Sep-09 0:33
moein.serpico9-Sep-09 0:33 
AnswerRe: obtain Ram and Monitor features Pin
Eddy Vluggen9-Sep-09 0:52
professionalEddy Vluggen9-Sep-09 0:52 
GeneralRe: obtain Ram and Monitor features Pin
moein.serpico9-Sep-09 4:17
moein.serpico9-Sep-09 4:17 
GeneralRe: obtain Ram and Monitor features Pin
OriginalGriff9-Sep-09 4:30
mveOriginalGriff9-Sep-09 4:30 
AnswerRe: obtain Ram and Monitor features Pin
Nuri Ismail9-Sep-09 0:55
Nuri Ismail9-Sep-09 0:55 
Questionxml file vs .config Pin
humayunlalzad9-Sep-09 0:02
humayunlalzad9-Sep-09 0:02 
AnswerRe: xml file vs .config Pin
Arun Jacob9-Sep-09 0:06
Arun Jacob9-Sep-09 0:06 
AnswerRe: xml file vs .config Pin
PIEBALDconsult9-Sep-09 6:43
mvePIEBALDconsult9-Sep-09 6:43 
AnswerRe: xml file vs .config Pin
vivasaayi11-Sep-09 1:00
vivasaayi11-Sep-09 1:00 
QuestionNetwork usage [modified] Pin
Jacobb Michael8-Sep-09 23:25
Jacobb Michael8-Sep-09 23:25 
AnswerRe: Network usage Pin
Dave Kreskowiak9-Sep-09 6:41
mveDave Kreskowiak9-Sep-09 6:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.