示例#1
0
	void GingaNclGfx::showText(IWindow* window, string text) {
		ISurface* s;
		IColor* fontColor;
		IColor* bgColor;
		string fontUri;
		int fontSize;

		fontUri = "/usr/local/lib/ginga/files/font/decker.ttf";
		fontSize = 12;

		if (!fileExists(fontUri)) {
			cout << "GingaNclGfx::show Warning! File not found: '";
			cout << fontUri.c_str() << "'" << endl;
			return;
		}

		IComponentManager* cm = IComponentManager::getCMInstance();
		IFontProvider* font = NULL;

		window->clearContent();
		window->show();
		if (cm != NULL) {
			font = ((FontProviderCreator*)(cm->getObject("FontProvider")))(
					fontUri.c_str(), fontSize);

			s = ((SurfaceCreator*)(cm->getObject("Surface")))(NULL, 0, 0);
			s->setParent(window);
		}

		bgColor = new Color("black");
		fontColor = new Color("white");

		if (font != NULL) {
			s->setFont(font);
			s->setColor(fontColor);

			font->playOver(
					(void*)s,
					text.c_str(), 0, 0, (0x00000004 | 0x00000000));

			delete font;
			font = NULL;

			delete bgColor;
			bgColor = NULL;

			delete s;
			s = NULL;
		}

		delete fontColor;
		fontColor = NULL;

		window->validate();
		window->raiseToTop();
	}
示例#2
0
void BitmapSprite::apply(ISurface& surface, const size_t x, const size_t y)
{
	for (size_t yi = 0; yi < mHeight; yi++)
		for (size_t xi = 0; xi < mWidth; xi++)
			{
				ColorRGB original_color = surface.peek(xi + x, yi + y);
				ColorRGB new_color = peek(xi, yi);
				new_color.blue = ____applyAlpha(original_color.blue, new_color.blue, mAlpha);
				new_color.green = ____applyAlpha(original_color.green, new_color.green, mAlpha);
				new_color.red = ____applyAlpha(original_color.red, new_color.red, mAlpha);
				surface.plot(xi + x, yi + y, new_color);
			}
}
	void ShowButton::render(string mrl) {
		ISurface* surface;
		surface = ImagePlayer::renderImage(mrl);
		if (win == NULL) {
			initializeWindow();
		}

		if (surface->setParent((void*)win)) {
			win->renderFrom(surface);
		}
		win->show();
		win->raiseToTop();
		delete surface;
		surface = NULL;
	}
