Example #1
0
void CBCStroke::Draw(FCObjImage& img,float zoompaper,float zoompress)
{
	if(m_bezStroke.empty())
		return;
	FCObjImage imgBlock;
	RECT rcTmp;
	rcTmp.bottom=m_rcSave.bottom*zoompaper;
	rcTmp.left=m_rcSave.left*zoompaper;
	rcTmp.right=m_rcSave.right*zoompaper;
	rcTmp.top=m_rcSave.top*zoompaper;
	img.GetSubBlock (&imgBlock,rcTmp);
	
//	if(m_Undo.IsValidImage()==false)
//		m_Undo=imgBlock;
	// 制作大小一样的alpha位图,注意:位图数据初始化为0(也即黑色)
	FCObjImage		imgAlpha (imgBlock.Width(), imgBlock.Height(), 8) ;

	Draw(imgAlpha,255,zoompaper,zoompress);
	
	// 制作纯色位图
	FCObjImage          imgCover (imgBlock.Width(), imgBlock.Height(), 32) ;
	RGBQUAD c;
	c.rgbRed=GetRValue(m_c);
	c.rgbGreen=GetGValue(m_c);
	c.rgbBlue=GetBValue(m_c);
	FCPixelFillColor    cmdFillCr(c) ;
	imgCover.SinglePixelProcessProc (cmdFillCr) ;
	imgCover.AppendAlphaChannel (imgAlpha) ;

	imgBlock.CombineAlphaImg (imgCover);
	img.CoverBlock(imgBlock,rcTmp.left,rcTmp.top);
	//std::sort(
}
Example #2
0
//
//   FUNCTION: InitInstance(HANDLE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   RECT   rc ;
   ::GetWindowRect (hWnd, &rc) ;
   ::MoveWindow (hWnd, rc.left, rc.top, img.Width(), img.Height(), TRUE) ;
   HRGN   hRgn = FCWin32::ConvertAlphaImageToHRGN(img) ;
   ::SetWindowRgn (hWnd, hRgn, TRUE) ;

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}
Example #3
0
//********************************************************************************************************
void CBCStroke::Draw(FCObjImage& img,BYTE alpha,float zoompaper,float zoompress)
{
	//m_vb.BeginOneStrokeDraw(img.GetPaper());
	BEZIERSTROKE::iterator it;
	int w=img.Width();
	int h=img.Height();
	img.Stretch(w*3,h*3);
	for(it=m_bezStroke.begin();it!=m_bezStroke.end();++it){
		DrawBezierCurve(img,*it,alpha,zoompaper*3,zoompress*3);
	}
	img.AntiAliased_Zoom(3);
	//m_vb.EndOneStrokeDraw(img.GetPaper());
}
Example #4
0
//=================================================================================
// 画线基类/base class of drawline (32 bit)
void  CCmdImgDrawlineBase::Implement (FCObjImage & img, FCObjProgress * Percent)
{
	if (!img.IsValidImage() || (img.ColorBits() != 32))
		return ;
	m_nAlpha = FClamp0255 (m_nAlpha) ;

	// 制作大小一样的alpha位图,注意:位图数据初始化为0(也即黑色)
	FCObjImage		imgAlpha (img.Width(), img.Height(), 8) ;
	
	// draw lines
	
	this->DrawAlphaMask (imgAlpha) ;
	//imgAlpha.Save("D:\\a.bmp");
	// 制作纯色位图
	FCObjImage          imgCover (img.Width(), img.Height(), 32) ;
	FCPixelFillColor    cmdFillCr(m_cr) ;
	imgCover.SinglePixelProcessProc (cmdFillCr) ;
	
	imgCover.AppendAlphaChannel (imgAlpha) ;
	//imgCover.Save("D:\\te.bmp");
	img.CombineAlphaImg (imgCover) ;
	//img.Save("D:\\te.bmp");
}
Example #5
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    FCObjImage   imgAlpha ;
    FCWin32::LoadImageRes(imgAlpha, MAKEINTRESOURCE(IDR_RGNIMG), TEXT("TGA"), IMG_TGA) ;
    imgAlpha.SinglePixelProcessProc (FCPixelConvertTo8BitGray()) ;

    img.Create (imgAlpha.Width(), imgAlpha.Height(), 32) ;
    img.AppendAlphaChannel (imgAlpha) ;

 	// TODO: Place code here.
	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_MY003, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow)) 
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY003);

	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return msg.wParam;
}
Example #6
0
//-------------------------------------------------------------------------------------
void CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
    if (lpDIS && (lpDIS->CtlType == ODT_MENU))
    {
        FCObjImage   img ;
        img.LoadResource (lpDIS->itemID, L"PNG", IMG_PNG) ;
        if (img.IsValidImage())
        {
            if (lpDIS->itemState & ODS_DISABLED)
            {
                img.ApplyEffect (FCEffectGrayscale()) ;
            }

            std::auto_ptr<Gdiplus::Bitmap>   gb (img.CreateBitmap()) ;

            CRect   rc = FCObjGraph::CalcFitWindowSize (CSize(img.Width(),img.Height()), lpDIS->rcItem) ;
            Gdiplus::Graphics(lpDIS->hDC).DrawImage (gb.get(), rc.left, rc.top, rc.Width(), rc.Height()) ;
        }
        return ;
    }
    CMDIFrameWnd::OnDrawItem (nIDCtl, lpDIS) ;
}