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


C++ ImgFile_Ptr::GetMaskState方法代码示例

本文整理汇总了C++中ImgFile_Ptr::GetMaskState方法的典型用法代码示例。如果您正苦于以下问题:C++ ImgFile_Ptr::GetMaskState方法的具体用法?C++ ImgFile_Ptr::GetMaskState怎么用?C++ ImgFile_Ptr::GetMaskState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImgFile_Ptr的用法示例。


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

示例1: Init

bool E_ColorReverse::Init(ImgFile_Ptr pFile)
{
	IImgLayer_weakPtr _sl = pFile->GetSelectLayer();
	if (_sl.expired()) {
		OutputError::Alert(IE_ERROR_SELECT_LAYER_DONT_EXIST);
		return false;
	}

	IImgLayer_Ptr sl = _sl.lock();
	if (sl->GetLayerType() != IE_LAYER_TYPE::NORMAL_LAYER) {
		OutputError::Alert(IE_ERROR_CANT_EDIT_LAYER);
		return false;
	}
	m_pEditLayer = std::dynamic_pointer_cast<ImgLayer>(sl);

	RECT rect, mask_rect;
	m_pEditLayer->GetLayerRect(&rect);

	//マスクの範囲取得
	if (pFile->GetMaskState() == IE_MASK_STATE_ID::INVALID) {
		m_mask = NULL;
	}
	else {
		pFile->GetMaskRect(&mask_rect);
		//範囲を計算
		AndRect(&rect, &mask_rect, &rect);

		//マスク切り出し
		IplImage* tmp_mask = cvCreateImage(
			cvSize(rect.right - rect.left, rect.bottom - rect.top),
			IPL_DEPTH_8U,
			1);

		pFile->CopyFileMask(
			rect.left,
			rect.top,
			rect.right - rect.left,
			rect.bottom - rect.top,
			tmp_mask,
			0, 0);

		m_mask = tmp_mask;
	}

	CvSize sizeOfImage;
	sizeOfImage.width = rect.right - rect.left;
	sizeOfImage.height = rect.bottom - rect.top;

	m_pEditLayerHandle = (EditLayerHandle*)pFile->CreateImgFileHandle( IFH_EDIT_LAYER );
	m_pEditLayerHandle->SetHandleName( DISPLAY_NAME );
	pFile->DoImgFileHandle( m_pEditLayerHandle );

	m_pEditNode = m_pEditLayerHandle->CreateEditNode(&rect);
	m_pEditNode->blt_rect = rect;

	return true;
}
开发者ID:fughz,项目名称:frayer,代码行数:57,代码来源:E_ColorReverse.cpp

示例2: AddEditNode

/*!
	pNodeを加算する。
	@param[in] pNode
	@param[in] lprc 更新範囲
*/
void ImgLayer::AddEditNode(EditNode *pNode, const LPRECT lprc)
{
	if(!pNode) return;

	RECT rc; 
	if (lprc) {
		//更新範囲とコピー先範囲の論理積
		AndRect(lprc, &(pNode->blt_rect), &rc);
	}
	else {
		rc = pNode->blt_rect;
	}

	if (!pNode->isBakedWriteMap) {
		//blt undo image
		BltLayerUndoOp bltLayerUndoOp;
		AllMaskOp allMaskOp;
		pNode->undo_img.OperateBlt<BltLayerUndoOp, AllMaskOp>(
			bltLayerUndoOp,
			allMaskOp,
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top,
			rc.right - rc.left,
			rc.bottom - rc.top,
			m_Img,
			rc.left - m_LayerRect.left,
			rc.top - m_LayerRect.top,
			&(pNode->write_map),
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top);
		
		//write pixel mark
		WritePixelMark writePixelMark;
		NormMaskOp normMaskOp;
		pNode->write_map.OperateBlt<WritePixelMark, NormMaskOp>(
			writePixelMark,
			normMaskOp,
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top,
			rc.right - rc.left,
			rc.bottom - rc.top,
			NULL,
			0,
			0,
			&(pNode->edit_img),
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top);
	}

	//blt edit image
	const IplImage* mask = NULL;
	ImgFile_Ptr pParentFile = this->GetParentFile().lock();
	if (pParentFile->GetMaskState() == IE_MASK_STATE_ID::VALID) {
		mask = pParentFile->GetDrawMaskImg();
	}

	if (!m_IsLockPixelAlpha) {
		LayerSynthesizerMG::BlendSynth<NormalCopy>(
			pNode->fourcc,
			1.0,
			m_Img,
			rc.left - m_LayerRect.left,
			rc.top - m_LayerRect.top,
			rc.right - rc.left,
			rc.bottom - rc.top,
			&(pNode->undo_img),
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top,
			&(pNode->edit_img),
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top,
			mask,
			rc.left,
			rc.top);
	} else {
		LayerSynthesizerMG::BlendSynth<AlphaLockCopy>(
			pNode->fourcc,
			1.0,
			m_Img,
			rc.left - m_LayerRect.left,
			rc.top - m_LayerRect.top,
			rc.right - rc.left,
			rc.bottom - rc.top,
			&(pNode->undo_img),
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top,
			&(pNode->edit_img),
			rc.left - pNode->node_rect.left,
			rc.top - pNode->node_rect.top,
			mask,
			rc.left,
			rc.top);
	}
}
开发者ID:,项目名称:,代码行数:99,代码来源:

示例3: Init

bool E_LaughingMan::Init(ImgFile_Ptr pFile)
{
	m_faces = NULL;
	IImgLayer_weakPtr _sl = pFile->GetSelectLayer();
	if(!_sl.expired()){
		OutputError::Alert(IE_ERROR_SELECT_LAYER_DONT_EXIST);
		return false;
	}

	IImgLayer_Ptr sl = _sl.lock();
	if(sl->GetLayerType() != IE_LAYER_TYPE::NORMAL_LAYER){
		OutputError::Alert(IE_ERROR_CANT_EDIT_LAYER);
		return false;
	}
	m_pEditLayer = std::dynamic_pointer_cast<ImgLayer>(sl);

	RECT rect, mask_rect;
	m_pEditLayer->GetLayerRect(&rect);

	//マスクの範囲取得
	if(pFile->GetMaskState() != IE_MASK_STATE_ID::INVALID){
		pFile->GetMaskRect(&mask_rect);
		//範囲を計算
		AndRect(&rect, &mask_rect, &rect);
	}

	CvSize sizeOfImage;
	sizeOfImage.width = rect.right - rect.left;
	sizeOfImage.height = rect.bottom - rect.top;

	m_pEditLayerHandle = (EditLayerHandle*)pFile->CreateImgFileHandle( IFH_EDIT_LAYER );
	m_pEditLayerHandle->SetHandleName( DISPLAY_NAME );
	pFile->DoImgFileHandle( m_pEditLayerHandle );

	m_pEditNode = m_pEditLayerHandle->CreateEditNode(&rect);
	m_pEditNode->blt_rect = rect;

	IplImage* bgraImg;
	IplImage* editImg;
	IplImage* grayImg;
	IplImage* editedImg;

	bgraImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		4);
	editImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		3);
	grayImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		1);
	editedImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		3);

	//レイヤーから有効範囲部分のデータを取得
	m_pEditLayer->CopyLayerImage(
		bgraImg,
		0,
		0,
		rect.left,
		rect.top,
		rect.right - rect.left,
		rect.bottom - rect.top);

	ucvCvtColor(bgraImg, editImg, CV_BGRA2BGR);
	cvCvtColor(editImg, grayImg, CV_BGRA2GRAY);
	cvEqualizeHist(grayImg, grayImg);

	m_cascade = (CvHaarClassifierCascade*)cvLoad(CASCADE_FILE_PATH, 0, 0, 0);
	if (m_cascade == NULL) {
		return false;
	}

	m_storage = cvCreateMemStorage(0);;
	cvClearMemStorage(m_storage);

    m_faces = cvHaarDetectObjects(grayImg, m_cascade, m_storage,
                                       1.1, 2, 0,//CV_HAAR_DO_CANNY_PRUNING,
                                       cvSize(30, 30) );


	cvReleaseImage(&bgraImg);
	cvReleaseImage(&editImg);
    cvReleaseImage(&grayImg);
    cvReleaseImage(&editedImg);

	return true;
}
开发者ID:fughz,项目名称:frayer,代码行数:93,代码来源:E_LaughingMan.cpp


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