示例#4
0
Margins Caption::draw(ISurface& surface)
{
	Point topleft(0, 0), rightbottom(surface.getWidth(), mHeight);
	ViewPort vp(surface, topleft, rightbottom);
	Drawer drawer(vp);
	Point _topleft(0, 0), _rightbottom(vp.getWidth() - 1, vp.getHeight() - 1);
	drawer.filled_rectangle(_topleft, _rightbottom, mColor);
	Drawer linedrawer(surface);
	topleft.y = mHeight;
	linedrawer.line(topleft, rightbottom, mLineColor);

	{
		ITextOutput* text_output = provideTextOutput(vp);
		text_output->setFont(mFont);
		text_output->setColor(mFontColor);
		text_output->setMargins(mMargins);
		System::Alignments align = System::getSystemProperties().getAlignments(System::SYSALIGN_CAPTION_TEXT);
		text_output->setHAlignment(align.first);
		text_output->setVAlignment(align.second);
		text_output->print(mTitle);
		delete text_output;
	}

	Margins results;
	results.mBottom = results.mLeft = results.mRight = 0;
	results.mTop = mHeight + 1;

	IElement::draw(vp);

	return results;
}
示例#5
0
Margins EditBox::draw(ISurface& master)
{
	if (isHidden())
		return Margins();
	CST::Common::scoped_lock lock(mLock);
	Margins margins = getMargins();
	if (!mFrameColor.isUndefined())
	{
		Drawer drawer(master);
		drawer.rectangle(Point(0, 0), Point(master.getWidth() - 1, master.getHeight() - 1), mFrameColor);
		margins += Margins(1, 1, 1, 1);
	}
	if (!mBackgroundColor.isUndefined())
	{
		Drawer drawer(master);
		drawer.filled_rectangle(Point(1, 1), Point(master.getWidth() - 2, master.getHeight() - 2), mBackgroundColor);
	}
	ViewPort basic_surface(master, margins.getTopLeft(master), margins.getRightBottom(master));
	if (mCursor)
	{
		if (mCursorColor.isUndefined())
		{
			Color color = getColor();
			Componentality::Graphics::Color cursor_color(255 - color.operator Componentality::Graphics::ColorRGB().red,
				255 - color.operator Componentality::Graphics::ColorRGB().green,
				255 - color.operator Componentality::Graphics::ColorRGB().blue);
			mCursor->setColor(cursor_color);
		}
		else
			mCursor->setColor(mCursorColor);
		std::pair<Point, std::pair<size_t, size_t> > cursor_defs = positionCursor(basic_surface);
		mCursor->setLocation(cursor_defs.first + margins.getTopLeft(master));
		mCursor->setSize(cursor_defs.second.first, cursor_defs.second.second);
		mCursor->reset();
	}
	Font* font = System::getSystemProperties().getFontSet().find(this->getFont());
	MovingPort surface(basic_surface, -(int) mScrolling, 0);
	if (font)
	{
		std::list<int> text = getText();
		font->setForeground(mColor);
		font->print(surface, Point(1, 0), text);
	}
	IElement::draw(surface);
	return margins;
}
示例#6
0
static int l_new (lua_State* L)
{
	Canvas* canvas = CHECKCANVAS(L);
	ISurface* sfc = NULL;
	int type = lua_type(L, 2);

	switch (type)
	{
		// IMAGE
		// [ canvas | img_path ]
		case LUA_TSTRING: {
			sfc = ImagePlayer::renderImage(
					(char*)luaL_checkstring(L, 2));

			break;
		}

		// NEW { w, h }
		// [ canvas | w | h ]
		case LUA_TNUMBER: {
#if HAVE_COMPSUPPORT
			sfc = ((SurfaceCreator*)(
					cm->getObject("Surface")))(
							NULL,
							luaL_checkint(L, 2),
							luaL_checkint(L, 3));

			sfc->setBgColor(canvas->color);
			sfc->clearContent();
#else
			sfc = new DFBSurface(luaL_checkint(L, 2), luaL_checkint(L, 3));
			sfc->setBgColor(canvas->color);
			sfc->clearContent();
#endif
			break;
		}

		default:
			return luaL_argerror(L, 2, NULL);
	}

	return lua_createcanvas(L, sfc, 1);  // [ ... | canvas ] -> canvas
}
示例#7
0
void Componentality::Graphics::operator-=(ISurface& dst, ISurface& src)
{
	for (size_t i = 0; i < ____min(dst.getWidth(), src.getWidth()); i++)
		for (size_t j = 0; j < ____min(dst.getHeight(), src.getHeight()); j++)
		{
			ColorRGB dst_color = dst.peek(i, j);
			ColorRGB src_color = src.peek(i, j);
			dst_color.red -= src_color.red;
			dst_color.green -= src_color.green;
			dst_color.blue -= src_color.blue;
			dst.plot(i, j, dst_color);
		}
}
示例#8
0
    void SurfaceManager::initialize(Detector& description) {
      
      const std::vector<std::string>& types = description.detectorTypes() ;

      for(unsigned i=0,N=types.size();i<N;++i){

	const std::vector<DetElement>& dets = description.detectors( types[i] ) ;  

	for(unsigned j=0,M=dets.size();j<M;++j){

	  std::string name = dets[j].name() ;

	  SurfaceHelper surfH( dets[j] ) ;
	  
	  const SurfaceList& detSL = surfH.surfaceList() ;
  
	  // add an empty map for this detector in case there are no surfaces attached 
	  _map.insert(  std::make_pair( name , SurfaceMap() ) )  ;

	  for( SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){
	    ISurface* surf =  *it ;
	    
	    // enter surface into map for this detector
	    _map[ name ].insert( std::make_pair( surf->id(), surf )  ) ;

	    // enter surface into map for detector type
	    _map[ types[i] ].insert( std::make_pair( surf->id(), surf )  ) ;

	    // enter surface into world map 
	    _map[ "world" ].insert( std::make_pair( surf->id(), surf )  ) ;

	  }
	}
      }

    }
