Esempio n. 1
0
    HBITMAP FrameBitmap(HBITMAP hBmp, COLORREF clrInColor, COLORREF clrOutColor, UINT inLineWidth, UINT outLineWidth)
    {
        CxImage ximage;
        ximage.CreateFromHBITMAP(hBmp);
        ximage.IncreaseBpp(24);

        UINT totalWidth = inLineWidth + outLineWidth;
        if (totalWidth == 0)
            return ximage.MakeBitmap();

        LONG newWidth = ximage.GetWidth() + totalWidth * 2;
        LONG newHeight = ximage.GetHeight() + totalWidth * 2;

        RGBQUAD expandClr;
        expandClr.rgbBlue = GetBValue(clrInColor);
        expandClr.rgbGreen = GetGValue(clrInColor);
        expandClr.rgbRed = GetRValue(clrInColor);
        expandClr.rgbReserved = 0;
        ximage.Expand(newWidth, newHeight, expandClr);

        ximage.DrawLine(1, (newWidth - 1), 1, 1, clrOutColor);
        ximage.DrawLine(1, 1, 1, (newHeight - 1), clrOutColor);
        ximage.DrawLine((newWidth - 1), (newWidth - 1), 1, (newHeight - 1), clrOutColor);
        ximage.DrawLine((newWidth - 1), 1, (newHeight - 1), (newHeight - 1), clrOutColor);

        return ximage.MakeBitmap();
    }
Esempio n. 2
0
bool IGFrame::DrawLines (std::list<POINT>& lPts, const IGBrush& brush)
{
	// Request thread access
	if (!RequestAccess ())
		return false;
	CxImage *pCurrentLayer = GetWorkingLayer();
	if (!pCurrentLayer)
		return false;
	if (lPts.size() < 2)
		return false;
	IGConvertible::FromIGtoCxCoords (lPts, pCurrentLayer->GetHeight());
	POINT ptFrom;
	std::list<POINT>::iterator itCurrent = lPts.begin();
	ptFrom = *itCurrent;
	while (++itCurrent != lPts.end())
	{
		pCurrentLayer->DrawLine (ptFrom.x, (*itCurrent).x, ptFrom.y, (*itCurrent).y, brush);
		ptFrom = *itCurrent;
	}
	return true;
}