コード例 #1
0
ファイル: Camera.cpp プロジェクト: rickcaudill/Pyro
void DockCamera::Paint( const Rect &cUpdateRect )
{
	os::Color32_s sCurrentColor = BlendColours(get_default_color(os::COL_SHINE),  get_default_color(os::COL_NORMAL_WND_BORDER), 0.5f);
	SetFgColor( Tint( get_default_color( os::COL_SHADOW ), 0.5f ) );
	os::Color32_s sBottomColor = BlendColours(get_default_color(os::COL_SHADOW), get_default_color(os::COL_NORMAL_WND_BORDER), 0.5f);
	
	os::Color32_s sColorStep = os::Color32_s( ( sCurrentColor.red-sBottomColor.red ) / 30, 
											( sCurrentColor.green-sBottomColor.green ) / 30, 
											( sCurrentColor.blue-sBottomColor.blue ) / 30, 0 );
	
	if( cUpdateRect.DoIntersect( os::Rect( 0, 0, GetBounds().right, 29 ) ) )
	{
		sCurrentColor.red -= (int)cUpdateRect.top * sColorStep.red;
		sCurrentColor.green -= (int)cUpdateRect.top * sColorStep.green;
		sCurrentColor.blue -= (int)cUpdateRect.top * sColorStep.blue;
		for( int i = (int)cUpdateRect.top; i < ( (int)cUpdateRect.bottom < 30 ? (int)cUpdateRect.bottom + 1 : 30 ); i++ )
		{
			SetFgColor( sCurrentColor );
			DrawLine( os::Point( cUpdateRect.left, i ), os::Point( cUpdateRect.right, i ) );
			sCurrentColor.red -= sColorStep.red;
			sCurrentColor.green -= sColorStep.green;
			sCurrentColor.blue -= sColorStep.blue;
		}
	}

	SetDrawingMode( os::DM_BLEND );
	if (pcPaint && !m_bHover)	
		pcPaint->Draw( Point(0,0), this );
	else
	{
		m_pcIcon->Draw(Point(0,0),this);
	}

	SetDrawingMode(DM_COPY);
}
コード例 #2
0
ファイル: Camera.cpp プロジェクト: rickcaudill/Pyro
void CameraDelayedLooper::TimerTick(int nID)
{
	
	if (nID == CAMERA_ID)
	{
		DateTime pcTime = DateTime::Now();
		
		BitmapImage* pcBitmapImage;
		BitmapImage* pcSaveImage;
		os::String cScreenShotPath;
		os::Desktop m_Screen;
	
	
		pcSaveImage = new os::BitmapImage( Bitmap::SHARE_FRAMEBUFFER | Bitmap::ACCEPT_VIEWS );
		pcSaveImage->SetColorSpace( CS_RGBA32 );
		pcSaveImage->ResizeCanvas( os::Point( m_Screen.GetResolution() ) );
		
		
		pcBitmapImage = new os::BitmapImage((uint8*)m_Screen.GetFrameBuffer(),m_Screen.GetResolution(),m_Screen.GetColorSpace());
		pcBitmapImage->Draw( os::Point( 0, 0 ), pcSaveImage->GetView() );
		pcSaveImage->Sync();
	
		cScreenShotPath = os::String().Format("%s/Pictures/Screenshot-%d-%d-%d-%d_%d_%d.png",getenv("HOME"),pcTime.GetYear(),pcTime.GetMonth(),pcTime.GetDay(),pcTime.GetHour(),pcTime.GetMin(),pcTime.GetSec());
		File vNewFile = os::File(cScreenShotPath,O_CREAT | O_TRUNC | O_WRONLY);
		vNewFile.WriteAttr("os::MimeType", O_TRUNC, ATTR_TYPE_STRING,"image/png", 0,10 );
		pcSaveImage->Save(&vNewFile,"image/png");
		vNewFile.Flush();
		
		delete( pcSaveImage );
		delete pcBitmapImage;
		RemoveTimer(this,nID);
	}
}