assign_pixel
assign_pixel()は、任意のピクセルタイプを別のピクセルタイプに割り当てることができるテンプレート関数です。割り当てを機能させるために必要な変換はすべて実行されます。(例:カラーからグレースケールへの変換)
#include <dlib / pixel.h>
template < typename P1, typename P2 > inline void assign_pixel ( P1& dest, const P2& src ); /*! requires - pixel_traits<P1> must be defined - pixel_traits<P2> must be defined ensures - if (P1 and P2 are the same type of pixel) then - simply copies the value of src into dest. In other words, dest will be identical to src after this function returns. - else if (P1 and P2 are not the same type of pixel) then - assigns pixel src to pixel dest and does any necessary color space conversions. - When converting from a grayscale color space with more than 255 values the pixel intensity is saturated at pixel_traits<P1>::max() or pixel_traits<P1>::min() as appropriate. - if (the dest pixel has an alpha channel and the src pixel doesn't) then - #dest.alpha == 255 - else if (the src pixel has an alpha channel but the dest pixel doesn't) then - #dest == the original dest value blended with the src value according to the alpha channel in src. (i.e. #dest == src*(alpha/255) + dest*(1-alpha/255)) !*/