/** * Draws a single tile onto the screen * Also changes the status from VISIBLE to */ void drawtile(struct tile* tile) { if(tile->texture.data == NULL) return; struct point topleft = world2screen(tile->left, tile->top); struct point bottomright = world2screen(tile->right, tile->bottom); float width = bottomright.x - topleft.x; float height = bottomright.y - topleft.y; DrawImg(topleft.x, topleft.y, width, height, tile->texture, tile->opacity); //Draw extra copies of this tile to the left and to the right //Should only happed if the view is so zoomed out that the world can be seen multiple times //Draw copies to the left float extratilesx = topleft.x - world_width; while(extratilesx + width > 0) { DrawImg(extratilesx, topleft.y, width, height, tile->texture, tile->opacity); extratilesx -= world_width; } //Draw copies to the right extratilesx = topleft.x + world_width; while(extratilesx < SCREEN_WIDTH) { DrawImg(extratilesx, topleft.y, width, height, tile->texture, tile->opacity); extratilesx += world_width; } }
void PASCAL TimeProc(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2) { sprintf(str, "%s", "res//"); if (c > 5472) { timeKillEvent(wTimerID); } if (c / 10 == 0) sprintf(buff, "B000%d.BMP", c); else if (c / 100 == 0) sprintf(buff, "B00%d.BMP", c); else if (c / 1000 == 0) sprintf(buff, "B0%d.BMP", c); else { sprintf(buff, "B%d.BMP", c); } str1 = str; str1 += buff; temp = c%25; if (temp == 0) count++; if (count == 10)count = 0; DrawImg(str1,count); c++; }
void CAddCamDlg::OnBnClickedAddRedrawBt() { // TODO: 在此添加控件通知处理程序代码 mRangeIndex = 0; for (int i = 0; i < MAX_RANGE_NUM;i++) { mWarnRange[i].clear(); } DrawImg(); DrawWarnRange(); }
void CAddCamDlg::OnBnClickedAddSetmskBt() { // TODO: 在此添加控件通知处理程序代码 mRangeIndex = 0; char filepath[256]; Mat mMat; CString FilePathName; CFileDialog dlg(TRUE, //TRUE为OPEN对话框,FALSE为SAVE AS对话框 NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, (LPCTSTR)_TEXT("JPG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|"), NULL); if (dlg.DoModal() == IDOK) { FilePathName = dlg.GetPathName(); //文件名保存在了FilePathName里 CCommonFunc::UnicodeToAnsi(FilePathName.GetBuffer(), filepath, 256); mMat = imread(filepath); if(mMat.empty()) return; cv::Size mSize = cv::Size(mImgRect.Width(), mImgRect.Height()); Mat image2 = Mat(mSize, CV_32S); resize(mMat, image2, mSize); CvImage::Mat2CImage(image2, mimg); if (mimg.IsNull()) { CButton* pBt = (CButton*)GetDlgItem(IDC_ADD_REDRAW_BT); pBt->EnableWindow(FALSE); pBt = (CButton*)GetDlgItem(IDC_ADD_ADDRANGE_BT); pBt->EnableWindow(FALSE); isDrawImg = false; return; } int nBPP = mMat.channels()*8; if (!maskimg.IsNull()) maskimg.Destroy(); maskimg.Create(mMat.cols, mMat.rows,nBPP ); CButton* pBt = (CButton*)GetDlgItem(IDC_ADD_REDRAW_BT); pBt->EnableWindow(TRUE); pBt = (CButton*)GetDlgItem(IDC_ADD_ADDRANGE_BT); pBt->EnableWindow(TRUE); mRangeIndex = 0; for (int i = 0; i < MAX_RANGE_NUM; i++) { mWarnRange[i].clear(); } } else { return; } DrawImg(); isDrawImg = true; }
void CAddCamDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CPoint mPt; if (isDrawImg) { if (point.x <= mImgRect.right && point.x >= mImgRect.left && point.y <= mImgRect.bottom && point.y >= mImgRect.top) { mPt.x = point.x - mImgRect.left; mPt.y = point.y - mImgRect.top; mWarnRange[mRangeIndex].push_back(mPt); DrawImg(); DrawWarnRange(); } } CDialog::OnLButtonDown(nFlags, point); }
void DrvInfo() { unsigned int iTotal, iFree, iBusy; float fFree; char szTotal[18];//Полный обьем диска char szFree[18];//Свободно char szBusy[18];//Занято char szPFree[8];//Свободно в процентах int drv1; //диск if (drv==4) drv1=drv-1; else drv1=drv; iTotal = GetTotalFlexSpace(drv, &err);//Всего iFree = GetFreeFlexSpace(drv, &err);//Свободно iBusy = iTotal - iFree; fFree = (float)iFree * 100 / (float)iTotal;//Свободно в процентах sz2s(iTotal, szTotal); sz2s(iFree, szFree ); sz2s(iBusy, szBusy ); sprintf(szPFree, "%.2f%%", fFree); RECT rc = DrawINF(); unsigned int total=(rc.x2-rc.x-2-smes*2)*fFree/100; #ifdef ELKA wsprintf(guibuf, "%t", muitxt(ind_drv_info)); DrawString(guibuf, rc.x+smes, rc.y+3, rc.x2-smes, rc.y+prop_h+5, FONT_PROP, 2+32, (char*)&Colors[clInfo],NULL); wsprintf(guibuf, _t, muitxt(ind_ok)); DrawString(guibuf,rc.x+smes,rc.y2-5-GetFontYSIZE(FONT_PROP),rc.x2-smes,rc.y2-5,FONT_PROP,1,(char*)&Colors[clInfo],NULL); #endif wsprintf(guibuf, "%t: %t (%d:)\n%t: %t\n%t: %t\n%t: %t\n%c%t%c", muitxt(ind_drv_driver),Drives[drv1].name, drv ,muitxt(ind_drv_all),szTotal ,muitxt(ind_drv_free),szFree ,muitxt(ind_drv_busy),szBusy ,UTF16_DIS_CENTER, szPFree, UTF16_ENA_CENTER); DrawRectangle(rc.x+smes, rc.y+SDVIG_H-3+(prop_h+1)*4, rc.x2-smes, rc.y+SDVIG_H-3+(prop_h+1)*4+prop_h, 0, (char*)&Colors[clProgrBD],( char*)&Colors[clProgrBG]); DrawRectangle(rc.x+smes+1, rc.y+SDVIG_H-3+(prop_h+1)*4+1, rc.x+smes+1+total, rc.y+SDVIG_H-3+(prop_h+1)*4+prop_h-1, 0, NULL, (char*)&Colors[clCurProgrBG]); DrawString(guibuf, rc.x+smes, rc.y+SDVIG_H, rc.x2-smes, rc.y+prop_h*5+SDVIG_H, FONT_PROP, 1+32, (char*)&Colors[clInfo], NULL); DrawImg( #ifdef ELKA rc.x2-GetImgWidth((int)&Drives[drv1].icon)-8, #else rc.x2-GetImgWidth((int)&Drives[drv1].icon)-2, #endif rc.y+SDVIG_H-2, (int)&Drives[drv1].icon); }