


#ifdef DEBUG
cerr << "" << << endl;
#endif




Topic:
         Re: RGB2CMYK?????
  Message:  
         4 of 4 (In response to cinoban)
  Sent:
         Wed, 15 Dec 1999 21:56:42 +0100

  It is a two step process (asuming RGB in the range 0.0 to 1.0) 

  C' = 1.0 - R M' = 1.0 - G
  Y' = 1.0 - B

  K = min(C', min(M', Y')) C = C' - K
  M = M' - K
Y = Y' - K

Note that you can "fudge" K with some function to make image lighter or darker. (In PostScript it
is called the under color removal)








Timing stuff...

int btim = SDL_GetTicks();

//code to time

btim = SDL_GetTicks() -btim;
cerr << "img to screen took " << btim << "s\n";








Float2Int's:

////////////////
int F2I(float fFloat)
{
static int nTemp;
_asm {
	fld fFloat
	fistp nTemp
	mov eax,nTemp
}
}


////////////////
If you are using VC++ you can change the mode by using:

// Anvnd den hr p vc++ (W32 defined), annars en spec. rutin..      
     _controlfp(_RC_CHOP, _MCW_RC);
      
     If you aren't using VC++, there is an asm equivalent to the above but I don't know it. 
     Next, use these two lines of asm to make the conversion: 
      
     _asm fld f
     _asm fistp i


////////////////////
// Rounds a bit different on negatives...

float g_dbl2intChop = 3 * pow(2,51);
      
     inline int Int(double d)
     {
         d -= 0.5;
         d += g_dbl2intChop;
         return *((int*)&d);
     }

///////////////////

// Another 'magic number' float2int convert
     > #define  S  65536.0
     > #define  MAGIC  (((S * S * 16) + (S*.5)) * S)
     > #pragma  inline  float2int;
     > long float2int( float d )
     > {
     >  double dtemp = MAGIC + d;
     >  return (*(long *)&dtemp) - 0x80000000;
     > }

///////////////////

     > >inline int float_to_int(float f)
     > >{
     > > f += 0xC00000;
     > > return *(short int *)&f;
     > >}
     > >
///////////////////
