void DlgDataExt::UpdatePreview() { if (m_image){ CxImage tmp; tmp.Copy(*m_image,true,false,false); if (m_chk_preview.GetCheck()){ UpdateData(1); if (m_btn_graylevel.GetCheck()){ tmp.Threshold(m_thresh); } else { tmp.SelectionAddColor(tmp.RGBtoRGBQUAD(m_color)); tmp.SelectionSplit(&tmp); tmp.Negative(); } } tmp.IncreaseBpp(24); tmp.Resample(150,90,0); if (m_bitmap) DeleteObject(m_bitmap); m_bitmap = tmp.MakeBitmap(m_picture.GetDC()->m_hDC); m_picture.SetBitmap(m_bitmap); } }
void CxImage::CreateFromHICON(HICON hico) { Destroy(); if (hico) { ICONINFO iinfo; GetIconInfo(hico,&iinfo); CreateFromHBITMAP(iinfo.hbmColor); #if CXIMAGE_SUPPORT_ALPHA CxImage mask; mask.CreateFromHBITMAP(iinfo.hbmMask); mask.GrayScale(); mask.Negative(); AlphaSet(mask); #endif } }