Esempio n. 1
0
CPlayerToolBar::CPlayerToolBar()
	: fDisableImgListRemap(false)
	, m_pButtonsImages(NULL)
	, m_hDXVAIcon(NULL)
{
	HBITMAP hBmp = CMPCPngImage::LoadExternalImage(L"gpu", IDB_DXVA_ON, IMG_TYPE::UNDEF);
	BITMAP bm = { 0 };
	::GetObject(hBmp, sizeof(bm), &bm);

	if (CMPCPngImage::FileExists(CString(L"gpu")) && (bm.bmHeight > 32 || bm.bmWidth > 32)) {
		hBmp = CMPCPngImage::LoadExternalImage(L"", IDB_DXVA_ON, IMG_TYPE::UNDEF);
		::GetObject(hBmp, sizeof(bm), &bm);
	}

	if (bm.bmWidth <= 32 && bm.bmHeight <= 32) {
		CBitmap *bmp = DNew CBitmap();
		bmp->Attach(hBmp);

		CImageList *pButtonDXVA = DNew CImageList();
		pButtonDXVA->Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
		pButtonDXVA->Add(bmp, static_cast<CBitmap*>(NULL));

		m_hDXVAIcon = pButtonDXVA->ExtractIcon(0);

		delete pButtonDXVA;
		delete bmp;
	}

	iDXVAIconHeight	= bm.bmHeight;
	iDXVAIconWidth	= bm.bmWidth;

	DeleteObject(hBmp);
}
Esempio n. 2
0
	CCubeView::CCubeView(CCube* cube, CRender* renderer)
		: IView(renderer)
		, m_cube(cube)
	{
		assert(m_cube != nullptr);
		m_image = CBitmap("Images/Enemies/cube1.png");
		assert(m_image.IsValid() == true);
	}
Esempio n. 3
0
	CBasicAnimation::CBasicAnimation(const std::string& filename, size_t rows, size_t cols, double fps)
		: IAnimationBase(rows, cols, fps)
		, m_animationSheet()
		, m_frame()
		, m_frameW(DEFAULTFRAMEW)
		, m_frameH(DEFAULTFRAMEH)
	{
		m_animationSheet = CBitmap(al_load_bitmap(filename.c_str()));

		if (m_animationSheet)
		{
			m_frameW = m_animationSheet.GetWidth() / GetCols();
			m_frameH = m_animationSheet.GetHeight() / GetRows();
			// Create the bitmap for the initial frame
			FrameChanged();
		}
	}
Esempio n. 4
0
	void CBasicAnimation::FrameChanged(void)
	{
		if (!m_animationSheet)
			return;

		ColRow cr = GetColRow(GetCols(), GetCurrentFrame());
		size_t x((cr.col - 1) * m_frameW);
		size_t y((cr.row - 1) * m_frameH);

		if (m_frame)
		{
			m_frame.Reset();
			//al_destroy_bitmap(m_frame);
			//m_frame = nullptr;
		}

		m_frame = CBitmap(m_animationSheet, x, y, m_frameW, m_frameH);
		//m_frame = al_create_sub_bitmap(m_animationSheet, x, y, m_frameW, m_frameH);
	}
