Click here to Skip to main content
15,913,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 0:58
George_George9-Oct-08 0:58 
GeneralRe: different result on x86 and x64 Pin
CPallini9-Oct-08 1:01
mveCPallini9-Oct-08 1:01 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 1:08
George_George9-Oct-08 1:08 
GeneralRe: different result on x86 and x64 Pin
gscotti9-Oct-08 4:47
gscotti9-Oct-08 4:47 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 18:41
George_George9-Oct-08 18:41 
AnswerRe: different result on x86 and x64 Pin
Chris Losinger9-Oct-08 9:17
professionalChris Losinger9-Oct-08 9:17 
GeneralRe: different result on x86 and x64 Pin
George_George9-Oct-08 18:42
George_George9-Oct-08 18:42 
QuestionBluebox - Chromakey etc Pin
Pixinger778-Oct-08 20:17
Pixinger778-Oct-08 20:17 
Hello

I'm looking for a fast way to scan a buffer and check if a pixel color is between a color range, or not.
Maybe some code explains it better:
I have a buffer with 32Bits per Pixel (RGBA => R=8Bit, G=8Bit, B=8Bit, A=8Bit => 32Bit).
This buffer is... let's say 200x200 pixels.

// Defining color ranges
char redUpper = 100;
char redLower = 50;
char greenUpper = 150;
char greenLower = 130;
char blueUpper = 20;
char blueLower = 10;

//creating my pixel buffer
int* pBuffer = new int[200*200];
fillBufferWithData(pBuffer, 200*200); //some magic function the gets the image data into the buffer.

//analysing
char* pCursor = (char*)pBuffer;
for (int i = 0; i < 200*200; i++)
{
  //Every Pixel that is between the color range...
  if ((pCursor[0] > redLower) && (pCursor[0] < redUpper)
   && (pCursor[1] > greenLower) && (pCursor[1] < greenUpper)
   && (pCursor[2] > blueLower) && (pCursor[2] < blueUpper))
  {
    pCursor[3] = 0;
  }
  else
  {
    pCursor[3] = 255
  }

  pCursor += 4;
}
delete [] pBuffer;


Okay. I hope that helps to understand what i want to do. I know thats not the fastest way (at least I hope so). Maybe someone knows a better way, perhaps with bit-shifting, or bit-masking?

Thanks in advance,
SnowProg
AnswerRe: Bluebox - Chromakey etc Pin
CPallini8-Oct-08 22:05
mveCPallini8-Oct-08 22:05 
Questionusing x86 Windbg on x64 machine Pin
George_George8-Oct-08 19:49
George_George8-Oct-08 19:49 
Questionprohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 19:12
ani_ikram8-Oct-08 19:12 
AnswerRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 19:22
Naveen8-Oct-08 19:22 
GeneralRe: prohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 19:29
ani_ikram8-Oct-08 19:29 
GeneralRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 19:34
Naveen8-Oct-08 19:34 
GeneralRe: prohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 19:36
ani_ikram8-Oct-08 19:36 
GeneralRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 19:45
Naveen8-Oct-08 19:45 
GeneralRe: prohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 20:02
ani_ikram8-Oct-08 20:02 
GeneralRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 20:06
Naveen8-Oct-08 20:06 
GeneralRe: prohbit shift key in edit box............ Pin
ani_ikram8-Oct-08 20:08
ani_ikram8-Oct-08 20:08 
GeneralRe: prohbit shift key in edit box............ Pin
Naveen8-Oct-08 20:09
Naveen8-Oct-08 20:09 
GeneralRe: prohbit shift key in edit box............ Pin
Cedric Moonen8-Oct-08 20:13
Cedric Moonen8-Oct-08 20:13 
GeneralRe: prohbit shift key in edit box............ Pin
SandipG 8-Oct-08 19:38
SandipG 8-Oct-08 19:38 
GeneralRe: prohbit shift key in edit box............ Pin
Le@rner8-Oct-08 20:10
Le@rner8-Oct-08 20:10 
GeneralRe: prohbit shift key in edit box............ Pin
Le@rner8-Oct-08 20:16
Le@rner8-Oct-08 20:16 
QuestionRe: prohbit shift key in edit box............ Pin
David Crow9-Oct-08 3:05
David Crow9-Oct-08 3:05 

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.