void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
{
   bool highlight = mMouseOver;

   ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;

   RectI renderRect( offset, getExtent() );
   if ( !highlight )
      renderRect.inset( 1, 1 );      

   GFXDrawUtil *drawer = GFX->getDrawUtil();
   drawer->clearBitmapModulation();

   // Draw background transparency grid texture...
   if ( mGrid.isValid() )
      drawer->drawBitmapStretch( mGrid, renderRect );

   // Draw swatch color as fill...
   if (!mUseSRGB)
      drawer->drawRectFill( renderRect, mSwatchColor.toGamma() );
   else
      drawer->drawRectFill(renderRect, mSwatchColor);

   // Draw any borders...
   drawer->drawRect( renderRect, borderColor );
}
Exemple #2
0
void GuiTheoraCtrl::onRender(Point2I offset, const RectI &updateRect)
{
	if( mDone && mIsLooping )  
		mTheoraTexture.play(); 

   const RectI rect(offset, getBounds().extent);

	if( mTheoraTexture.isReady() )
	{
      mTheoraTexture.refresh();
      if( mTheoraTexture.isPlaying()
          || mTheoraTexture.isPaused() )
      {
         // Draw the frame.
         
         GFXDrawUtil* drawUtil = GFX->getDrawUtil();
         drawUtil->clearBitmapModulation();
         drawUtil->drawBitmapStretch( mTheoraTexture.getTexture(), rect );
         
         // Draw frame info, if requested.
         
         if( mRenderDebugInfo )
         {
            String info = String::ToString( "Frame Number: %i | Frame Time: %.2fs | Playback Time: %.2fs | Dropped: %i",
               mTheoraTexture.getFrameNumber(),
               mTheoraTexture.getFrameTime(),
               F32( mTheoraTexture.getPosition() ) / 1000.f,
               mTheoraTexture.getNumDroppedFrames() );
            
            drawUtil->setBitmapModulation( mProfile->mFontColors[ 0 ] );
            drawUtil->drawText( mProfile->mFont, localToGlobalCoord( Point2I( 0, 0 ) ), info, mProfile->mFontColors );
         }
      }
      else
         mDone = true;
	}
	else
 		GFX->getDrawUtil()->drawRectFill(rect, mBackgroundColor); // black rect

	renderChildControls(offset, updateRect);
}