当前位置: 首页>>代码示例>>C++>>正文


C++ AlphaBlend函数代码示例

本文整理汇总了C++中AlphaBlend函数的典型用法代码示例。如果您正苦于以下问题:C++ AlphaBlend函数的具体用法?C++ AlphaBlend怎么用?C++ AlphaBlend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AlphaBlend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ink

 inline void ink( PIX* pix, int step, int a ) 
 {
   int ia = ALPHA_MAX - a;
   AlphaBlend( *(pix-step), m_r, m_g, m_b, a, ia );
   *(pix) = m_c;
   AlphaBlend( *(pix+step), m_r, m_g, m_b, ia, a );
 }
开发者ID:tigerking,项目名称:NumptyPhysics-android,代码行数:7,代码来源:Canvas.cpp

示例2: BitBlt

void image::alphaRender(HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight, bool reverse, BYTE alpha, BOOL bAlphaFormat)
{
	_blendFunc.SourceConstantAlpha = alpha;
	if (bAlphaFormat) _blendFunc.AlphaFormat = AC_SRC_ALPHA;

	HDC hTempDC;
	if (reverse)
	{
		hTempDC = _imageInfo->hMemDC2;
	}
	else
	{
		hTempDC = _imageInfo->hMemDC;
	}
	if (_trans)
	{
		//출력해야될DC에 그려져있는 내용을 Blend에 그린다.
		BitBlt(_blendImage->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height,
			hdc, destX, destY, SRCCOPY);

		//출력해야될 이미지를 Blend에 그린다.
		GdiTransparentBlt(_blendImage->hMemDC, 0, 0, sourWidth, sourHeight,
			hTempDC, sourX, sourY, sourWidth, sourHeight, _transColor);

		//BlendDC를 출력해야 될 DC에 그린다.
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight, _blendImage->hMemDC,
			0, 0, sourWidth, sourHeight, _blendFunc);
	}
	else
	{
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight, hTempDC,
			sourX, sourY, sourWidth, sourHeight, _blendFunc);
	}
}
开发者ID:gawallsibya,项目名称:SGA_WinAPI_Portfolio,代码行数:34,代码来源:image.cpp

示例3: BitBlt

void image::alphaRender(HDC hdc, int destX, int destY, int sourX, int sourY, int sourWidth, int sourHeight, BYTE alpha)
{
	if (!_blendImage) alphaInit();
	_blendFunc.SourceConstantAlpha = alpha;

	if (_trans)
	{
		//출력해야 될 DC에 그려져 있는 내용을 blend에 그려준다
		BitBlt(_blendImage->hMemDC, 0, 0, _imageInfo->width, _imageInfo->height,
			hdc, destX, destY, SRCCOPY);

		//출력해야 될 이미지를 blend에 그려준다
		GdiTransparentBlt(_blendImage->hMemDC, 0, 0, sourWidth, sourHeight,
			_imageInfo->hMemDC, sourX, sourY, sourWidth, sourHeight, _transColor);

		//blendDC를 출력해야 될 DC에 그린다
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight,
			_blendImage->hMemDC, 0, 0, sourWidth, sourHeight, _blendFunc);
	}
	else
	{
		AlphaBlend(hdc, destX, destY, sourWidth, sourHeight,
			_imageInfo->hMemDC, sourX, sourY, sourWidth, sourHeight, _blendFunc);
	}
}
开发者ID:LeeJiu,项目名称:study_code,代码行数:25,代码来源:image.cpp

示例4: MirrorLeft