Esempio n. 5
0
CBitmap E_Desktop::getScreenshot()
{
	return CBitmap();
}
Esempio n. 6
0
void CTileHandler::ProcessTiles2(void)
{
	unsigned char* data=new unsigned char[1024*1024*4];
	bigTex=CBitmap(data,1,1);	//free big tex memory
	int tilex=xsize/4;
	int tiley=ysize/4;
	int bigx=tilex/32;
	int bigy=tiley/32;
	int a=0;

	for(int a=0;a<bigx*bigy;++a){
		int startTilex=(a%bigx)*32;
		int startTiley=(a/bigx)*32;

#ifdef WIN32
		DDSURFACEDESC2 ddsheader;
		int ddssignature;
		char name[100];
		sprintf(name,"Temp%03i.dds",a);
		CFileHandler file(name);
		file.Read(&ddssignature, sizeof(int));
		file.Read(&ddsheader, sizeof(DDSURFACEDESC2));
#else
		char name[100];
		snprintf(name, 100, "temp/Temp%03i.bmp.raw", a);
		CFileHandler file(name);
#endif

		char bigtile[696320]; //1024x1024 and 4 mipmaps
		file.Read(bigtile, 696320);

		for(int b=0;b<1024;++b){
			int x=b%32;
			int y=b/32;
			int xb=startTilex+x; //curr pointer to tile in bigtex
			int yb=startTiley+y;

			char* ctile=new char[SMALL_TILE_SIZE];
			ReadTile(x*32,y*32,ctile,bigtile);
			CBitmap* bm=new CBitmap();
			bm->CreateFromDXT1((unsigned char*)ctile,32,32);

			int t1=tileUse[max(0,(yb-1)*tilex+xb)];
			int t2=tileUse[max(0,yb*tilex+xb-1)];
			int ct=FindCloseTile(bm,t1==t2?t1:-1);
			if(ct==-1){
				tileUse[yb*tilex+xb]=usedTiles;
				tiles[usedTiles++]=bm;
				newTiles.push_back(ctile);
			} else {
				tileUse[yb*tilex+xb]=ct;
				delete bm;
				delete[] ctile;
			}
		}
		printf("Creating tiles %i/%i %i%%\n", usedTiles-numExternalTile,(a+1)*1024,(((a+1)*1024)*100)/(tilex*tiley));
	}

	delete[] data;
#ifdef WIN32
	system("del /q temp*.dds");
#else
	system("rm temp/Temp*.bmp.raw");
#endif
}
void CTileHandler::ProcessTiles2(void)
{
	unsigned char* data=new unsigned char[1024*1024*4];
	bigTex=CBitmap(data,1,1);	//free big tex memory
	int tilex=xsize/4;
	int tiley=ysize/4;

	for(int a=0;a<(tilex*tiley)/1024;++a){
		int startTile=a*1024;

		DDSURFACEDESC2 ddsheader;
		int ddssignature;
		char name[100];
		sprintf(name,"Temp%03i.dds",a);
		CFileHandler file(name);
		file.Read(&ddssignature, sizeof(int));
		file.Read(&ddsheader, sizeof(DDSURFACEDESC2));

		char bigtile[696320]; //1024x1024 and 4 mipmaps
		file.Read(bigtile, 696320);

		for(int b=0;b<1024;++b){
			int x=b%32;
			int y=b/32;
			int xb=(startTile+b)%tilex;
			int yb=(startTile+b)/tilex;

			char* ctile=new char[SMALL_TILE_SIZE];
			ReadTile(x*32,y*32,ctile,bigtile);
			CBitmap* bm=new CBitmap();
			bm->CreateFromDXT1((unsigned char*)ctile,32,32);

			int t1=tileUse[max(0,(yb-1)*tilex+xb)];
			int t2=tileUse[max(0,yb*tilex+xb-1)];
			int ct=FindCloseTile(bm,t1==t2?t1:-1);
			if(ct==-1){
				tileUse[yb*tilex+xb]=usedTiles;
				tiles[usedTiles++]=bm;
				newTiles.push_back(ctile);
			} else {
				tileUse[yb*tilex+xb]=ct;
				delete bm;
				delete[] ctile;
			}
		}
		printf("Creating tiles %i/%i %i%%\n", usedTiles-numExternalTile,(a+1)*1024,(((a+1)*1024)*100)/(tilex*tiley));
	}

	delete[] data;
	system("del temp*.dds");
/*	
	char execstring[512];
	sprintf(execstring, "nvdxt.exe -file temp\\*.bmp -dxt1c -dither");

	for(int a=0;a<(usedTiles-numExternalTile+1023)/1024;++a){
		int startTile=numExternalTile+a*1024;
		for(int b=0;b<1024 && startTile+b<usedTiles;++b){
			int x=b%32;
			int y=b/32;
			for(int y2=0;y2<32;++y2){
				for(int x2=0;x2<32;++x2){
					data[((y*32+y2)*1024+x*32+x2)*4+0]=tiles[startTile+b]->mem[((y2)*32+x2)*4+0];
					data[((y*32+y2)*1024+x*32+x2)*4+1]=tiles[startTile+b]->mem[((y2)*32+x2)*4+1];
					data[((y*32+y2)*1024+x*32+x2)*4+2]=tiles[startTile+b]->mem[((y2)*32+x2)*4+2];
					data[((y*32+y2)*1024+x*32+x2)*4+3]=tiles[startTile+b]->mem[((y2)*32+x2)*4+3];
				}
			}
		}
		CBitmap square(data,1024,1024);
		char name[100];
		sprintf(name,"temp\\Temp%03i.bmp",a);
		square.Save(name);
		printf("Writing bmp files %i%%\n", ((a*1024)*100)/(usedTiles));
	}
	printf("Creating dds files\n");
	system(execstring);
	system("del temp\\temp*.bmp");

*/
}
Esempio n. 8
0
void CPlayerToolBar::SwitchTheme()
{
	AppSettings& s = AfxGetAppSettings();

	CToolBarCtrl& tb = GetToolBarCtrl();
	m_nButtonHeight = 16;

	if (iDisableXPToolbars != (__int64)s.fDisableXPToolbars) {
		VERIFY(LoadToolBar(IDB_PLAYERTOOLBAR));

		ModifyStyleEx(WS_EX_LAYOUTRTL, WS_EX_NOINHERITLAYOUT);

		tb.SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
		tb.DeleteButton(1);
		tb.DeleteButton(tb.GetButtonCount()-2);

		SetMute(s.fMute);

		UINT styles[] = {
			TBBS_CHECKGROUP, TBBS_CHECKGROUP,
			TBBS_SEPARATOR,
			TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON,
			TBBS_SEPARATOR,
			TBBS_BUTTON,
			TBBS_BUTTON,
			TBBS_SEPARATOR,
			TBBS_SEPARATOR,
			TBBS_CHECKBOX,
		};

		for (int i = 0; i < _countof(styles); i++) {
			SetButtonStyle(i, styles[i] | TBBS_DISABLED);
		}

		iDisableXPToolbars = s.fDisableXPToolbars;
	}

	if (s.fDisableXPToolbars) {
		if (HMODULE h = LoadLibrary(_T("uxtheme.dll"))) {
			SetWindowThemeFunct f = (SetWindowThemeFunct)GetProcAddress(h, "SetWindowTheme");

			if (f) {
				f(m_hWnd, L" ", L" ");
			}

			FreeLibrary(h);
		}

		SwitchRemmapedImgList(IDB_PLAYERTOOLBAR, 0);// 0 Remap Active

		COLORSCHEME cs;
		cs.dwSize		= sizeof(COLORSCHEME);
		cs.clrBtnHighlight	= 0x0046413c;
		cs.clrBtnShadow		= 0x0037322d;

		tb.SetColorScheme(&cs);
		tb.SetIndent(5);
	} else {
		if (HMODULE h = LoadLibrary(_T("uxtheme.dll"))) {
			SetWindowThemeFunct f = (SetWindowThemeFunct)GetProcAddress(h, "SetWindowTheme");

			if (f) {
				f(m_hWnd, L"Explorer", NULL);
			}

			FreeLibrary(h);
		}

		SwitchRemmapedImgList(IDB_PLAYERTOOLBAR, 2);// 2 Undo  Active

		COLORSCHEME cs;
		cs.dwSize		= sizeof(COLORSCHEME);
		cs.clrBtnHighlight	= GetSysColor(COLOR_BTNFACE);
		cs.clrBtnShadow		= GetSysColor(COLOR_BTNSHADOW);

		tb.SetColorScheme(&cs);
		tb.SetIndent(0);
	}

	HBITMAP hBmp = NULL;
	bool fp = CMPCPngImage::FileExists(CString(L"toolbar"));
	if (s.fDisableXPToolbars && !fp) {
		/*
		int col = s.clrFaceABGR;
		int r, g, b, R, G, B;
		r = col & 0xFF;
		g = (col >> 8) & 0xFF;
		b = col >> 16;
		*/
		hBmp = CMPCPngImage::LoadExternalImage(L"toolbar", IDB_PLAYERTOOLBAR_PNG, IMG_TYPE::PNG, s.nThemeBrightness, s.nThemeRed, s.nThemeGreen, s.nThemeBlue);
	} else if (fp) {
		hBmp = CMPCPngImage::LoadExternalImage(L"toolbar", 0, IMG_TYPE::UNDEF);
	}

	BITMAP bitmapBmp;
	if (NULL != hBmp) {
		::GetObject(hBmp, sizeof(bitmapBmp), &bitmapBmp);

		if (fp && bitmapBmp.bmWidth != bitmapBmp.bmHeight * 15) {
			if (s.fDisableXPToolbars) {
				hBmp = CMPCPngImage::LoadExternalImage(L"", IDB_PLAYERTOOLBAR_PNG, IMG_TYPE::PNG, s.nThemeBrightness, s.nThemeRed, s.nThemeGreen, s.nThemeBlue);
				::GetObject(hBmp, sizeof(bitmapBmp), &bitmapBmp);
			} else {
				DeleteObject(hBmp);
				hBmp = NULL;
			}
		}
	}

	if (NULL != hBmp) {
		CBitmap *bmp = DNew CBitmap();
		bmp->Attach(hBmp);

		SetSizes(CSize(bitmapBmp.bmHeight + 7, bitmapBmp.bmHeight + 6), CSize(bitmapBmp.bmHeight, bitmapBmp.bmHeight));

		SAFE_DELETE(m_pButtonsImages);

		m_pButtonsImages = DNew CImageList();

		if (32 == bitmapBmp.bmBitsPixel) {
			m_pButtonsImages->Create(bitmapBmp.bmHeight, bitmapBmp.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
			m_pButtonsImages->Add(bmp, static_cast<CBitmap*>(0));
		} else {
			m_pButtonsImages->Create(bitmapBmp.bmHeight, bitmapBmp.bmHeight, ILC_COLOR24 | ILC_MASK, 1, 0);
			m_pButtonsImages->Add(bmp, RGB(255, 0, 255));
		}

		m_nButtonHeight = bitmapBmp.bmHeight;
		tb.SetImageList(m_pButtonsImages);
		fDisableImgListRemap = true;

		delete bmp;
		DeleteObject(hBmp);
	}

	if (s.fDisableXPToolbars) {
		if (!fDisableImgListRemap) {
			SwitchRemmapedImgList(IDB_PLAYERTOOLBAR, 0);// 0 Remap Active
			SwitchRemmapedImgList(IDB_PLAYERTOOLBAR, 1);// 1 Remap Disabled
		}
	} else {
		fDisableImgListRemap = true;

		if (NULL == fp) {
			SwitchRemmapedImgList(IDB_PLAYERTOOLBAR, 2);// 2 Undo  Active

			if (!fDisableImgListRemap) {
				SwitchRemmapedImgList(IDB_PLAYERTOOLBAR, 3);// 3 Undo  Disabled
			}
		}
	}

	if (::IsWindow(m_volctrl.GetSafeHwnd())) {
		m_volctrl.Invalidate();
	}

	CMainFrame* pFrame	= (CMainFrame*)GetParentFrame();
	OAFilterState fs	= pFrame->GetMediaState();

	TBBUTTONINFO bi;
	bi.cbSize = sizeof(bi);
	bi.dwMask = TBIF_IMAGE;

	if (fs == State_Running) {
		bi.iImage = 1;
	} else {
		bi.iImage = 0;
	}

	tb.SetButtonInfo(ID_PLAY_PLAY, &bi);
}