cdocutils.nodes document q)q}q(U nametypesq}q(Xpixel componentsqNX metafunctionsqNXoverviewqNXpacked and bit-aligned imagesq NXhomogeneous memory-based imagesq NX(deriving and manipulating existing typesq NX type traitsq NUcontentsq NXiterators and viewsqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUpixel-componentsqhU metafunctionsqhUoverviewqh Upacked-and-bit-aligned-imagesqh Uhomogeneous-memory-based-imagesqh U(deriving-and-manipulating-existing-typesqh U type-traitsqh UcontentsqhUiterators-and-viewsq uUchildrenq!]q"cdocutils.nodes section q#)q$}q%(U rawsourceq&UUparentq'hUsourceq(X3/root/project/libs/gil/doc/design/metafunctions.rstq)Utagnameq*Usectionq+U attributesq,}q-(Udupnamesq.]Uclassesq/]Ubackrefsq0]Uidsq1]q2haUnamesq3]q4hauUlineq5KUdocumentq6hh!]q7(cdocutils.nodes title q8)q9}q:(h&X Metafunctionsq;h'h$h(h)h*Utitleqcdocutils.nodes Text q?X Metafunctionsq@qA}qB(h&h;h'h9ubaubcdocutils.nodes topic qC)qD}qE(h&Uh'h$h(h)h*UtopicqFh,}qG(h.]h/]qH(UcontentsqIUlocalqJeh0]h1]qKhah3]qLh auh5Kh6hh!]qMcdocutils.nodes bullet_list qN)qO}qP(h&Uh'hDh(Nh*U bullet_listqQh,}qR(h.]h/]h0]h1]h3]uh5Nh6hh!]qS(cdocutils.nodes list_item qT)qU}qV(h&Uh,}qW(h.]h/]h0]h1]h3]uh'hOh!]qXcdocutils.nodes paragraph qY)qZ}q[(h&Uh,}q\(h.]h/]h0]h1]h3]uh'hUh!]q]cdocutils.nodes reference q^)q_}q`(h&Uh,}qa(h1]qbUid1qcah0]h.]h/]h3]Urefidhuh'hZh!]qdh?XOverviewqeqf}qg(h&XOverviewqhh'h_ubah*U referenceqiubah*U paragraphqjubah*U list_itemqkubhT)ql}qm(h&Uh,}qn(h.]h/]h0]h1]h3]uh'hOh!]qohY)qp}qq(h&Uh,}qr(h.]h/]h0]h1]h3]uh'hlh!]qsh^)qt}qu(h&Uh,}qv(h1]qwUid2qxah0]h.]h/]h3]Urefidhuh'hph!]qyh?XHomogeneous memory-based imagesqzq{}q|(h&XHomogeneous memory-based imagesq}h'htubah*hiubah*hjubah*hkubhT)q~}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hOh!]qhY)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'h~h!]qh^)q}q(h&Uh,}q(h1]qUid3qah0]h.]h/]h3]Urefidhuh'hh!]qh?XPacked and bit-aligned imagesqq}q(h&XPacked and bit-aligned imagesqh'hubah*hiubah*hjubah*hkubhT)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hOh!]qhY)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hh!]qh^)q}q(h&Uh,}q(h1]qUid4qah0]h.]h/]h3]Urefidh uh'hh!]qh?XIterators and viewsqq}q(h&XIterators and viewsqh'hubah*hiubah*hjubah*hkubhT)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hOh!]qhY)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hh!]qh^)q}q(h&Uh,}q(h1]qUid5qah0]h.]h/]h3]Urefidhuh'hh!]qh?XPixel componentsqq}q(h&XPixel componentsqh'hubah*hiubah*hjubah*hkubhT)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hOh!]qhY)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hh!]qh^)q}q(h&Uh,}q(h1]qUid6qah0]h.]h/]h3]Urefidhuh'hh!]qh?X(Deriving and manipulating existing typesq…q}q(h&X(Deriving and manipulating existing typesqh'hubah*hiubah*hjubah*hkubhT)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hOh!]qhY)q}q(h&Uh,}q(h.]h/]h0]h1]h3]uh'hh!]qh^)q}q(h&Uh,}q(h1]qUid7qah0]h.]h/]h3]Urefidhuh'hh!]qh?X Type traitsqԅq}q(h&X Type traitsqh'hubah*hiubah*hjubah*hkubeubaubh#)q}q(h&Uh'h$h(h)h*h+h,}q(h.]h/]h0]h1]qhah3]qhauh5K h6hh!]q(h8)q}q(h&hhh'hh(h)h*h(h.]h/]h0]h1]h3]uh'jh!]r?h?Xrgbar@rA}rB(h&Uh'j<ubah*j$ubh?X. rCrD}rE(h&X. h'jubj )rF}rG(h&X *BitDepth*h,}rH(h.]h/]h0]h1]h3]uh'jh!]rIh?XBitDepthrJrK}rL(h&Uh'jFubah*jubh?X can be, for example, rMrN}rO(h&X can be, for example, h'jubj)rP}rQ(h&X``8``h,}rR(h.]h/]h0]h1]h3]uh'jh!]rSh?X8rT}rU(h&Uh'jPubah*j$ubh?XG,``16``,``32``. By default the bits are unsigned integral type. Append rVrW}rX(h&XG,``16``,``32``. By default the bits are unsigned integral type. Append h'jubj)rY}rZ(h&X``s``h,}r[(h.]h/]h0]h1]h3]uh'jh!]r\h?Xsr]}r^(h&Uh'jYubah*j$ubh?X2 to the bit depth to indicate signed integral, or r_r`}ra(h&X2 to the bit depth to indicate signed integral, or h'jubj)rb}rc(h&X``f``h,}rd(h.]h/]h0]h1]h3]uh'jh!]reh?Xfrf}rg(h&Uh'jbubah*j$ubh?X to indicate floating point. rhri}rj(h&X to indicate floating point. h'jubj)rk}rl(h&X``c``h,}rm(h.]h/]h0]h1]h3]uh'jh!]rnh?Xcro}rp(h&Uh'jkubah*j$ubh?XA indicates object whose associated pixel reference is immutable. rqrr}rs(h&XA indicates object whose associated pixel reference is immutable. h'jubj)rt}ru(h&X ``_planar``h,}rv(h.]h/]h0]h1]h3]uh'jh!]rwh?X_planarrxry}rz(h&Uh'jtubah*j$ubh?X< indicates planar organization (as opposed to interleaved). r{r|}r}(h&X< indicates planar organization (as opposed to interleaved). h'jubj)r~}r(h&X ``_step``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_steprr}r(h&Uh'j~ubah*j$ubh?X+ indicates the type has a dynamic step and rr}r(h&X+ indicates the type has a dynamic step and h'jubj )r}r(h&X *ClassType*h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X ClassTyperr}r(h&Uh'jubah*jubh?X is rr}r(h&X is h'jubj)r}r(h&X ``_image``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_imagerr}r(h&Uh'jubah*j$ubh?X& (image, using a standard allocator), rr}r(h&X& (image, using a standard allocator), h'jubj)r}r(h&X ``_view``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_viewrr}r(h&Uh'jubah*j$ubh?X (image view), rr}r(h&X (image view), h'jubj)r}r(h&X``_loc``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_locrr}r(h&Uh'jubah*j$ubh?X (pixel locator), rr}r(h&X (pixel locator), h'jubj)r}r(h&X``_ptr``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_ptrrr}r(h&Uh'jubah*j$ubh?X (pixel iterator), rr}r(h&X (pixel iterator), h'jubj)r}r(h&X``_ref``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_refrr}r(h&Uh'jubah*j$ubh?X (pixel reference), rr}r(h&X (pixel reference), h'jubj)r}r(h&X ``_pixel``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X_pixelrr}r(h&Uh'jubah*j$ubh?X (pixel value).rr}r(h&X (pixel value).h'jubeubhY)r}r(h&XHere are examples:rh'hh(h)h*hjh,}r(h.]h/]h0]h1]h3]uh5Kh6hh!]rh?XHere are examples:rr}r(h&jh'jubaubh)r}r(h&Xbgr8_image_t i; // 8-bit unsigned (unsigned char) interleaved BGR image cmyk16_pixel_t; x; // 16-bit unsigned (unsigned short) CMYK pixel value; cmyk16sc_planar_ref_t p(x); // const reference to a 16-bit signed integral (signed short) planar CMYK pixel x. rgb32f_planar_step_ptr_t ii; // step iterator to a floating point 32-bit (float) planar RGB pixel.h'hh(h)h*hh,}r(UlinenosrUlanguagerXcpphhh1]h0]h.]Uhighlight_argsr}h/]h3]uh5K!h6hh!]rh?Xbgr8_image_t i; // 8-bit unsigned (unsigned char) interleaved BGR image cmyk16_pixel_t; x; // 16-bit unsigned (unsigned short) CMYK pixel value; cmyk16sc_planar_ref_t p(x); // const reference to a 16-bit signed integral (signed short) planar CMYK pixel x. rgb32f_planar_step_ptr_t ii; // step iterator to a floating point 32-bit (float) planar RGB pixel.rr}r(h&Uh'jubaubeubh#)r}r(h&Uh'h$h(h)h*h+h,}r(h.]h/]h0]h1]rhah3]rh auh5K)h6hh!]r(h8)r}r(h&h}h'jh(h)h*h struct pixel_reference_type { typedef ... type; }; template struct pixel_value_type { typedef ... type; }; template struct iterator_type { typedef ... type; }; template struct locator_type { typedef ... type; }; template struct view_type { typedef ... type; }; template > struct image_type { typedef ... type; }; template > struct packed_image_type { typedef ... type; }; template > struct bit_aligned_image_type { typedef ... type; };h'jh(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5K0h6hh!]rh?Xtemplate struct pixel_reference_type { typedef ... type; }; template struct pixel_value_type { typedef ... type; }; template struct iterator_type { typedef ... type; }; template struct locator_type { typedef ... type; }; template struct view_type { typedef ... type; }; template > struct image_type { typedef ... type; }; template > struct packed_image_type { typedef ... type; }; template > struct bit_aligned_image_type { typedef ... type; };rr}r(h&Uh'jubaubeubh#)r}r(h&Uh'h$h(h)h*h+h,}r(h.]h/]h0]h1]rhah3]rh auh5KKh6hh!]r(h8)r}r(h&hh'jh(h)h*h > struct packed_image1_type { typedef ... type; }; template > struct packed_image2_type { typedef ... type; }; template > struct packed_image3_type { typedef ... type; }; template > struct packed_image4_type { typedef ... type; }; template > struct packed_image5_type { typedef ... type; }; template > struct bit_aligned_image1_type { typedef ... type; }; template > struct bit_aligned_image2_type { typedef ... type; }; template > struct bit_aligned_image3_type { typedef ... type; }; template > struct bit_aligned_image4_type { typedef ... type; }; template > struct bit_aligned_image5_type { typedef ... type; };h'jh(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5KPh6hh!]rh?X~template > struct packed_image1_type { typedef ... type; }; template > struct packed_image2_type { typedef ... type; }; template > struct packed_image3_type { typedef ... type; }; template > struct packed_image4_type { typedef ... type; }; template > struct packed_image5_type { typedef ... type; }; template > struct bit_aligned_image1_type { typedef ... type; }; template > struct bit_aligned_image2_type { typedef ... type; }; template > struct bit_aligned_image3_type { typedef ... type; }; template > struct bit_aligned_image4_type { typedef ... type; }; template > struct bit_aligned_image5_type { typedef ... type; };rr}r(h&Uh'jubaubeubh#)r}r(h&Uh'h$h(h)h*h+h,}r(h.]h/]h0]h1]rh ah3]rhauh5K{h6hh!]r(h8)r}r(h&hh'jh(h)h*h}r?(h&X. We don't need h'j%ubj)r@}rA(h&X ``IsYStep``h,}rB(h.]h/]h0]h1]h3]uh'j%h!]rCh?XIsYSteprDrE}rF(h&Uh'j@ubah*j$ubh?X because GIL's memory-based locator and view already allow the vertical step to be specified dynamically. Iterators and views can be constructed from a pixel type:rGrH}rI(h&X because GIL's memory-based locator and view already allow the vertical step to be specified dynamically. Iterators and views can be constructed from a pixel type:h'j%ubeubh)rJ}rK(h&Xtemplate struct iterator_type_from_pixel { typedef ... type; }; template struct view_type_from_pixel { typedef ... type; };h'jh(h)h*hh,}rL(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]rMh?Xtemplate struct iterator_type_from_pixel { typedef ... type; }; template struct view_type_from_pixel { typedef ... type; };rNrO}rP(h&Uh'jJubaubhY)rQ}rR(h&XUsing a heterogeneous pixel type will result in heterogeneous iterators and views. Types can also be constructed from horizontal iterator:rSh'jh(h)h*hjh,}rT(h.]h/]h0]h1]h3]uh5Kh6hh!]rUh?XUsing a heterogeneous pixel type will result in heterogeneous iterators and views. Types can also be constructed from horizontal iterator:rVrW}rX(h&jSh'jQubaubh)rY}rZ(h&Xtemplate struct type_from_x_iterator { typedef ... step_iterator_t; typedef ... xy_locator_t; typedef ... view_t; };h'jh(h)h*hh,}r[(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]r\h?Xtemplate struct type_from_x_iterator { typedef ... step_iterator_t; typedef ... xy_locator_t; typedef ... view_t; };r]r^}r_(h&Uh'jYubaubeubh#)r`}ra(h&Uh'h$h(h)h*h+h,}rb(h.]h/]h0]h1]rchah3]rdhauh5Kh6hh!]re(h8)rf}rg(h&hh'j`h(h)h*h struct color_space_type { typedef ... type; }; template struct channel_mapping_type { typedef ... type; }; template struct is_planar { typedef ... type; }; // Defined by homogeneous constructs template struct channel_type { typedef ... type; }; template struct num_channels { typedef ... type; };h'j`h(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]rh?Xstemplate struct color_space_type { typedef ... type; }; template struct channel_mapping_type { typedef ... type; }; template struct is_planar { typedef ... type; }; // Defined by homogeneous constructs template struct channel_type { typedef ... type; }; template struct num_channels { typedef ... type; };rr}r(h&Uh'jubaubeubh#)r}r(h&Uh'h$h(h)h*h+h,}r(h.]h/]h0]h1]rhah3]rh auh5Kh6hh!]r(h8)r}r(h&hh'jh(h)h*h struct derived_pixel_reference_type { typedef ... type; // Models PixelConcept }; template struct derived_iterator_type { typedef ... type; // Models PixelIteratorConcept }; template struct derived_view_type { typedef ... type; // Models ImageViewConcept }; template struct derived_image_type { typedef ... type; // Models ImageConcept };h'jh(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]rh?X$template struct derived_pixel_reference_type { typedef ... type; // Models PixelConcept }; template struct derived_iterator_type { typedef ... type; // Models PixelIteratorConcept }; template struct derived_view_type { typedef ... type; // Models ImageViewConcept }; template struct derived_image_type { typedef ... type; // Models ImageConcept };rr}r(h&Uh'jubaubhY)r}r(h&XYou can replace one or more of its properties and use ``boost::use_default`` for the rest. In this case ``IsPlanar``, ``IsStep`` and ``IsMutable`` are MPL boolean constants. For example, here is how to create the type of a view just like ``View``, but being grayscale and planar:h'jh(h)h*hjh,}r(h.]h/]h0]h1]h3]uh5Kh6hh!]r(h?X6You can replace one or more of its properties and use rr}r(h&X6You can replace one or more of its properties and use h'jubj)r}r(h&X``boost::use_default``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?Xboost::use_defaultrr}r(h&Uh'jubah*j$ubh?X for the rest. In this case rr}r(h&X for the rest. In this case h'jubj)r}r(h&X ``IsPlanar``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?XIsPlanarrr}r(h&Uh'jubah*j$ubh?X, rr}r(h&X, h'jubj)r}r(h&X ``IsStep``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?XIsSteprr}r(h&Uh'jubah*j$ubh?X and rr}r(h&X and h'jubj)r}r(h&X ``IsMutable``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?X IsMutablerr}r(h&Uh'jubah*j$ubh?X\ are MPL boolean constants. For example, here is how to create the type of a view just like rr}r(h&X\ are MPL boolean constants. For example, here is how to create the type of a view just like h'jubj)r}r(h&X``View``h,}r(h.]h/]h0]h1]h3]uh'jh!]rh?XViewrr}r(h&Uh'jubah*j$ubh?X!, but being grayscale and planar:rr}r(h&X!, but being grayscale and planar:h'jubeubh)r}r(h&XZusing VT = typename derived_view_type::type;h'jh(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]rh?XZusing VT = typename derived_view_type::type;rr}r(h&Uh'jubaubeubh#)r}r(h&Uh'h$h(h)h*h+h,}r(h.]h/]h0]h1]rhah3]rh auh5Kh6hh!]r(h8)r}r(h&hh'jh(h)h*h::value == true, "");h'jh(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]rh?X@static_assert(is_planar::value == true, "");rr}r(h&Uh'jubaubhY)r}r(h&X:GIL also supports type analysis metafunctions of the form:r h'jh(h)h*hjh,}r (h.]h/]h0]h1]h3]uh5Kh6hh!]r h?X:GIL also supports type analysis metafunctions of the form:r r }r(h&j h'jubaubh)r}r(h&XM[pixel_reference/iterator/locator/view/image] + "_is_" + [basic/mutable/step]h'jh(h)h*hh,}r(jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]rh?XM[pixel_reference/iterator/locator/view/image] + "_is_" + [basic/mutable/step]rr}r(h&Uh'jubaubhY)r}r(h&X For example:rh'jh(h)h*hjh,}r(h.]h/]h0]h1]h3]uh5Kh6hh!]rh?X For example:rr}r(h&jh'jubaubh)r}r(h&X*if (view_is_mutable::value) { ... }h'jh(h)h*hh,}r (jjXcpphhh1]h0]h.]j}h/]h3]uh5Kh6hh!]r!h?X*if (view_is_mutable::value) { ... }r"r#}r$(h&Uh'jubaubhY)r%}r&(h&X&A *basic* GIL construct is a memory-based construct that uses the built-in GIL classes and does not have any function object to invoke upon dereferencing. For example, a simple planar or interleaved, step or non-step RGB image view is basic, but a color converted view or a virtual view is not.h'jh(h)h*hjh,}r'(h.]h/]h0]h1]h3]uh5Kh6hh!]r((h?XA r)r*}r+(h&XA h'j%ubj )r,}r-(h&X*basic*h,}r.(h.]h/]h0]h1]h3]uh'j%h!]r/h?Xbasicr0r1}r2(h&Uh'j,ubah*jubh?X GIL construct is a memory-based construct that uses the built-in GIL classes and does not have any function object to invoke upon dereferencing. For example, a simple planar or interleaved, step or non-step RGB image view is basic, but a color converted view or a virtual view is not.r3r4}r5(h&X GIL construct is a memory-based construct that uses the built-in GIL classes and does not have any function object to invoke upon dereferencing. For example, a simple planar or interleaved, step or non-step RGB image view is basic, but a color converted view or a virtual view is not.h'j%ubeubeubeubah&UU transformerr6NU footnote_refsr7}r8Urefnamesr9}r:Usymbol_footnotesr;]r<Uautofootnote_refsr=]r>Usymbol_footnote_refsr?]r@U citationsrA]rBh6hU current_linerCNUtransform_messagesrD]rEUreporterrFNUid_startrGKU autofootnotesrH]rIU citation_refsrJ}rKUindirect_targetsrL]rMUsettingsrN(cdocutils.frontend Values rOorP}rQ(Ufootnote_backlinksrRKUrecord_dependenciesrSNU rfc_base_urlrTUhttps://tools.ietf.org/html/rUU tracebackrVUpep_referencesrWNUstrip_commentsrXNU toc_backlinksrYUentryrZU language_coder[Uenr\U datestampr]NU report_levelr^KU _destinationr_NU halt_levelr`KU strip_classesraNh