/*******************************************************************
 * Function Name: Overlay
 * Return Type 	: int
 * Created On	: Jul 7, 2013
 * Created By 	: hrushi
 * Comments		: Overlay
 * Arguments	: const AllDetectedCtrs& Ctrs, bool toDisplay
 *******************************************************************/
int DetectionImg::Overlay( const AllDetectedCtrs& AllCtrs, bool toDisplay, const Args& args)
{

	ColorImg Img;
	Img.SetImage(m_data);

	for( auto Cntur : AllCtrs.Get_vCtrs())
	{
		Img = Overlay(Cntur, false, args );
		SetImage( Img.GetDataRef() );
	}

	if( toDisplay )
	{
		if( args.GetRunMode() == OP_DEMO)
		{
			Display(0);
		}
		else
		{
			Display(DISP_DELAY);
		}
	}

	return EXIT_SUCCESS;
}
예제 #2
0
    //---------------------------------------------------------------------
    Overlay* OverlayManager::create(const String& name)
    {
        Overlay* ret = 0;
        OverlayMap::iterator i = mOverlayMap.find(name);

        if (i == mOverlayMap.end())
        {
            ret = OGRE_NEW Overlay(name);
            assert(ret && "Overlay creation failed");
            mOverlayMap[name] = ret;
        }
        else
        {
            OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, 
                "Overlay with name '" + name + "' already exists!",
                "OverlayManager::create");
        }

        return ret;

    }
