Back to index

lightning-sunbird  0.9+nobinonly
Defines | Typedefs | Functions | Variables
nsColor.h File Reference
#include "gfxCore.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NS_RGB(_r, _g, _b)   ((nscolor) ((255 << 24) | ((_b)<<16) | ((_g)<<8) | (_r)))
#define NS_RGBA(_r, _g, _b, _a)   ((nscolor) (((_a) << 24) | ((_b)<<16) | ((_g)<<8) | (_r)))
#define NS_GET_R(_rgba)   ((PRUint8) ((_rgba) & 0xff))
#define NS_GET_G(_rgba)   ((PRUint8) (((_rgba) >> 8) & 0xff))
#define NS_GET_B(_rgba)   ((PRUint8) (((_rgba) >> 16) & 0xff))
#define NS_GET_A(_rgba)   ((PRUint8) (((_rgba) >> 24) & 0xff))
#define FAST_DIVIDE_BY_255(target, v)
#define MOZ_BLEND(target, bg, fg, alpha)   FAST_DIVIDE_BY_255(target, (bg)*(255-(alpha)) + (fg)*(alpha))

Typedefs

typedef PRUint32 nscolor

Functions

 NS_GFX_ (PRBool) NS_HexToRGB(const nsString &aBuf
 NS_GFX_ (nscolor) NS_ComposeColors(nscolor aBG
 NS_GFX_ (void) NS_RGBToHex(nscolor aColor

Variables

nscoloraResult
nscolor aFG
float s
float float l

Define Documentation

Value:
PR_BEGIN_MACRO                                   \
    unsigned tmp_ = v;                             \
    target = ((tmp_ << 8) + tmp_ + 255) >> 16;     \
  PR_END_MACRO

Definition at line 73 of file nsColor.h.

#define MOZ_BLEND (   target,
  bg,
  fg,
  alpha 
)    FAST_DIVIDE_BY_255(target, (bg)*(255-(alpha)) + (fg)*(alpha))

Definition at line 82 of file nsColor.h.

#define NS_GET_A (   _rgba)    ((PRUint8) (((_rgba) >> 24) & 0xff))

Definition at line 65 of file nsColor.h.

#define NS_GET_B (   _rgba)    ((PRUint8) (((_rgba) >> 16) & 0xff))

Definition at line 64 of file nsColor.h.

#define NS_GET_G (   _rgba)    ((PRUint8) (((_rgba) >> 8) & 0xff))

Definition at line 63 of file nsColor.h.

#define NS_GET_R (   _rgba)    ((PRUint8) ((_rgba) & 0xff))

Definition at line 62 of file nsColor.h.

#define NS_RGB (   _r,
  _g,
  _b 
)    ((nscolor) ((255 << 24) | ((_b)<<16) | ((_g)<<8) | (_r)))

Definition at line 53 of file nsColor.h.

#define NS_RGBA (   _r,
  _g,
  _b,
  _a 
)    ((nscolor) (((_a) << 24) | ((_b)<<16) | ((_g)<<8) | (_r)))

Definition at line 58 of file nsColor.h.


Typedef Documentation

typedef PRUint32 nscolor

Definition at line 45 of file nsColor.h.


Function Documentation

NS_GFX_ ( PRBool  ) const

Definition at line 262 of file nsColor.cpp.

{
  PRIntn r, g, b, max;

  r = NS_GET_R(inColor);
  g = NS_GET_G(inColor);
  b = NS_GET_B(inColor);

  //10% of max color decrease across the board
  r -= 25;
  g -= 25;
  b -= 25;

  //figure out which color is largest
  if (r > g)
  {
    if (b > r)
      max = b;
    else
      max = r;
  }
  else
  {
    if (b > g)
      max = b;
    else
      max = g;
  }

  //if we underflowed on this max color, decrease
  //other components by the underflow amount
  if (max < 0)
  {
    if (max == r)
    {
      g += max;
      b += max;
    }
    else if (max == g)
    {
      r += max;
      b += max;
    }
    else
    {
      r += max;
      g += max;
    }
  }

  //clamp
  if (r < 0)
    r = 0;
  if (g < 0)
    g = 0;
  if (b < 0)
    b = 0;

  return NS_RGBA(r, g, b, NS_GET_A(inColor));
}

Here is the call graph for this function:

NS_GFX_ ( void  )

Variable Documentation

Definition at line 95 of file nsColor.h.

Definition at line 88 of file nsColor.h.

float float l

Definition at line 122 of file nsColor.h.

float s

Definition at line 122 of file nsColor.h.