Example #1
0
static void FillMask(IplImage *image, uint8_t setnum, int x, int y)
{
	if(( 0 <= x && x <= image->width -1 )&&
		(0 <= y && y <= image->height -1 ) )
	{

		uint8_t cl = GetMaskDataPos(image, x, y);
		if(cl == 255){
			::MessageBox(NULL, "", "", MB_OK);
		}
		SetMaskDataPos(image, setnum, x, y);

		//上
		if(GetMaskDataPos(image, x, y-1) == cl){
			FillMask(image, setnum, x, y-1);
		}

		//右
		else if(GetMaskDataPos(image, x+1, y) == cl){
			FillMask(image, setnum, x + 1, y);
		}

		//下
		else if(GetMaskDataPos(image, x, y-1) == cl){
			FillMask(image, setnum, x, y-1);
		}

		//左
		else if(GetMaskDataPos(image, x-1, y) == cl){
			FillMask(image, setnum,  x-1, y);
		}
	}
}
BOOL COXScrollTipOwner::AdjustScrollTip()
// --- In  : 
// --- Out : 
// --- Returns : Whether it succeeded or not
// --- Effect : Adjusts the text and position of the scroll tip
{
	CString sText;
	int nPage = 0;
	int nPagePos = 0;
	int nAbsPos = 0;
	int nPageSize = 0;

	// Get the current position
	if (!GetScrollInfo(nPage, nPagePos, nAbsPos, nPageSize))
		return FALSE;

	// Build a nice text and set it
	sText = FillMask(nPage + 1, nPagePos + 1, nAbsPos + 1);
	CSize newSize = m_scrollTip.ComputeSize(sText);

	// Change the position (uses the current size)
	CPoint newPos = ComputeScrollTipPosition(nPage, nPagePos, nAbsPos, nPageSize, newSize);
	m_scrollTip.Adjust(CRect(newPos, newSize), sText);

	return TRUE;
}