本文整理汇总了C++中GenericImage::HasAlphaChannels方法的典型用法代码示例。如果您正苦于以下问题:C++ GenericImage::HasAlphaChannels方法的具体用法?C++ GenericImage::HasAlphaChannels怎么用?C++ GenericImage::HasAlphaChannels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericImage
的用法示例。
在下文中一共展示了GenericImage::HasAlphaChannels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Apply
static void Apply( GenericImage<P>& image, const CurvesTransformationInstance& instance, bool useLUT = false )
{
int numberOfCurves = 0;
if ( !instance[CurveIndex::RGBK].IsIdentity() )
numberOfCurves = image.NumberOfNominalChannels();
if ( image.IsColor() )
{
for ( int c = 0; c < image.NumberOfNominalChannels(); ++c )
if ( !instance[c].IsIdentity() )
++numberOfCurves;
if ( !instance[CurveIndex::L].IsIdentity() || !instance[CurveIndex::a].IsIdentity() || !instance[CurveIndex::b].IsIdentity() || !instance[CurveIndex::c].IsIdentity() )
++numberOfCurves;
if ( !instance[CurveIndex::H].IsIdentity() || !instance[CurveIndex::S].IsIdentity() )
++numberOfCurves;
}
if ( image.HasAlphaChannels() && !instance[CurveIndex::A].IsIdentity() )
++numberOfCurves;
if ( numberOfCurves == 0 )
{
Console().WriteLn( "<end><cbr><* Identity *>" );
return;
}
size_type N = image.NumberOfPixels();
int numberOfThreads = Thread::NumberOfThreads( N, 256 );
size_type pixelsPerThread = N/numberOfThreads;
image.Status().Initialize( "Curves transformation", numberOfCurves*N );
ThreadData data( image, numberOfCurves*N );
if ( useLUT )
data.lut.Generate( image, instance );
ReferenceArray<CurvesThread<P> > threads;
for ( int i = 0, j = 1; i < numberOfThreads; ++i, ++j )
threads.Add( new CurvesThread<P>( instance, data, image,
i*pixelsPerThread,
(j < numberOfThreads) ? j*pixelsPerThread : N ) );
AbstractImage::RunThreads( threads, data );
threads.Destroy();
image.Status() = data.status;
}