本文整理汇总了C++中CDib::CopyDib方法的典型用法代码示例。如果您正苦于以下问题:C++ CDib::CopyDib方法的具体用法?C++ CDib::CopyDib怎么用?C++ CDib::CopyDib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDib
的用法示例。
在下文中一共展示了CDib::CopyDib方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Subtract
VOID CDibUtil::Subtract(CDib& imgA, CDib& imgB, CDib& dest)
{
dest.CopyDib(&imgA);
CSize imageSize = imgA.GetDimensions();
for (LONG y = 0; y != imageSize.cy; ++y)
for (LONG x = 0; x != imageSize.cx; ++x)
{
dest.WritePixel(x, y, RGBSUB(imgA.GetPixel(x, y), imgB.GetPixel(x, y)));
}
}
示例2: Graying
VOID CDibUtil::Graying(CDib& src, CDib& dest)
{
dest.CopyDib(&src);
CSize imageSize = src.GetDimensions();
RGBQUAD color;
for (LONG y = 0; y != imageSize.cy; ++y)
for (LONG x = 0; x != imageSize.cx; ++x)
{
color = src.GetPixel(x, y);
color.rgbRed = color.rgbGreen = color.rgbBlue
= GRAYING(color.rgbRed, color.rgbGreen, color.rgbBlue);
dest.WritePixel(x, y, color);
}
}
示例3: Binaryzation
VOID CDibUtil::Binaryzation(CDib& src, CDib& dest, BYTE threshold)
{
dest.CopyDib(&src);
CSize imageSize = src.GetDimensions();
RGBQUAD color;
for (LONG y = 0; y != imageSize.cy; ++y)
for (LONG x = 0; x != imageSize.cx; ++x)
{
color = src.GetPixel(x, y);
color.rgbRed = color.rgbGreen = color.rgbBlue
= (GRAYING(color.rgbRed, color.rgbGreen, color.rgbBlue) < threshold) ? 0x00 : 0xFF;
dest.WritePixel(x, y, color);
}
}
示例4: RandomPixels
VOID CDibUtil::RandomPixels(CDib& src, CDib& dest, LONG count)
{
dest.CopyDib(&src);
CSize imageSize = src.GetDimensions();
srand( (UINT)time( NULL ) );
RGBQUAD color;
LONG x, y;
for (LONG i = 0; i != count; ++i)
{
// Random color
color.rgbRed = (BYTE)((DOUBLE)rand() / (RAND_MAX + 1) * 255);
color.rgbGreen = (BYTE)((DOUBLE)rand() / (RAND_MAX + 1) * 255);
color.rgbBlue = (BYTE)((DOUBLE)rand() / (RAND_MAX + 1) * 255);
// Random position
x = (LONG)((DOUBLE)rand() / (RAND_MAX + 1) * imageSize.cx);
y = (LONG)((DOUBLE)rand() / (RAND_MAX + 1) * imageSize.cy);
// Write
dest.WritePixel(x, y, color);
}
}