예제 #3
0
boolean DisplayFrame( win32_driver_t * win32_driver )
{
	int						view_width;
	int						view_height;
	int						scaled_width;
	int						scaled_height;
	int						screen_width;
	int						screen_height;
	RECT					clipped;
	RECT					centered;

	// aspect ratio calculations

	// TODO : account for screen ratio as well

	view_width	= win32_driver->win32_visual->WndRect.right - win32_driver->win32_visual->WndRect.left;
	view_height	= win32_driver->win32_visual->WndRect.bottom - win32_driver->win32_visual->WndRect.top;

	if( view_width / win32_driver->ratio < view_height )
	{
		scaled_width = view_width - BORDER_SIZE;
		scaled_height = view_width / win32_driver->ratio - BORDER_SIZE;
	}
	else
	{
		scaled_width = view_height * win32_driver->ratio - BORDER_SIZE;
		scaled_height = view_height - BORDER_SIZE;
	}

	// center our overlay in our view frame

	centered.left = ( view_width - scaled_width ) / 2 + win32_driver->win32_visual->WndRect.left;
	centered.right = centered.left + scaled_width;
	centered.top = ( view_height - scaled_height ) / 2 + win32_driver->win32_visual->WndRect.top;
	centered.bottom = centered.top + scaled_height;

	// clip our overlay if it is off screen

	screen_width	= GetSystemMetrics( SM_CXSCREEN );
	screen_height	= GetSystemMetrics( SM_CYSCREEN );

	if( centered.left < 0 )
	{
		double x_scale = ( double ) ( view_width + centered.left ) / ( double ) view_width;
		clipped.left = win32_driver->width - ( int ) ( win32_driver->width * x_scale );
		centered.left = 0;
	}
	else
		clipped.left = 0;

	if( centered.top < 0 )
	{
		double y_scale = ( double ) ( view_height + centered.top ) / ( double ) view_height;
		clipped.left = win32_driver->height - ( int ) ( win32_driver->height * y_scale );
		centered.left = 0;
	}
	else
		clipped.top = 0;

	if( centered.right > screen_width )
	{
		double x_scale = ( double ) ( view_width - ( centered.right - screen_width ) ) / ( double ) view_width;
		clipped.right = ( int ) ( win32_driver->width * x_scale );
		centered.right = screen_width;
	}
	else
		clipped.right = win32_driver->width;

	if( centered.bottom > screen_height )
	{
		double y_scale = ( double ) ( view_height - ( centered.bottom - screen_height ) ) / ( double ) view_height;
		clipped.bottom = ( int ) ( win32_driver->height * y_scale );
		centered.bottom = screen_height;
	}
	else
		clipped.bottom = win32_driver->height;

	// if surface is entirely off screen or the
	// width or height is 0 for the overlay or
	// the output view area, then return without
	// overlay update

	if( ( centered.left > screen_width ) ||
		( centered.top >  screen_height ) ||
		( centered.right < 0 ) ||
		( centered.bottom < 0 ) ||
		( clipped.left >= clipped.right ) ||
		( clipped.top >= clipped.bottom ) ||
		( view_width <= 0 ) ||
		( view_height <= 0 ) )

		return 1;

	// we have a h/w supported overlay

	if( ( win32_driver->act_format == XINE_IMGFMT_YV12 ) || ( win32_driver->act_format == XINE_IMGFMT_YUY2 ) )
		return Overlay( win32_driver->secondary, &clipped, win32_driver->primary, &centered, win32_driver->win32_visual->ColorKey );

	// we do not have a h/w supported overlay

	return BltCopy( win32_driver->secondary, &clipped, win32_driver->primary, &centered );
}
예제 #4
0
파일: Screen.cpp 프로젝트: fathat/game-src
void Screen3D::PostOverlay( int x, int y, TextureHandle image, float alpha )
{
	OverlayQueue.push_back( Overlay( image, alpha, x, y ) );
}
예제 #5
0
static bool QuerySelection (int ai)
	{
	int i;
	float mag = 1.0;
	float magMax = 3.1;
	int spot = -1;
	int incX = 1, incY = 1;
	int y = 200;
	int yInf = 500, yTop = 400;
	u32 transp = 32, transpLimit = 224;
	
	redrawSkipInfo = 1;
	Redraw ();
	grlib_PushScreen ();
	redrawSkipInfo = 0;

	Video_SetFont(TTFNORM);
	
	for (i = 0; i < gui.spotsIdx; i++)
		{
		if (ai == gui.spots[i].id)
			spot = i;
		}
	
	if (spot < 0) return false;

	s_grlib_icon ico;
	grlib_IconInit (&ico, &gui.spots[spot].ico);
	ico.sel = true;
	
	s_grlib_iconSetting istemp;
	memcpy (&istemp, &is, sizeof(s_grlib_iconSetting));
	
	s_grlibobj black;
	black.x1 = 0;
	black.y1 = 0;
	black.x2 = grlib_GetScreenW();
	black.y2 = grlib_GetScreenH();
	black.color = RGBA(0,0,0,192);
	black.bcolor = RGBA(0,0,0,192);

	// Load full res cover
	char path[300];
	sprintf (path, "%s://apps/%s%s/icon.png", apps[ai].mount, config.subpath, apps[ai].path);
	//mt_Lock();
	GRRLIB_texImg * tex = GRRLIB_LoadTextureFromFile (path);
	//mt_Unlock();
	if (tex) ico.icon = tex;
	
	while (true)
		{
		grlib_PopScreen ();

		black.color = RGBA(0,0,0,transp);
		black.bcolor = RGBA(0,0,0,transp);
		grlib_DrawSquare (&black);
		transp += 4;
		if (transp > transpLimit) transp = transpLimit;

		istemp.magXSel = mag;
		istemp.magYSel = mag;
		
		incX = abs(ico.x - 320);
		if (incX > 10) incX = 10;

		incY = abs(ico.y - y);
		if (incY > 10) incY = 10;

		if (ico.x < 320) ico.x += incX;
		if (ico.x > 320) ico.x -= incX;

		if (ico.y < y) ico.y += incY;
		if (ico.y > y) ico.y -= incY;
		
		grlib_IconDraw (&istemp, &ico);

		DrawInfoWindow (yInf, apps[ai].name, "Press (A) to start, (B) Cancel", NULL);
		yInf -= 5;
		if (yInf < yTop) yInf = yTop;

		Overlay ();
		grlib_DrawIRCursor ();
		grlib_Render();
		
		if (mag < magMax) mag += 0.1;
		if (mag >= magMax && ico.x == 320 && ico.y == y) break;
		}
	
	u32 btn;
	while (true)
		{
		grlib_PopScreen ();

		black.color = RGBA(0,0,0,transp);
		black.bcolor = RGBA(0,0,0,transp);
		grlib_DrawSquare (&black);
		transp += 4;
		if (transp > transpLimit) transp = transpLimit;

		grlib_IconDraw (&istemp, &ico);
		Overlay ();

		DrawInfoWindow (yInf, apps[ai].name, "Press (A) to start, (B) Cancel", NULL);
		yInf -= 5;
		if (yInf < yTop) yInf = yTop;
		
		grlib_DrawIRCursor ();
		grlib_Render();
		btn = grlib_GetUserInput();
		if (btn & WPAD_BUTTON_A) return true;
		if (btn & WPAD_BUTTON_B) return false;
		}
		
	GRRLIB_FreeTexture (tex);
	return true;
	}
예제 #6
0
static int ChangePage (int next)
	{
	if (next)
		page++;
	else
		page--;
		
	if (page > pageMax)
		page = 0;
	if (page < 0)
		page = pageMax;
		
	FeedCoverCache ();

	redrawIcons = false;
	Redraw ();
	grlib_PushScreen ();
	
	int x = 0, lp;
	
	GRRLIB_SetFBMode (1); // Enable double fbmode
	
	if (!next)
		{
		do
			{
			x-=20;

			grlib_PopScreen ();

			lp = page;
			RedrawIcons (x + 640,0);
			if (page >= pageMax) page = 0; else page = lp+1;
			RedrawIcons (x,0);
			page = lp;
			
			Overlay ();
			grlib_DrawIRCursor ();
			grlib_Render();
			}
		while (x > -640);
		}
	else
		{
		do
			{
			x+=20;

			grlib_PopScreen ();

			lp = page;
			RedrawIcons (x - 640,0);
			if (page <= 0) page = pageMax; else page = lp-1;
			RedrawIcons (x,0);
			page = lp;
			
			Overlay ();
			grlib_DrawIRCursor ();
			grlib_Render();
			}
		while (x < 640);
		}
	
	redrawIcons = true;
	redraw = 1;
	
	GRRLIB_SetFBMode (0); // Enable double fbmode
	
	return page;
	}