#pragma once

#include "cal3d/global.h"
#include "cal3d/vector.h"


typedef unsigned long CalColor32; // 32-bit integer, compatible with NSPR

inline CalColor32 CalMakeColor(CalVector cv) {
    return
      ( ( unsigned int ) ( cv.z * 0xff ) << 0) +
      ( ( ( unsigned int ) ( cv.y * 0xff ) ) << 8 ) +
      ( ( ( unsigned int ) ( cv.x * 0xff ) ) << 16 ) +
      0xff000000;
}

inline CalVector CalVectorFromColor(CalColor32 color) {
    return CalVector(
        ((color >> 16) & 0xff) / float(0xff),
        ((color >> 8) & 0xff) / float(0xff),
        ((color >> 0) & 0xff) / float(0xff));
}

#pragma once

#include "cal3d/global.h"
#include "cal3d/vector.h"


typedef unsigned int CalColor32; // 32-bit integer, compatible with NSPR

inline CalColor32 CalMakeColor(CalVector cv) {
    return
      ( ( unsigned int ) ( cv.z * 0xff ) << 0) +
      ( ( ( unsigned int ) ( cv.y * 0xff ) ) << 8 ) +
      ( ( ( unsigned int ) ( cv.x * 0xff ) ) << 16 ) +
      0xff000000;
}

inline CalVector CalVectorFromColor(CalColor32 color) {
    return CalVector(
        ((color >> 16) & 0xff) / float(0xff),
        ((color >> 8) & 0xff) / float(0xff),
        ((color >> 0) & 0xff) / float(0xff));
}

Unify and simplify a lot of pixomatic code
Unify and simplify a lot of pixomatic code

git-svn-id: febc42a3fd39fb08e5ae2b2182bc5ab0a583559c@51002 07c76cb3-cb09-0410-85de-c24d39f1912e
