Panda3D

Loading...
Searching...
No Matches
Macros | Functions | Variables
convert_srgb.h File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

`#include "pandabase.h"`
`#include "luse.h"`
`#include "pnmimage_base.h"`
`#include "convert_srgb.I"`

Go to the source code of this file.

## Macros
#define | encode_sRGB_uchar_sse2 encode_sRGB_uchar
#define | has_sse2_sRGB_encode()

## Functions
EXPCL_PANDA_PNMIMAGE float | decode_sRGB_float (float val)
| Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized float in the range 0-1.
BEGIN_PUBLISH EXPCL_PANDA_PNMIMAGE float | decode_sRGB_float (unsigned char val)
| Decodes the sRGB-encoded unsigned char value to a linearized float in the range 0-1.
EXPCL_PANDA_PNMIMAGE unsigned char | decode_sRGB_uchar (float val)
| Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized unsigned char value.
EXPCL_PANDA_PNMIMAGE unsigned char | decode_sRGB_uchar (unsigned char val)
| Decodes the sRGB-encoded unsigned char value to a linearized unsigned char value.
EXPCL_PANDA_PNMIMAGE float | encode_sRGB_float (float val)
| Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded float in the range 0-1.
EXPCL_PANDA_PNMIMAGE float | encode_sRGB_float (unsigned char val)
| Encodes the linearized unsigned char value to an sRGB-encoded floating- point value in ther range 0-1.
EXPCL_PANDA_PNMIMAGE void | encode_sRGB_uchar (const LColord &from, xel &into)
| Double-precision versions of the above.
EXPCL_PANDA_PNMIMAGE void | encode_sRGB_uchar (const LColord &from, xel &into, xelval &into_alpha)
END_PUBLISH EXPCL_PANDA_PNMIMAGE void | encode_sRGB_uchar (const LColorf &from, xel &into)
| Encodes the linearized floating-point color value an sRGB-encoded xel in the range 0-255.
EXPCL_PANDA_PNMIMAGE void | encode_sRGB_uchar (const LColorf &from, xel &into, xelval &into_alpha)
| Encodes the linearized floating-point color value an sRGB-encoded xel and alpha in the range 0-255.
EXPCL_PANDA_PNMIMAGE unsigned char | encode_sRGB_uchar (float val)
| Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded unsigned char value.
EXPCL_PANDA_PNMIMAGE unsigned char | encode_sRGB_uchar (unsigned char val)
| Encodes the linearized unsigned char value to an sRGB-encoded unsigned char value.

## Variables
EXPCL_PANDA_PNMIMAGE const float | to_linear_float_table [256]
EXPCL_PANDA_PNMIMAGE const unsigned char | to_linear_uchar_table [256]
EXPCL_PANDA_PNMIMAGE const unsigned char | to_srgb8_table [256]

## Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
  rdb

Date
  2014-11-13

Definition in file convert_srgb.h.

## Macro Definition Documentation

## ◆ encode_sRGB_uchar_sse2

#define encode_sRGB_uchar_sse2 encode_sRGB_uchar

Definition at line 67 of file convert_srgb.h.

## ◆ has_sse2_sRGB_encode

#define has_sse2_sRGB_encode | ( |  | ) |

Value:
(false)

Definition at line 68 of file convert_srgb.h.

## Function Documentation

## ◆ decode_sRGB_float() [1/2]

EXPCL_PANDA_PNMIMAGE float decode_sRGB_float | ( | float | val | ) |
| inline

Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized float in the range 0-1.

Inputs outside this range produce invalid results.

Definition at line 27 of file convert_srgb.I.

## ◆ decode_sRGB_float() [2/2]

BEGIN_PUBLISH EXPCL_PANDA_PNMIMAGE float decode_sRGB_float | ( | unsigned char | val | ) |
| inline

Decodes the sRGB-encoded unsigned char value to a linearized float in the range 0-1.

Definition at line 18 of file convert_srgb.I.

Referenced by PNMImage::from_val(), PNMImage::from_val(), and PNMImage::get_xel_a().

## ◆ decode_sRGB_uchar() [1/2]

EXPCL_PANDA_PNMIMAGE unsigned char decode_sRGB_uchar | ( | float | val | ) |
| inline

Decodes the sRGB-encoded floating-point value in the range 0-1 to a linearized unsigned char value.

Inputs outside this range are clamped.

Definition at line 45 of file convert_srgb.I.

## ◆ decode_sRGB_uchar() [2/2]

