EGLImageD3D::EGLImageD3D(RendererD3D *renderer, EGLenum target, egl::ImageSibling *buffer, const egl::AttributeMap &attribs) : mRenderer(renderer), mBuffer(buffer), mAttachmentBuffer(nullptr), mRenderTarget(nullptr) { ASSERT(renderer != nullptr); ASSERT(buffer != nullptr); if (egl::IsTextureTarget(target)) { mAttachmentBuffer = GetImplAs<TextureD3D>(GetAs<gl::Texture>(buffer)); mAttachmentTarget = gl::FramebufferAttachment::Target( GL_NONE, GetImageIndex(egl_gl::EGLImageTargetToGLTextureTarget(target), attribs.get(EGL_GL_TEXTURE_LEVEL_KHR, 0), attribs.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0))); } else if (egl::IsRenderbufferTarget(target)) { mAttachmentBuffer = GetImplAs<RenderbufferD3D>(GetAs<gl::Renderbuffer>(buffer)); mAttachmentTarget = gl::FramebufferAttachment::Target(GL_NONE, gl::ImageIndex::MakeInvalid()); } else { UNREACHABLE(); } }
int KGSFXModelViewPage::FillTreeFromFileMap() { int nResult = false; int nRetCode = false; char szSection[32] = TEXT(""); char szKeyName[32] = TEXT(""); char szKeyData[32] = TEXT(""); char szKeyType[32] = TEXT(""); TCHAR szMapFileName[MAX_PATH]; sprintf(szMapFileName, "%s%s", g_szDefWorkDirectory, TEXT("\\sfx_editor_file_map.ini")); m_tree.DeleteAllItems(); IIniFile* pMapFile = NULL; pMapFile = g_OpenIniFile(szMapFileName); KG_PROCESS_ERROR(pMapFile); while (pMapFile->GetNextKey(TEXT("Main"), szKeyName, szKeyName)) { pMapFile->GetString(TEXT("Main"), szKeyName, TEXT(""), szKeyData, sizeof(szKeyData)); pMapFile->GetString(TEXT("Type"), szKeyData, TEXT(""), szKeyType, sizeof(szKeyType)); _FillTreeFromFileMap(&m_tree, NULL, pMapFile, szKeyData, GetImageIndex(szKeyType)); } nResult = true; Exit0: SAFE_RELEASE(pMapFile); return nResult; }
void wxListCtrlXmlHandler::HandleListItem() { wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl); wxCHECK_RET( list, "must have wxListCtrl parent" ); wxListItem item; HandleCommonItemAttrs(item); if (HasParam(wxT("bg"))) item.SetBackgroundColour(GetColour(wxT("bg"))); if (HasParam(wxT("col"))) item.SetColumn((int)GetLong(wxT("col"))); if (HasParam(wxT("data"))) item.SetData(GetLong(wxT("data"))); if (HasParam(wxT("font"))) item.SetFont(GetFont(wxT("font"), list)); if (HasParam(wxT("state"))) item.SetState(GetStyle(wxT("state"))); if (HasParam(wxT("textcolour"))) item.SetTextColour(GetColour(wxT("textcolour"))); if (HasParam(wxT("textcolor"))) item.SetTextColour(GetColour(wxT("textcolor"))); // the list control icon style, may be 0 int image; if ( list->HasFlag(wxLC_ICON) ) image = GetImageIndex(list, wxIMAGE_LIST_NORMAL); else if ( list->HasFlag(wxLC_SMALL_ICON) || list->HasFlag(wxLC_REPORT) || list->HasFlag(wxLC_LIST) ) image = GetImageIndex(list, wxIMAGE_LIST_SMALL); else image = wxNOT_FOUND; if ( image != wxNOT_FOUND ) item.SetImage(image); // append the list item to the control item.SetId(list->GetItemCount()); list->InsertItem(item); }
//绘画麻将 bool CCardListImage::DrawCardItem(CDC * pDestDC, BYTE cbCardData, int xDest, int yDest) { //效验状态 ASSERT(m_CardListImage.IsNull()==false); ASSERT((m_nItemWidth!=0)&&(m_nItemHeight!=0)); //绘画子项 int nImageXPos=GetImageIndex(cbCardData)*m_nItemWidth; m_CardListImage.AlphaDrawImage(pDestDC,xDest,yDest,m_nItemWidth,m_nItemHeight,nImageXPos,0,RGB(255,0,255)); return true; }
void CImageString::DrawControl(CDC &dc, CRect rcUpdate) { int nWidth = m_rc.Width(); int nHeight = m_rc.Height(); if(!m_bUpdate) { int nLen = m_strTitle.GetLength(); UpdateMemDC(dc, nWidth * nLen, nHeight); Graphics graphics(m_memDC); m_memDC.BitBlt(0, 0, nWidth, nHeight, &dc, m_rc.left ,m_rc.top, SRCCOPY); int nXPos = 0; int nYPos = 0; if(m_uAlignment == Align_Center) { nXPos = (nWidth - nLen * m_sizeImage.cx) / 2; } else if(m_uAlignment == Align_Right) { nXPos = nWidth - nLen * m_sizeImage.cx; } if(m_uVAlignment == VAlign_Middle) { nYPos = (nHeight - m_sizeImage.cy) / 2; } else if(m_uVAlignment == VAlign_Bottom) { nYPos = nHeight - m_sizeImage.cy; } for(int i = 0; i < nLen; i++) { int nImageIndex = GetImageIndex(i); if(nImageIndex != -1) { graphics.DrawImage(m_pImage, Rect(nXPos , nYPos, m_sizeImage.cx, m_sizeImage.cy), nImageIndex * m_sizeImage.cx, 0, m_sizeImage.cx, m_sizeImage.cy, UnitPixel); } nXPos += m_sizeImage.cx; } } dc.BitBlt(m_rc.left,m_rc.top, m_rc.Width(), m_rc.Height(), &m_memDC, 0, 0, SRCCOPY); }
size_t CvTestbed::SetImage(const char *title, IplImage *ipl, bool release_at_exit /* =false */) { size_t index = GetImageIndex(title); if (index == -1) { // If the title wasn't found create new Image i(ipl, title, false, release_at_exit); images.push_back(i); return (images.size()-1); } // If the title was found replace the image if (images[index].release_at_exit) { cvReleaseImage(&(images[index].ipl)); } images[index].ipl = ipl; images[index].release_at_exit = release_at_exit; return index; }
void _FillTreeFromFileMap( CTreeCtrl* pTree, HTREEITEM hParent, IIniFile* pMap, const char szString[], int Image) { if (!pTree || !pMap) return; char szSection[32] = TEXT(""); char szKeyName[32] = TEXT(""); char szKeyData[32] = TEXT(""); char szKeyType[32] = TEXT(""); pMap->GetString(TEXT("Corr"), szString, TEXT(""), szSection, sizeof(szSection)); HTREEITEM hTree = pTree->InsertItem(szSection, Image, Image, hParent); if (!Image) { while (pMap->GetNextKey(szString, szKeyName, szKeyName)) { pMap->GetString(szString, szKeyName, TEXT(""), szKeyData, sizeof(szKeyData)); pMap->GetString(TEXT("Type"), szKeyData, TEXT(""), szKeyType, sizeof(szKeyType)); _FillTreeFromFileMap(pTree, hTree, pMap, szKeyData, GetImageIndex(szKeyType)); } } }
int CEsmSubListCtrl::AddItem (CEsmSubCellRef* pCellRef) { esmrecinfo_t* pRecInfo; CEsmSubNameFix* pName; int ListIndex; int ImageIndex; /* Find an existing reference in the list (no duplicates) */ ListIndex = FindCellRef(pCellRef); if (ListIndex >= 0) return (ListIndex); /* Initialize the record info */ if (pCellRef != NULL && pCellRef->GetRecInfo() == NULL) { pName = (CEsmSubNameFix *) pCellRef->FindSubRecord(MWESM_SUBREC_NAME); if (pName != NULL) { pRecInfo = m_pEsmDlgHandler->GetDocument()->FindRecord(pName->GetName()); pCellRef->SetRecInfo(pRecInfo); } } if (pCellRef->GetRecInfo() == NULL) ImageIndex = -1; else ImageIndex = GetImageIndex(pCellRef->GetRecInfo()->pRecord); /* Add the item to the end of the list */ ListIndex = InsertItem(GetItemCount(), "", ImageIndex); if (ListIndex < 0) return (ListIndex); /* Set the item data */ SetItemData(ListIndex, (DWORD) pCellRef); SetItem(ListIndex, pCellRef); return (ListIndex); }
bool CSelectObjectPropTree::InitControl (void) { if (!Control::FInit()) return false; // Initialisieren ResourceFile RF (g_pDLLName); m_ilProps.CreateList (ResID(IDB_OBJPROPTYPES, &RF), 16, 0, RGB(255, 0, 255)); m_Items.erase(); // ImageList zuweisen CImageList *pIL = SetImageList (&m_ilProps, TVSIL_NORMAL); if (pIL) delete pIL; m_Items.erase(); // Objekteigenschaften in Gruppen sortiert im Baum einhängen CEierUhr Wait (GetParent()); HRESULT hr = m_Props -> OnNewReferenceObject (0L); // alle ObjProps installieren if (FAILED(hr)) return false; DEX_SetMustInitOPFs(FALSE); WEnumObjProps Enum; hr = m_Props -> EnumObjectProps (Enum.ppi()); if (FAILED(hr)) return hr; // Objekteigenschaften durchgehen WObjectProperty Prop; char cbPropInfo[_MAX_PATH]; for (Enum -> Reset(); S_OK == Enum -> Next (1, Prop.ppu(), NULL); /**/) { // vollständigen Namen geben lassen DWORD dwFlags = 0L; hr = Prop -> GetPropInfo (cbPropInfo, sizeof(cbPropInfo), &dwFlags); if (FAILED(hr) || dwFlags & PROPCAPS_INTERACTIVE) continue; // keine interaktive ObjProps anzeigen // ParentItem der Property aus dem Baum besorgen CPropertyName PropName (cbPropInfo); HTREEITEM hParent = CalcParentItem (PropName.GetGroup()); string rstr = PropName.GetSubGroup(); HTREEITEM hNewItem = NULL; if (0 != rstr.length()) { HTREEITEM hSubGroup = CalcSubGroupItem (hParent, rstr.c_str()); if (NULL != hSubGroup) hNewItem = InsertItem (PropName.GetName().c_str(), hSubGroup); else hNewItem = InsertItem (PropName.GetName().c_str(), hParent); } else hNewItem = InsertItem (PropName.GetName().c_str(), hParent); int iIndex = GetImageIndex (dwFlags); SetItemImage (hNewItem, iIndex, iIndex); } return true; }
void CEnListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CDC* pDC; CRect rText, rItem, rClient, rHeader; COLORREF crOldText, crOldBack; CSize sizeText; LV_COLUMN lvc = { 0 }; // CPen* pOldPen; CImageList* pImageList; CImageList* pStateList; int nImage = -1; BOOL bItemFocused, bListFocused, bSelected, bDropHighlighted, bSelAlways; UINT uStyle, uState; CSize sizeState(0, 0), sizeImage(0, 0); int nIndent = 0; // get and prepare device context pDC = CDC::FromHandle(lpDrawItemStruct->hDC);//GetDC(); pDC->SelectObject(GetFont()); pDC->SetROP2(R2_COPYPEN); // init helper variables int nItem = lpDrawItemStruct->itemID; GetItemRect(nItem, rItem, LVIR_BOUNDS);//lpDrawItemStruct->rcItem; GetClientRect(&rClient); // some problems with drophiliting items during drag and drop // so we need to make sure drawing is clipped to client area // this fixes it admirably! if (GetHeader()) { GetHeader()->GetWindowRect(rHeader); ScreenToClient(rHeader); rClient.top = max(0, rHeader.bottom); pDC->IntersectClipRect(rClient); } rText = rItem; uStyle = GetStyle(); uState = GetItemState(nItem, LVIS_DROPHILITED | LVIS_SELECTED); bDropHighlighted = (uState & LVIS_DROPHILITED); bItemFocused = (GetFocusedItem() == nItem); bListFocused = (GetFocus() == this); bSelected = (uState & LVIS_SELECTED); bSelAlways = ((uStyle & LVS_SHOWSELALWAYS) == LVS_SHOWSELALWAYS); bSelected = bSelected && (bListFocused || bSelAlways); crOldText = pDC->SetTextColor(COLORREF(0)); // this will be overwritten on a per subitem basis crOldBack = pDC->SetBkColor(GetItemBackColor(nItem, bSelected, bDropHighlighted, bListFocused)); // images and indentation pImageList = GetImageList(LVSIL_SMALL); if (pImageList) { nImage = GetImageIndex(nItem, 0); ImageList_GetIconSize(pImageList->m_hImageList, (int*)&sizeImage.cx, (int*)&sizeImage.cy); nIndent = GetItemIndent(nItem) * sizeImage.cx; rText.left += nIndent; rItem.left += nIndent; // if (pImageList == &s_ilIndent) // pImageList = NULL; } // state pStateList = GetImageList(LVSIL_STATE); if (pStateList) ImageList_GetIconSize(pStateList->m_hImageList, (int*)&sizeState.cx, (int*)&sizeState.cy); if (lpDrawItemStruct->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)) { // setup colors and pens int nImageStyle = GetImageStyle(bSelected, bDropHighlighted, bListFocused); // draw item images if required int nImageWidth = 0; // make sure there is enough space lvc.mask = LVCF_WIDTH | LVCF_FMT; int nCol = 0; BOOL bRes = GetColumn(nCol, &lvc); // must paint the background of column 0 before the icons if (bRes && (pStateList || pImageList)) pDC->ExtTextOut(0, rItem.top, ETO_CLIPPED | ETO_OPAQUE, CRect(0, rItem.top, lvc.cx, rItem.bottom), _T(""), NULL); // state if (pStateList && bRes) { int nState = (GetItemState(nItem, LVIS_STATEIMAGEMASK) & LVIS_STATEIMAGEMASK); nState = nState >> 12; if (lvc.cx > sizeState.cx) pStateList->Draw(pDC, nState, CPoint(rText.left + 1, rText.top), ILD_TRANSPARENT); nImageWidth = sizeState.cx + 2; // 1 pixel border either side }
IplImage *CvTestbed::GetImage(const char *title) { return GetImage(GetImageIndex(title)); }
void CuDlgMain::DisplayDifference(UINT nMask) { CuDlgPageDifference* pDlgPageOtherHost = NULL; CuDlgPageDifference* pDlgPageVNode = NULL; TCITEM item; memset (&item, 0, sizeof (item)); item.mask = TCIF_PARAM; m_cTab1.GetItem(0, &item); CuDlgPageDifference* pDlgPageConfig = (CuDlgPageDifference*)item.lParam; m_cTab1.GetItem(1, &item); CuDlgPageDifference* pDlgPageEnvSystem = (CuDlgPageDifference*)item.lParam; m_cTab1.GetItem(2, &item); CuDlgPageDifference* pDlgPageEnvUser = (CuDlgPageDifference*)item.lParam; #if defined (_VIRTUAL_NODE_AVAILABLE) m_cTab1.GetItem(3, &item); pDlgPageVNode = (CuDlgPageDifference*)item.lParam; #endif if (m_cTab1.GetItem(OTHER_HOST_INDEX, &item)) pDlgPageOtherHost = (CuDlgPageDifference*)item.lParam; if (nMask & PARAM_GENERAL) m_compareParam.CleanIgnore(); CString strValue1; CString strValue2; CaCdaDifference* pObj = NULL; POSITION pos = m_listDifference.GetHeadPosition(); while (pos != NULL) { int nImage = -1; CaCdaDifference* pObj = m_listDifference.GetNext(pos); strValue1 = pObj->GetValue1(); strValue2 = pObj->GetValue2(); TCHAR& c = pObj->GetDifference(); switch (c) { case _T('+'): nImage = 0; strValue2 = _T("n/a"); break; case _T('-'): nImage = 1; strValue1 = _T("n/a"); break; case _T('!'): nImage = 2; break; case _T('='): nImage = 3; break; default: break; } if (nMask & PARAM_GENERAL) { if (c != _T('=') && pObj->GetType() == CDA_GENERAL) { int nIdx = 0; int nCount = m_listMainParam.GetItemCount(); nIdx = m_listMainParam.InsertItem (nCount, pObj->GetName(), nImage); m_listMainParam.SetItemText (nIdx, 1, strValue1); m_listMainParam.SetItemText (nIdx, 2, strValue2); if (PrecheckIgnore(pObj->GetName())) { m_listMainParam.SetCheck(nIdx, 3, TRUE); m_compareParam.AddIgnore(pObj->GetName()); } m_listMainParam.SetItemData(nCount, (LPARAM)pObj); } } if (nMask & PARAM_CONFIGxENV) { switch (pObj->GetType()) { case CDA_CONFIG: if (pDlgPageConfig) { if (!pObj->GetHost().IsEmpty()) { if (pObj->GetHost().CompareNoCase(m_compareParam.GetHost1()) != 0 && pObj->GetHost().CompareNoCase(m_compareParam.GetHost2()) != 0 ) break; } CListCtrl* pListCtrl = pDlgPageConfig->GetListCtrl(); int nIdx = 0; int nCount = pListCtrl->GetItemCount(); nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage); pListCtrl->SetItemText (nIdx, 1, strValue1); pListCtrl->SetItemText (nIdx, 2, strValue2); } break; case CDA_ENVSYSTEM: if (pDlgPageEnvSystem) { CListCtrl* pListCtrl = pDlgPageEnvSystem->GetListCtrl(); int nIdx = 0; int nCount = pListCtrl->GetItemCount(); nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage); pListCtrl->SetItemText (nIdx, 1, strValue1); pListCtrl->SetItemText (nIdx, 2, strValue2); } break; case CDA_ENVUSER: if (pDlgPageEnvUser) { CListCtrl* pListCtrl = pDlgPageEnvUser->GetListCtrl(); int nIdx = 0; int nCount = pListCtrl->GetItemCount(); nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage); pListCtrl->SetItemText (nIdx, 1, strValue1); pListCtrl->SetItemText (nIdx, 2, strValue2); } break; case CDA_VNODE: #if defined (_VIRTUAL_NODE_AVAILABLE) if (pDlgPageVNode) { CListCtrl* pListCtrl = pDlgPageVNode->GetListCtrl(); int nIdx = 0; int nCount = pListCtrl->GetItemCount(); nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage); pListCtrl->SetItemText (nIdx, 1, strValue1); pListCtrl->SetItemText (nIdx, 2, strValue2); } #endif break; default: break; } } } // // Other configured host names: if (nMask && PARAM_OTHERHOST) { pos = m_listDifferenceOtherHost.GetHeadPosition(); while (pos != NULL) { CaCdaDifference* pObj = m_listDifferenceOtherHost.GetNext(pos); strValue1 = pObj->GetValue1(); strValue2 = pObj->GetValue2(); TCHAR& c = pObj->GetDifference(); int nImage = GetImageIndex(c); switch (c) { case _T('+'): strValue2 = _T("n/a"); break; case _T('-'): strValue1 = _T("n/a"); break; default: break; } switch (pObj->GetType()) { case CDA_CONFIG: if (pDlgPageOtherHost) { CListCtrl* pListCtrl = pDlgPageOtherHost->GetListCtrl(); int nIdx = 0; int nCount = pListCtrl->GetItemCount(); nIdx = pListCtrl->InsertItem (nCount, pObj->GetName(), nImage); pListCtrl->SetItemText (nIdx, 1, strValue1); pListCtrl->SetItemText (nIdx, 2, strValue2); } break; default: break; } } } }