示例#9
0
文件: frame.cpp 项目: YemSalat/jetcat
Margins Frame::draw(ISurface& surface)
{
	Point topleft(mWidth / 2, mWidth / 2), bottomright(surface.getWidth() - mWidth / 2 - 1, surface.getHeight() - mWidth / 2 - 1);
	AdvancedSurface asurface(surface);
	SquareBrush brush(mWidth);
	asurface.setBrush(&brush);
	Drawer drawer(asurface);
	drawer.rectangle(topleft, bottomright, mColor);
	Margins result;
	result.mBottom = result.mLeft = result.mRight = result.mTop = mWidth;

	ViewPort port = getDrawArea(surface, result);
	IElement::draw(port);
	return result;
}
示例#10
0
std::pair<Point, std::pair<size_t, size_t> > EditBox::positionCursor(ISurface& surface)
{
	CST::Common::scoped_lock lock(mLock);
	std::pair<Point, std::pair<size_t, size_t> > result(Point(0, 0), std::pair<size_t, size_t>(0, 0));
	NullSurface null_surface((size_t)-1, (size_t)-1);
	Font* font = System::getSystemProperties().getFontSet().find(this->getFont());
	if (!font)
		return result;
	Measurer measurer(this->mPosition);
	std::list<int> string = getText();
	font->print(null_surface, Point(0, 0), string, &measurer);
	if (System::getSystemProperties().getCursorType() == System::SYSCURSOR_HORIZONTAL)
	{
		result.first.x = mPosition < string.size() ? measurer.mBegin : measurer.mTotal;
		result.second.first = (measurer.mBegin != (size_t)-1) && (measurer.mEnd != (size_t)-1) ? measurer.mEnd - measurer.mBegin : font->getHeight() / 2;
		result.first.y = font->getBaseline() + System::getSystemProperties().getCursorIndent();
		result.second.second = mCursor->getSize().second;
	}
	else if (System::getSystemProperties().getCursorType() == System::SYSCURSOR_VERTICAL)
	{
		result.first.x = mPosition < string.size() ? measurer.mBegin : measurer.mTotal;
		result.second.first = mCursor->getSize().first;
		result.first.y = 0;
		result.second.second = font->getHeight() - result.first.y;
	}
	while (result.first.x + mSpace >= mScrolling + (int) surface.getWidth())
	{
		mScrolling += mSpace;
	}
	while (result.first.x < mScrolling)
	{
		mScrolling -= ____min(mSpace, mScrolling);
	}
	result.first.x -= mScrolling;
	return result;
}
示例#11
0
///////////////////////////////////////////////////////////////////////////////
///  public  TraiterFichierDeScene \n
///  Description : Traite le fichier de données de la scène
///
///  @param [in]       Fichier const char *    Fichier à traiter
///
///  @return None
///
///  @author Olivier Dionne 
///  @date   13/08/2008
///
///////////////////////////////////////////////////////////////////////////////
void CScene::TraiterFichierDeScene( const char* Fichier )
{
    fstream FichierScene( Fichier, ios::in );

    if( FichierScene.is_open() )
    {
        EtatTraitementScene EtatCourant = TRAITEMENT_SCENE;
        EtatTraitementScene EtatNouveau = TRAITEMENT_SCENE;

        char Line[ NB_MAX_CAR_PAR_LIGNE ];
        string Buffer;
        int count = 0;

        CLumiere* Lumiere = NULL;
        ISurface* Surface = NULL;

        float Val0, Val1, Val2;
        int  R, G, B;

        while( !FichierScene.eof() )
        {
            FichierScene.getline( Line, NB_MAX_CAR_PAR_LIGNE );
            Buffer = Line;
            CStringUtils::Trim( Buffer, " " );
            
            // Passer les lignes vides et les commentaires
            if( Buffer.empty() || Buffer[ 0 ] == '*' )
                continue;
            else
            {
                // Vérifier l'arrivée d'un nouvel état de traitement
                bool EstNouvelObjetScene = true;
                if     ( STRING_CHECKFIND( Buffer, "Lumiere:" ) ) EtatNouveau = TRAITEMENT_LUMIERE;
                else if( STRING_CHECKFIND( Buffer, "Poly:"    ) ) EtatNouveau = TRAITEMENT_TRIANGLE;
                else if( STRING_CHECKFIND( Buffer, "Plane:"   ) ) EtatNouveau = TRAITEMENT_PLAN;
                else if( STRING_CHECKFIND( Buffer, "Quad:"    ) ) EtatNouveau = TRAITEMENT_QUADRIQUE;
                else
                    EstNouvelObjetScene = false;

                if( EstNouvelObjetScene )
                {
                    // Ajouter objet nouvellement traité à la scène
                    if( EtatCourant != TRAITEMENT_SCENE )
                    {
                        if( EtatCourant == TRAITEMENT_LUMIERE ) 
                            AjouterLumiere( Lumiere );
                        else        
                            AjouterSurface( Surface );

                        Surface = NULL;
                        Lumiere = NULL;
                    }

                    // Substituer le nouvel état pour l'ancien
                    EtatCourant = EtatNouveau;
                    
                    // créer un nouvel objet de scène puis le remplir
                    switch( EtatCourant )
                    {
                        case TRAITEMENT_LUMIERE:
                            Lumiere = new CLumiere();
                            cout << "[ACTION]: Creation d'une lumiere..." << endl;
                            break;
                        case TRAITEMENT_TRIANGLE:
                            Surface = new CTriangle();
                            cout << "[ACTION]: Creation d'un triangle..." << endl;
                            break;
                        case TRAITEMENT_PLAN:
                            Surface = new CPlan();
                            cout << "[ACTION]: Creation d'un plan..." << endl;
                            break;
                        case TRAITEMENT_QUADRIQUE:
                            Surface = new CQuadrique();
                            cout << "[ACTION]: Creation d'une quadrique..." << endl;
                            break;
                    }
                }
                else
                {
                    // Remplir les informations génériques de l'objet courant
                    if( Surface != NULL )
                    {
                        bool IsGenericSurfaceInfo = true;

                        if( STRING_CHECKFIND( Buffer, "color:" ) )
                        { 
                            sscanf( Buffer.c_str(), "%s %i %i %i", Line, &R, &G, &B );
                            Surface->AjusterCouleur( CCouleur( R, G, B ) );
                        }
                        else if( STRING_CHECKFIND( Buffer, "ambient:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f", Line, &Val0 );
                            Surface->AjusterCoeffAmbiant( Val0 );
                        }
                        else if( STRING_CHECKFIND( Buffer, "diffus:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f", Line, &Val0 );
                            Surface->AjusterCoeffDiffus( Val0 );
                        }
                        else if( STRING_CHECKFIND( Buffer, "specular:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f %f", Line, &Val0, &Val1 );
                            Surface->AjusterCoeffSpeculaire( Val0 );
                            Surface->AjusterCoeffBrillance( Val1 );
                        }
                        else if( STRING_CHECKFIND( Buffer, "reflect:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f", Line, &Val0 );
                            Surface->AjusterCoeffReflexion( Val0 );
                        }
                        else if( STRING_CHECKFIND( Buffer, "refract:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f %f", Line, &Val0, &Val1 );
                            Surface->AjusterCoeffRefraction( Val0 );
                            Surface->AjusterIndiceRefraction( Val1 );
                        }
                        else if( STRING_CHECKFIND( Buffer, "rotate:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                            
                            CMatrice4 Transform = Surface->ObtenirTransformation();
                            Transform.RotationAutourDesX( Deg2Rad<REAL>( Val0 ) );
                            Transform.RotationAutourDesY( Deg2Rad<REAL>( Val1 ) );
                            Transform.RotationAutourDesZ( Deg2Rad<REAL>( Val2 ) );
                            Surface->AjusterTransformation( Transform );
                        }
                        else if( STRING_CHECKFIND( Buffer, "translate:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                            CMatrice4 Transform = Surface->ObtenirTransformation();
                            Transform.Translation( Val0, Val1, Val2 );
                            Surface->AjusterTransformation( Transform );
                        }
                        else if( STRING_CHECKFIND( Buffer, "scale:" ) )
                        {
                            sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                            CMatrice4 Transform = Surface->ObtenirTransformation();
                            Transform.MiseAEchelle( Val0, Val1, Val2 );
                            Surface->AjusterTransformation( Transform );
                        }
                        else
                            IsGenericSurfaceInfo = false;

                        if( IsGenericSurfaceInfo )
                            continue;
                    }

                    // Remplir les infos spécifiques à l'objet
                    switch( EtatCourant )
                    {
                        case TRAITEMENT_SCENE:

                            if( STRING_CHECKFIND( Buffer, "background:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %i %i %i", Line, &R, &G, &B );
                                AjusterCouleurArrierePlan( CCouleur( R, G, B ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "origin:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                AjusterPositionCamera( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "eye:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                AjusterPointViseCamera( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "up:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                AjusterVecteurUpCamera( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            
                            
                            break;

                        case TRAITEMENT_LUMIERE:

                            if( STRING_CHECKFIND( Buffer, "position:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                Lumiere->SetPosition( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "intens:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f", Line, &Val0 );
                                Lumiere->SetIntensity( Val0 );
                            }
                            else if( STRING_CHECKFIND( Buffer, "color:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %i %i %i", Line, &R, &G, &B );
                                Lumiere->AjusterCouleur( CCouleur( R, G, B ) );    
                            }

                            break;

                        case TRAITEMENT_TRIANGLE:

                            if( STRING_CHECKFIND( Buffer, "point:" ) )
                            {
                                int PtIdx;
                                sscanf( Buffer.c_str(), "%s %i %f %f %f", Line, &PtIdx, &Val0, &Val1, &Val2 );
                                ( ( CTriangle* )Surface )->AjusterPoint( PtIdx, CVecteur3( Val0, Val1, Val2 ) );
                            }

                            break;

                        case TRAITEMENT_PLAN:

                            if( STRING_CHECKFIND( Buffer, "v_linear:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                ( ( CPlan* )Surface )->AjusterNormale( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "v_const:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f", Line, &Val0 );
                                ( ( CPlan* )Surface )->AjusterConstante( Val0 );
                            }

                            break;

                        case TRAITEMENT_QUADRIQUE:

                            if( STRING_CHECKFIND( Buffer, "v_quad:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                ( ( CQuadrique* )Surface )->AjusterQuadratique( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "v_mixte:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                ( ( CQuadrique* )Surface )->AjusterMixte( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "v_linear:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f %f %f", Line, &Val0, &Val1, &Val2 );
                                ( ( CQuadrique* )Surface )->AjusterLineaire( CVecteur3( Val0, Val1, Val2 ) );
                            }
                            else if( STRING_CHECKFIND( Buffer, "v_const:" ) )
                            {
                                sscanf( Buffer.c_str(), "%s %f", Line, &Val0 );
                                ( ( CQuadrique* )Surface )->AjusterConstante( Val0 );
                            }

                            break;
                    }
                }
            }
        }

        // Fermer le fichier de scène
        FichierScene.close();

        // Ajouter le dernier objet traité
        if( Surface != NULL ) AjouterSurface( Surface );
        if( Lumiere != NULL ) AjouterLumiere( Lumiere );
    }
    else
        cerr << "[CScene::TraiterFichierDeScene()] : Incapable d'ouvrir " << Fichier << "." << endl;

}
示例#12
0
	void GingaNclGfx::showText(IWindow* window, string text) {
		ISurface* s;
		IColor* fontColor;
		IColor* bgColor;
		string fontUri;
		int fontSize;

		fontUri = DATA_PREFIX_PATH "/share/ginga/font/decker.ttf";
		fontSize = 12;

		if (!fileExists(fontUri)) {
			cout << "GingaNclGfx::show Warning! File not found: '";
			cout << fontUri.c_str() << "'" << endl;
			return;
		}

		IFontProvider* font = NULL;

		window->clearContent();
		window->show();

#if HAVE_COMPSUPPORT
		font = ((FontProviderCreator*)(cm->getObject("FontProvider")))(
				fontUri.c_str(), fontSize);

		s = ((SurfaceCreator*)(cm->getObject("Surface")))(NULL, 0, 0);
#else
		font = new DFBFontProvider(fontUri.c_str(), fontSize);
		s = new DFBSurface();
#endif

		s->setParent(window);

		bgColor = new Color("black");
		fontColor = new Color("white");

		s->setFont(font);
		s->setColor(fontColor);

		font->playOver(
				(void*)s,
				text.c_str(), 0, 0, (0x00000004 | 0x00000000));

		delete font;
		font = NULL;

#if HAVE_COMPSUPPORT
		cm->releaseComponentFromObject("FontProvider");
#endif

		delete bgColor;
		bgColor = NULL;

		delete s;
		s = NULL;


		delete fontColor;
		fontColor = NULL;

		window->validate();
		window->raiseToTop();
	}
示例#13
0
void SurfaceWrapper::blit(ISurface& other, int x, int y) {
    SDL_Rect pos = { x, y };
    SDL_BlitSurface(other.getNativeSurface(), nullptr, surface, &pos);
}
示例#14
0
	ISurface* DFBImageProvider::prepare(bool isGif) {
		ISurface* renderedSurface = NULL;

		IDirectFBImageProvider* ip;
		ip = (IDirectFBImageProvider*)decoder;

		DFBImageDescription imgDsc;
		IDirectFBSurface* destination = NULL;
		DFBSurfaceDescription surDsc;
		IColor* chromaKey = NULL;

		//IDirectFBSurface* source;
		if ((ip->GetImageDescription(ip, &imgDsc) == DFB_OK) &&
			 (ip->GetSurfaceDescription(ip, &surDsc) == DFB_OK)) {

			destination = (IDirectFBSurface*)(
					LocalDeviceManager::getInstance()->createSurface(&surDsc));

			renderedSurface = new DFBSurface(destination);

			if (imgDsc.caps & DICAPS_ALPHACHANNEL) {
				/*cout << "ImagePlayer::ImagePlayer(" << mrl << ")";
				cout << " setted alphachannel: ";*/

				//alpha channel of gif does not exists anymore, it turn into
				//black src color key (marcio 20/04/2007)
				if (isGif) {
					chromaKey = new Color(0, 0, 0);
					renderedSurface->setChromaColor(chromaKey);
					//outputDisplay->setColorKey(0, 0, 0);
					//cout << "black color cause it is a gif image" << endl;

				} else {
					renderedSurface->setCaps(DWCAPS_ALPHACHANNEL);
				}

				//cout << " trying to blit image alpha channel" << endl;

				DFBCHECK(destination->SetBlittingFlags(destination,
					 (DFBSurfaceBlittingFlags)(DSBLIT_BLEND_ALPHACHANNEL)));

				/*cout << "ImagePlayer::ImagePlayer(" << mrl << ")";
				cout << " setted alpha: '";
				cout << (((int)(imgDsc.colorkey_r & 0xFF)) & 0xFF);
				cout << ", " << (((int)(imgDsc.colorkey_g)) & 0xFF);
				cout << ", " << (((int)(imgDsc.colorkey_b)) & 0xFF);
				cout << "'" << endl;*/
			}

			if (imgDsc.caps & DICAPS_COLORKEY) {
				chromaKey = new Color(
					    imgDsc.colorkey_r,
					    imgDsc.colorkey_g,
					    imgDsc.colorkey_b);

				DFBCHECK(destination->SetBlittingFlags(destination,
					    (DFBSurfaceBlittingFlags)(
					    DSBLIT_BLEND_ALPHACHANNEL |
					    DSBLIT_SRC_COLORKEY)));

				renderedSurface->setChromaColor(chromaKey);
				/*cout << "ImagePlayer::ImagePlayer(" << mrl << ")";
				cout << " setted colorkey: '";
				cout << (((int)(imgDsc.colorkey_r & 0xFF)) & 0xFF);
				cout << ", " << (((int)(imgDsc.colorkey_g)) & 0xFF);
				cout << ", " << (((int)(imgDsc.colorkey_b)) & 0xFF);
				cout << "'" << endl;*/
			}

			if (imgDsc.caps & DICAPS_NONE) {
				DFBCHECK(destination->SetBlittingFlags(destination,
					    (DFBSurfaceBlittingFlags)DSBLIT_NOFX));

				renderedSurface->setCaps(DWCAPS_NONE);
				/*cout << "ImagePlayer::ImagePlayer(" << mrl << ")";
				cout << " NOFX" << endl;*/
			}
		}

		if (destination != NULL && renderedSurface != NULL) {
			DFBCHECK(ip->RenderTo(
					ip,
					(IDirectFBSurface*)(renderedSurface->getContent()), NULL));
		}
		return renderedSurface;
	}
	static void *unregister_surface(void *arg) {
		ISurface *surface = (ISurface *)arg;
		surface->unregisterBuffers();
		IPCThreadState::self()->flushCommands();
		return NULL;
	}