10 #ifndef KJB_CPP_PIXEL_H
11 #define KJB_CPP_PIXEL_H
13 #include <l/l_sys_std.h>
14 #include <l/l_debug.h>
16 #include <i/i_float.h>
81 extra.alpha = p.extra.alpha;
93 PixelRGBA(
float rr,
float gg,
float bb,
float aa = 255.0f )
131 KJB(UNTESTED_CODE());
159 KJB(UNTESTED_CODE());
186 KJB(UNTESTED_CODE());
198 KJB(UNTESTED_CODE());
202 extra.alpha = floorf( extra.alpha );
211 KJB(UNTESTED_CODE());
228 extra.alpha += p.extra.alpha;
258 extra.alpha *= p.extra.alpha;
284 KJB(UNTESTED_CODE());
285 return r==p.r && g==p.g && b==p.b && extra.alpha==p.extra.alpha;
295 KJB(UNTESTED_CODE());
354 kjb_c::Pixel
abs(
const kjb_c::Pixel& p)
370 std::ostringstream trip;
371 trip <<
"#" << std::hex << std::setfill(
'0')
372 << std::setw(2) << int(q.r)
373 << std::setw(2) << int(q.g)
374 << std::setw(2) << int(q.b);
PixelRGBA(float rr, float gg, float bb, float aa=255.0f)
This builds a valid pixel with given values for color channels.
Definition: i_pixel.h:93
PixelRGBA & operator*=(float k)
Overwrite a pixel by scaling its value (r, g, b, and alpha too)
Definition: i_pixel.h:267
Int_matrix::Value_type max(const Int_matrix &mat)
Return the maximum value in this matrix.
Definition: l_int_matrix.h:1397
PixelRGBA floor() const
Return new pixel with integer channel values.
Definition: i_pixel.h:209
PixelRGBA operator+(const kjb_c::Pixel &p) const
This will add corresponding channels, creating a new pixel.
Definition: i_pixel.h:237
#define KJB(x)
Definition: l_util.h:9
for k
Definition: APPgetLargeConnectedEdges.m:61
r
Definition: APPgetLargeConnectedEdges.m:127
PixelRGBA & operator+=(const kjb_c::Pixel &p)
Adds another pixel (channel-wise) to this pixel, overwriting.
Definition: i_pixel.h:222
bool operator!=(const kjb_c::Pixel &p) const
Test for ANY pixel inequality in any channel.
Definition: i_pixel.h:293
PixelRGBA()
Default ctor, which leaves all fields uninitialized.
Definition: i_pixel.h:63
std::string as_hex_triplet() const
express RGB values in an HTML-style string
Definition: i_pixel.h:300
kjb_c::Pixel abs(const kjb_c::Pixel &p)
Take the channel-wise absolute value of a kjb_c::Pixel.
Definition: i_pixel.h:354
PixelRGBA & ow_clamp(float minval, float maxval)
Clamp all channels to a specified range, overwriting.
Definition: i_pixel.h:157
PixelRGBA clamp() const
Return a new pixel with all channels clamped to range 0..255.
Definition: i_pixel.h:173
PixelRGBA(const kjb_c::Pixel &p)
This builds a valid pixel from another.
Definition: i_pixel.h:75
Wrapped version of the C struct Pixel, with Alpha (opacity).
Definition: i_pixel.h:57
static void ow_clamp_channel(float *chan)
Clamp one channel of the Pixel to the range 0..255 inclusive.
Definition: i_pixel.h:119
sum(zmx.*zmy) sum(zmy.^2)]
PixelRGBA & operator*=(const PixelRGBA &p)
Overwrite a pixel by multiplying it by p.
Definition: i_pixel.h:252
Int_matrix::Value_type min(const Int_matrix &mat)
Return the minimum value in this matrix.
Definition: l_int_matrix.h:1385
PixelRGBA & ow_clamp()
Clamp all channels of the pixel to the range 0..255 inclusive.
Definition: i_pixel.h:143
PixelRGBA clamp(float minval, float maxval) const
Return a new pixel with all channels clamped; non-overwriting.
Definition: i_pixel.h:184
std::string pixel_as_hex_triplet_string(const kjb_c::Pixel *)
express color as HTML-style hex triplet, e.g., "#FFCC00," of pointer
Definition: i_pixel.h:366
static PixelRGBA create_gray(float f)
A "named constructor" to build a single opaque grayscale pixel.
Definition: i_pixel.h:104
static void ow_clamp_channel(float *chan, float minval, float maxval)
Clamp one channel to a specified range.
Definition: i_pixel.h:129
Gsl_Vector operator*(double scalar, const Gsl_Vector &vector)
multiply scalar and vector, scalar written on the left side
Definition: gsl_vector.h:661
PixelRGBA & ow_floor()
Truncate pixel channel values to integers; overwriting.
Definition: i_pixel.h:196
bool operator==(const kjb_c::Pixel &p) const
Test for EXACT pixel equality in all channels.
Definition: i_pixel.h:282