EXPCL_PANDA_PNMIMAGE unsigned char decode_sRGB_uchar | ( | unsigned char | val | ) |
| inline

Decodes the sRGB-encoded unsigned char value to a linearized unsigned char value.

Definition at line 37 of file convert_srgb.I.

Referenced by PNMImage::set_color_space().

## ◆ encode_sRGB_float() [1/2]

EXPCL_PANDA_PNMIMAGE float encode_sRGB_float | ( | float | val | ) |
| inline

Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded float in the range 0-1.

Inputs outside this range produce invalid results.

Definition at line 69 of file convert_srgb.I.

## ◆ encode_sRGB_float() [2/2]

EXPCL_PANDA_PNMIMAGE float encode_sRGB_float | ( | unsigned char | val | ) |
| inline

Encodes the linearized unsigned char value to an sRGB-encoded floating- point value in ther range 0-1.

Definition at line 56 of file convert_srgb.I.

Referenced by PNMImage::set_xel_a(), PNMImage::to_val(), and PNMImage::to_val().

## ◆ encode_sRGB_uchar() [1/6]

EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar | ( | const LColord & | from,
|  | xel & | into )
| inline

Double-precision versions of the above.

Definition at line 162 of file convert_srgb.I.

References encode_sRGB_uchar().

## ◆ encode_sRGB_uchar() [2/6]

EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar | ( | const LColord & | from,
|  | xel & | into,
|  | xelval & | into_alpha )
| inline

Definition at line 167 of file convert_srgb.I.

## ◆ encode_sRGB_uchar() [3/6]

END_PUBLISH EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar | ( | const LColorf & | color,
|  | xel & | into )
| inline

Encodes the linearized floating-point color value an sRGB-encoded xel in the range 0-255.

When SSE2 support is known at compile time, this automatically uses an optimized version. Otherwise, it does not attempt runtime CPU detection. If you know that SSE2 is supported (ie. if the function has_sse2_sRGB_encode() returns true) you should call encode_sRGB_uchar_sse2 instead.

Definition at line 118 of file convert_srgb.I.

References encode_sRGB_uchar().

## ◆ encode_sRGB_uchar() [4/6]

EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar | ( | const LColorf & | color,
|  | xel & | into,
|  | xelval & | into_alpha )
| inline

Encodes the linearized floating-point color value an sRGB-encoded xel and alpha in the range 0-255.

The alpha value is not sRGB-encoded.

When SSE2 support is known at compile time, this automatically uses an optimized version. Otherwise, it does not attempt runtime CPU detection. If you know that SSE2 is supported (ie. if the function has_sse2_sRGB_encode() returns true) you should call encode_sRGB_uchar_sse2 instead.

Definition at line 142 of file convert_srgb.I.

References encode_sRGB_uchar().

## ◆ encode_sRGB_uchar() [5/6]

EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar | ( | float | val | ) |
| inline

Encodes the linearized floating-point value in the range 0-1 to an sRGB- encoded unsigned char value.

Inputs outside this range are clamped.

When SSE2 support is known at compile time, this automatically uses an optimized version. Otherwise, it does not attempt runtime CPU detection. If you know that SSE2 is supported (ie. if the function has_sse2_sRGB_encode() returns true) you should call encode_sRGB_uchar_sse2 instead.

Definition at line 95 of file convert_srgb.I.

## ◆ encode_sRGB_uchar() [6/6]

EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar | ( | unsigned char | val | ) |
| inline

Encodes the linearized unsigned char value to an sRGB-encoded unsigned char value.

Definition at line 80 of file convert_srgb.I.

Referenced by encode_sRGB_uchar(), encode_sRGB_uchar(), encode_sRGB_uchar(), PNMImage::set_color_space(), PNMImage::set_xel_a(), PNMImage::to_val(), and PNMImage::to_val().

## Variable Documentation

## ◆ to_linear_float_table

EXPCL_PANDA_PNMIMAGE const float to_linear_float_table[256]
| extern

Definition at line 63 of file convert_srgb.cxx.

## ◆ to_linear_uchar_table

EXPCL_PANDA_PNMIMAGE const unsigned char to_linear_uchar_table[256]
| extern

Definition at line 41 of file convert_srgb.cxx.

## ◆ to_srgb8_table

EXPCL_PANDA_PNMIMAGE const unsigned char to_srgb8_table[256]
| extern

Definition at line 18 of file convert_srgb.cxx.