void CSSImageListInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { const InterpolableList& interpolableList = toInterpolableList(interpolableValue); const size_t length = interpolableList.length(); ASSERT(length > 0); const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonInterpolableValue); ASSERT(nonInterpolableList.length() == length); StyleImageList imageList(length); for (size_t i = 0; i < length; i++) imageList[i] = CSSImageInterpolationType::resolveStyleImage(cssProperty(), *interpolableList.get(i), nonInterpolableList.get(i), environment.state()); ImageListPropertyFunctions::setImageList(cssProperty(), *environment.state().style(), imageList); }
CImageList *CSiteGroupsTree::CreateDragImageEx(HTREEITEM item, COLORREF color) { if (GetImageList(TVSIL_NORMAL)) return CreateDragImage(item); // Create bitmap std::auto_ptr<CClientDC> dc; try { dc.reset(new CClientDC(this)); } catch (CResourceException *ex) { ex->Delete(); return 0; } CDC memdc; if (memdc.CreateCompatibleDC(dc.get()) == FALSE) return 0; CRect rect; GetItemRect(item, rect, TRUE); rect.top = rect.left = 0; CBitmap bitmap; if (bitmap.CreateCompatibleBitmap(dc.get(), rect.Width(), rect.Height()) == FALSE) return 0; CBitmap *oldBitmap = memdc.SelectObject(&bitmap); CFont *oldFont = memdc.SelectObject(GetFont()); COLORREF dragMask = m_colors->dragMask.color; memdc.FillSolidRect(&rect, dragMask); memdc.SetTextColor(color); memdc.TextOut(rect.left, rect.top, GetItemText(item)); memdc.SelectObject(oldFont); memdc.SelectObject(oldBitmap); // Create image list std::auto_ptr<CImageList> imageList(new CImageList); if (imageList->Create(rect.Width(), rect.Height(), ILC_COLOR24 | ILC_MASK, 0, 1) == FALSE) return 0; if (imageList->Add(&bitmap, dragMask) == -1) return 0; return imageList.release(); }
ImageListPtr IEToolbar::createButtonsImageList(CBitmap& bitmap) const { BITMAP bitmapData = {0}; bitmap.GetBitmap(&bitmapData); ImageListPtr imageList(new CImageList()); const BOOL createResult = imageList->Create(bitmapData.bmHeight, bitmapData.bmHeight, bitmapData.bmBitsPixel | ILC_MASK, bitmapData.bmWidth / bitmapData.bmHeight, 0); if (FALSE == createResult) { throw Error("Failed to create buttons image list\n"); } const int addResult = imageList->Add(&bitmap, RGB(255, 0, 255)); if (addResult < 0) { throw Error("Failed to add bitmap to buttons image list\n"); } imageList->SetBkColor(CLR_NONE); return imageList; }