void ac::MirrorAll(cv::Mat &frame) {
    cv::Mat copies[4];
    for(int i = 0; i < 4; ++i)
        copies[i] = frame.clone();
    MirrorLeft(copies[0]);
    MirrorRight(copies[1]);
    MirrorTopToBottom(copies[2]);
    MirrorBottomToTop(copies[3]);
    cv::Mat out[2];
    AlphaBlend(copies[0], copies[1], out[0], 0.5);
    AlphaBlend(copies[2], copies[3], out[1], 0.5);
    AlphaBlend(out[0], out[1], frame, 0.5);
    AddInvert(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:14,代码来源:ac-filter19.cpp

示例5: ShuffleAlpha

void ac::ShuffleAlphaWithRGB(cv::Mat &frame) {
    cv::Mat copy1 = frame.clone(), copy2 = frame.clone();
    ShuffleAlpha(copy1);
    ShuffleRGB(copy2);
    AlphaBlend(copy1, copy2, frame, 0.5);
    AddInvert(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:7,代码来源:ac-filter13.cpp

示例6: Smooth

void ac::ImageReverseSubFilter(cv::Mat &frame) {
    if(blend_set == false || subfilter == -1 || ac::draw_strings[subfilter] == "ImageReverseSubFilter")
        return;
    
    cv::Mat reimage;
    cv::resize(blend_image, reimage, frame.size());
    cv::Mat all_frames[3];
    cv::flip(frame, all_frames[0], -1);
    cv::flip(frame, all_frames[1], 0);
    cv::flip(frame, all_frames[2], 1);
    cv::Mat copy1 = frame.clone(), copy2 = frame.clone();
    for(int z = 0; z < copy1.rows; ++z) {
        for(int i = 0; i < copy1.cols; ++i){
            cv::Vec3b &pixel = copy1.at<cv::Vec3b>(z, i);
            cv::Vec3b pix[4];
            for(int j = 0; j < 3; ++j) {
                pix[j] = all_frames[j].at<cv::Vec3b>(z, i);
            }
            for(int j = 0; j < 3; ++j) {
                pixel[j] = pix[0][j] ^ pix[1][j] ^ pix[2][j] ^ pixel[j];
            }
        }
    }
    static MatrixCollection<8> collection;
    Smooth(copy1, &collection);
    CallFilter(subfilter, reimage);
    Xor(reimage, copy1);
    AlphaBlend(reimage, copy2, frame, 0.5);
    DarkenFilter(frame);
    MedianBlend(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:31,代码来源:ac-filter13.cpp

示例7: CrashIf

// based on http://theartofdev.wordpress.com/2013/10/24/transparent-text-rendering-with-gdi/,
// TODO: look into using http://theartofdev.wordpress.com/2014/01/12/gdi-text-rendering-to-image/
// TODO: doesn't actually look good (i.e. similar to DrawText when using transparent SetBkMode())
// which kind of makes sense, because I'm using transparent mode to draw to in-memory bitmap as well
// TODO: doesn't actually do alpha bf.SourceConstantAlpha > 4 looks the same, values 1-4 produce
// different, but not expected, results
// TODO: I would like to figure out a way to draw text without the need to Lock()/Unlock()
// maybe draw to in-memory bitmap, convert to Graphics bitmap and blit that bitmap to
// Graphics object
void TextRenderGdi::DrawTransparent(const WCHAR *s, size_t sLen, RectF& bb, bool isRtl) {
    CrashIf(!hdcGfxLocked); // hasn't been Lock()ed

    int x = (int) bb.X;
    int y = (int) bb.Y;
    int dx = (int) bb.Width;
    int dy = (int) bb.Height;

    CreateClearBmpOfSize(dx,dy);
    //SetBkMode(hdcGfxLocked, 1);
    SetBkMode(memHdc, TRANSPARENT);

    //BitBlt(memHdc, 0, 0, dx, dy, hdcGfxLocked, x, y, SRCCOPY);
    SelectObject(memHdc, currFont);
    ::SetTextColor(memHdc, textColor.ToCOLORREF());

#if 0
    TextOut(memHdc, 0, 0, s, sLen);
#else
    UINT opts = 0; //ETO_OPAQUE;
    if (isRtl)
        opts = opts | ETO_RTLREADING;
    ExtTextOut(memHdc, 0, 0, opts, nullptr, s, (UINT)sLen, nullptr);
#endif

    BLENDFUNCTION bf = {};
    bf.BlendOp = AC_SRC_OVER;
    bf.BlendFlags = 0;
    bf.AlphaFormat = 0; // 0 - ignore source alpha, AC_SRC_ALPHA (1) - use source alpha
    bf.SourceConstantAlpha = 0x3; //textColor.GetA();
    AlphaBlend(hdcGfxLocked, x, y, dx, dy, memHdc, 0, 0, dx, dy, bf);
}
开发者ID:qingzhengzhuma,项目名称:sumatrapdf,代码行数:41,代码来源:TextRender.cpp

示例8: CalculateRectByDrawParam

BOOL CSonicImage::InternalDraw(HDC hdc, int x, int y, DRAW_PARAM * pDp)
{
	CRect rtSrc, rtDest;
	rtDest = CalculateRectByDrawParam(x, y, pDp, rtSrc);

	if(IsAlphaChannelValid() || (pDp && (pDp->dwMask & DP_ALPHA)))
	{
		BLENDFUNCTION blend;
		blend.AlphaFormat = AC_SRC_ALPHA;
		blend.BlendFlags = 0;
		blend.BlendOp = AC_SRC_OVER;
		blend.SourceConstantAlpha = (pDp && (pDp->dwMask & DP_ALPHA)) ? pDp->cAlpha : 255;
		AlphaBlend(hdc, rtDest.left, rtDest.top, rtDest.Width(), rtDest.Height(), m_Dib.GetSafeHdc(), rtSrc.left, rtSrc.top, rtSrc.Width(), rtSrc.Height(), blend);
	}
	else
	{
		if(pDp && (pDp->dwMask & DP_COLOR_KEY))
		{
			TransparentBlt(hdc, rtDest.left, rtDest.top, rtDest.Width(), rtDest.Height(), m_Dib.GetSafeHdc(), rtSrc.left, rtSrc.top, rtSrc.Width(), rtSrc.Height(), pDp->dwColorKey);
		}
		else if(pDp && (pDp->dwMask & DP_DEST_LIMIT || pDp->dwMask & DP_SCALE))
		{
			StretchBlt(hdc, rtDest.left, rtDest.top, rtDest.Width(), rtDest.Height(), m_Dib.GetSafeHdc(), rtSrc.left, rtSrc.top, rtSrc.Width(), rtSrc.Height(), SRCCOPY);
		}
		else
		{
			BitBlt(hdc, rtDest.left, rtDest.top, rtDest.Width(), rtDest.Height(), m_Dib.GetSafeHdc(), rtSrc.left, rtSrc.top, SRCCOPY);
		}
	}
	return TRUE;
}
开发者ID:kevinzhwl,项目名称:nxuiengine,代码行数:31,代码来源:SonicImage.cpp

示例9: GetDC

//////////////////////////////////////////////////////////////////////////
// 画透明异形图的函数
// 注:在这里特别感谢CSDN网友: 黄凯飞, ID: hkf314
void CAnimateButton::AlphaBitmap(int nItem)
{
	CDC* pDC = GetDC();
	CDC TmpDC;
	TmpDC.CreateCompatibleDC(pDC);
	//当然,TmpBmp用来记录画的内容
	CBitmap TmpBmp;
	TmpBmp.CreateCompatibleBitmap(pDC, m_aniBtnWidth, m_aniBtnHeight);
	TmpDC.SelectObject(&TmpBmp);
	
	//把按钮下的背景拷贝过来
	TmpDC.BitBlt(0, 0, m_aniBtnWidth, m_aniBtnHeight, pDC, 0, 0, SRCCOPY);
	//把内存DC中的图像透明地画出来

	AlphaBlend(TmpDC.m_hDC, 0, 0, m_aniBtnWidth, m_aniBtnHeight, m_pMemDC->m_hDC,
		 nItem * m_aniBtnWidth, 0, m_aniBtnWidth, m_aniBtnHeight, m_bf);

	//填充异形图像以外的区域为mask色
	CRgn rgn;
	rgn.CreateRectRgn(0, 0, m_aniBtnWidth, m_aniBtnHeight);
	rgn.CombineRgn(&rgn, CRgn::FromHandle(m_arBmpRgn[nItem]), RGN_DIFF);
//	TRACE("CRgn::FromHandle(m_arBmpRgn[nItem]): %d\n", nItem);
	CBrush maskBrh;
	maskBrh.CreateSolidBrush(m_clrTrans);
	TmpDC.FillRgn(&rgn, &maskBrh);
//	TmpDC.FillRgn(CRgn::FromHandle(m_arBmpRgn[nItem]), &maskBrh);

	//抠除mask色,直接画出来
 	::TransparentBlt(pDC->m_hDC, 0, 0, m_aniBtnWidth, m_aniBtnHeight, TmpDC.m_hDC,
 		 0, 0, m_aniBtnWidth, m_aniBtnHeight, m_clrTrans);
// 	pDC->BitBlt(0, 0, m_aniBtnWidth, m_aniBtnHeight, &TmpDC, 0, 0, SRCCOPY);
// 	pDC->FillRgn(CRgn::FromHandle(m_arBmpRgn[nItem]), &maskBrh);

	ReleaseDC(pDC);
}
开发者ID:latelan,项目名称:BlueClick,代码行数:38,代码来源:AnimateButton.cpp

示例10: GetRelativeCoordinate

bool CDDB::PutBitmap( int x, int y, CDC *pDC, int xSrc, int ySrc, int dxSrc, int dySrc, int width, int height, DWORD dwRop, int alpha)
{
	// Coordinate mode is not relative
	if ( m_CoordinateMode != CM_RELATIVE)
		GetRelativeCoordinate( &xSrc, &ySrc, &dxSrc, &dySrc);


	// Copy alphablended memory DC
	if ( alpha < 255)
	{
		BLENDFUNCTION blendFunc = { AC_SRC_OVER, 0, alpha, 0 };

		// Copy memory bitmap
		AlphaBlend( m_DC, x, y, width, height, pDC->m_hDC, xSrc, ySrc, dxSrc, dySrc, blendFunc);
	}

	// Copy transparent memory DC
	else if ( dwRop == TRANSPARENT)
	{
		// Copy memory bitmap
		TransparentBlt( m_DC, x, y, width, height, pDC->m_hDC, xSrc, ySrc, dxSrc, dySrc, m_nTransColor);
	}

	// Copy memory DC
	else
	{
		// Copy memory bitmap
		m_DC.StretchBlt( x, y, width, height, pDC, xSrc, ySrc, dxSrc, dySrc, dwRop);
	}


	return true;
}
开发者ID:roseon,项目名称:life-marvelous,代码行数:33,代码来源:CDDB.cpp

示例11: ImageArray_DrawImage

BOOL ImageArray_DrawImage(IMAGE_ARRAY_DATA *iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha)
{
	if (hdcDest == NULL || pos < 0 || pos >= iad->nodes_size)
		return FALSE;

	EnterCriticalSection(&iad->cs);
	{
		int w, h, i;

		if (iad->width_based) {
			w = 0;
			h = 0;
			for (i = 0; i < pos; i++) {
				h += iad->nodes[i].height;
			}
		}
		else {
			h = 0;
			w = 0;
			for (i = 0; i < pos; i++) {
				w += iad->nodes[i].width;
			}
		}

		BLENDFUNCTION bf = { AC_SRC_OVER, 0, Alpha, AC_SRC_ALPHA };
		AlphaBlend(hdcDest, nXDest, nYDest, iad->nodes[pos].width, iad->nodes[pos].height, iad->hdc, w, h, iad->nodes[pos].width, iad->nodes[pos].height, bf);
	}

	LeaveCriticalSection(&iad->cs);
	return FALSE;
}
开发者ID:biddyweb,项目名称:miranda-ng,代码行数:31,代码来源:modern_image_array.cpp

示例12: MirrorOrder

void ac::MirrorOrderAlpha(cv::Mat &frame) {
    cv::Mat copy1 = frame.clone(), copy2 = frame.clone();
    MirrorOrder(copy1);
    MirrorXorAll(copy2);
    AlphaBlend(copy1, copy2, frame, 0.5);
    MedianBlend(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:7,代码来源:ac-filter13.cpp

示例13: Random_Filter

void ac::OrigAndCurrentRandomX2(cv::Mat &frame) {
    cv::Mat copy1 = frame.clone(), copy2 = orig_frame.clone();
    Random_Filter(copy1);
    Random_Filter(copy2);
    AlphaBlend(copy1, copy2, frame, 0.5);
    AddInvert(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:7,代码来源:ac-filter19.cpp

示例14: MirrorTopToBottom

void ac::MirrorTopMirrorBottomBlend(cv::Mat &frame) {
    cv::Mat copy1 = frame.clone(), copy2 = frame.clone();
    MirrorTopToBottom(copy1);
    MirrorBottomToTop(copy2);
    AlphaBlend(copy1, copy2, frame, 0.5);
    AddInvert(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:7,代码来源:ac-filter19.cpp

示例15: CallFilter

void ac::StretchSubFilter(cv::Mat &frame) {
    if(subfilter == -1 || draw_strings[subfilter] == "StretchSubFilter")
        return;
    static int w = 2, h = 2, speed = 5, dir = 100;
    if(dir == 1) {
        w += speed;
        h += speed;
        if(w > (frame.cols-1) || (h > frame.rows-1)) {
            dir = 0;
            w = frame.cols-2;
            h = frame.rows-2;
        }
    } else {
        w -= speed;
        h -= speed;
        if(w <= 64 || h <= 64) {
            dir = 1;
            w = 64;
            h = 64;
        }
    }
    cv::Mat copy1 = frame.clone(), copy2 = frame.clone(), reimage;
    cv::resize(frame, copy1, cv::Size(w, h));
    CallFilter(subfilter, copy1);
    cv::resize(copy1, reimage, frame.size());
    AlphaBlend(copy2, reimage, frame, 0.5);
    AddInvert(frame);
}
开发者ID:lostjared,项目名称:Acid.Cam.v2.OSX,代码行数:28,代码来源:ac-filter19.cpp


注:本文中的AlphaBlend函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。