当前位置: 首页>>代码示例>>C++>>正文


C++ BitmapImage::LockBitmap方法代码示例

本文整理汇总了C++中BitmapImage::LockBitmap方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapImage::LockBitmap方法的具体用法?C++ BitmapImage::LockBitmap怎么用?C++ BitmapImage::LockBitmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitmapImage的用法示例。


在下文中一共展示了BitmapImage::LockBitmap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MouseMove

void DockCamera::MouseMove( const os::Point& cNewPos, int nCode, uint32 nButtons, os::Message* pcData )
{
	if (nCode == MOUSE_INSIDE)
	{
		if (m_bHover)
		{
			Bitmap* pcBitmap = m_pcIcon->LockBitmap();
			m_bHover = false;
			if( pcPaint == NULL )
			{
				pcPaint = new BitmapImage(pcBitmap->LockRaster(),IPoint((int)m_pcIcon->GetSize().x,(int)m_pcIcon->GetSize().y),pcBitmap->GetColorSpace());;
				pcPaint->ApplyFilter(BitmapImage::F_HIGHLIGHT);
				pcBitmap->UnlockRaster();
				pcPaint->UnlockBitmap();
			}
			Invalidate(GetBounds());
			Flush();
		}
	}

	else
	{
		m_bHover = true;
		Invalidate(GetBounds());
		Flush();
	}

	if( nCode != MOUSE_ENTERED && nCode != MOUSE_EXITED )
	{
		/* Create dragging operation */
		if( m_bCanDrag )
		{
			BitmapImage* pcIcon = m_pcIcon;
			m_bDragging = true;
			os::Message* pcMsg = new os::Message();
			BeginDrag( pcMsg, os::Point( pcIcon->GetBounds().Width() / 2,
											pcIcon->GetBounds().Height() / 2 ),pcIcon->LockBitmap() );
			delete( pcMsg );
			m_bCanDrag = false;
			Paint(GetBounds());
		}
	}

	os::View::MouseMove( cNewPos, nCode, nButtons, pcData );
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:45,代码来源:Camera.cpp

示例2: Paint

void Icon::Paint( const Rect &cUpdateRect )
{
	EraseRect( cUpdateRect );

	if( m_bSelected )
	{
		Rect cUpdateFrame = GetBounds();
		cUpdateFrame.top += 2;
		cUpdateFrame.left += 2;

		/* XXXKV: This is a hack; why is the height from GetBounds() so large? */
		cUpdateFrame.right = m_cSize.x - 2;
		cUpdateFrame.bottom = m_cSize.y - 2;

		FillRect( cUpdateFrame, m_sHighlightColor );

		/* Round edges */
		SetDrawingMode( DM_COPY );
		SetFgColor( m_sHighlightColor );

		DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.top - 2 ), 
					os::Point( cUpdateFrame.right - 2, cUpdateFrame.top - 2 ) );
		DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.top - 1 ), 
					os::Point( cUpdateFrame.right, cUpdateFrame.top - 1 ) );
			
		DrawLine( os::Point( cUpdateFrame.left - 2, cUpdateFrame.top + 2 ), 
					os::Point( cUpdateFrame.left - 2, cUpdateFrame.bottom - 2 ) );
		DrawLine( os::Point( cUpdateFrame.left - 1, cUpdateFrame.top ), 
					os::Point( cUpdateFrame.left - 1, cUpdateFrame.bottom ) );
								
		DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.bottom + 2 ), 
					os::Point( cUpdateFrame.right - 2, cUpdateFrame.bottom + 2 ) );
		DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.bottom + 1 ), 
					os::Point( cUpdateFrame.right, cUpdateFrame.bottom + 1 ) );
								
		DrawLine( os::Point( cUpdateFrame.right + 2, cUpdateFrame.top + 2 ), 
						os::Point( cUpdateFrame.right + 2, cUpdateFrame.bottom - 2 ) );
		DrawLine( os::Point( cUpdateFrame.right + 1, cUpdateFrame.top ), 
					os::Point( cUpdateFrame.right + 1, cUpdateFrame.bottom ) );

		SetFgColor( m_sFgColor );
	}

	SetDrawingMode( DM_BLEND );

	/* XXXKV: Will only work with BitmapImage; should use RTTI to find
	   type and handle accordingly */
	BitmapImage *pcImage = static_cast<BitmapImage*>( m_pcImage );
	Bitmap *pcBitmap = pcImage->LockBitmap();
	DrawBitmap( pcBitmap, pcImage->GetBounds(), m_cImageFrame );
	pcImage->UnlockBitmap();

	/* Draw the icon name */
	SetDrawingMode( DM_OVER );
	MovePenTo( m_cNamePos );
	DrawString( m_cName );
}
开发者ID:PyroOS,项目名称:Pyro,代码行数:57,代码来源:icon.cpp

示例3: HandleMessage

void DockCamera::HandleMessage(Message* pcMessage)
{
	switch (pcMessage->GetCode())
	{
		case M_CAMERA_ABOUT:
		{
			String cTitle = (String)"About " + (String)PLUGIN_NAME + (String)"...";
			String cInfo = (String)"Version:  " +  (String)PLUGIN_VERSION + (String)"\n\nAuthor:   " + (String)PLUGIN_AUTHOR + (String)"\n\nDesc:      " + (String)PLUGIN_DESC;	
			Alert* pcAlert = new Alert(cTitle.c_str(),cInfo.c_str(),m_pcIcon->LockBitmap(),0,"OK",NULL);
			pcAlert->Go(new Invoker());
			pcAlert->MakeFocus();
			break;
		}
		case M_PREFS:
		{
			ShowPrefs(m_pcPlugin->GetPath());
			break;
		}
		
		case M_PREFS_SEND_TO_PARENT:
		{
			pcMessage->FindFloat("click",&vClick);
			pcMessage->FindFloat("key/instant",&vInstant);
			pcMessage->FindFloat("key/delay",&vDelay);
			pcMessage->FindFloat("delay",&vDelayTime);
			SaveSettings();
			LoadSettings();
			pcPrefsWin->Close();
			pcPrefsWin = NULL;			
		
			break;
		}
		
		case M_PRINT_SCREEN:
		{
			if (bFirst)
			{
				bFirst = false;
			}
			else
			{	
				pcCameraDelayedLooper->AddTimer(pcCameraDelayedLooper,CAMERA_ID,0);
			}
			break;
		}		
	}
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:47,代码来源:Camera.cpp

示例4: cRes

TailWin::TailWin(const Rect & r, const String & file, uint32 desktopmask)
	:Window(r, "TailWin", os::String("Monitor: ") + file, 0, desktopmask)
{
	Rect bounds = GetBounds();

	m_TextView = new TailView(bounds, "tv", "", CF_FOLLOW_ALL, /*WID_FULL_UPDATE_ON_RESIZE|*/WID_WILL_DRAW);
	
	m_TextView->SetMultiLine(true);
	m_TextView->SetReadOnly(true);
	m_TextView->MakeFocus(true);

	AddShortcut( ShortcutKey(STR_POPUPMENU_COPY_SH), new Message(ID_COPY) );
	AddShortcut( ShortcutKey(STR_POPUPMENU_CLEAR_SH), new Message(ID_CLEAR) );
	AddShortcut( ShortcutKey(STR_POPUPMENU_SAVE_SH), new Message(ID_SAVE) );
	AddShortcut( ShortcutKey(STR_POPUPMENU_ABOUT_SH), new Message(ID_ABOUT) );
	AddShortcut( ShortcutKey(STR_POPUPMENU_QUIT_SH), new Message(ID_QUIT) );

	/*Font* pcAppFont = new Font;
	pcAppFont->SetFamilyAndStyle("Lucida Sans Typewriter", "Regular");
	pcAppFont->SetSize(8);

	m_TextView->SetFont(pcAppFont);
	pcAppFont->Release();
	*/
	AddChild(m_TextView);

		/* Set the application icon */
	Resources cRes( get_image_id() );
	BitmapImage	*pcAppIcon = new BitmapImage();
	pcAppIcon->Load( cRes.GetResourceStream( "icon48x48.png" ) );
	SetIcon( pcAppIcon->LockBitmap() );
	delete( pcAppIcon );
	
	m_FileName = new String(file);
	m_LastSize = -1;

	Tail();

	AddTimer(this, 10, 1000000, false);
	// Tried using NodeMonitor, but it doesn't trigger until the file
	// is closed/opened or touched somehow. Just keeping it open and
	// writing doesn't trigger the node monitor, and most log files
	// are handled just like that...
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:44,代码来源:tailwin.cpp

示例5: HandleMessage

/*************************************************
* Description: Handles messages passed to it
* Author: Rick Caudill
* Date: Thu Mar 18 20:17:32 2004
**************************************************/
void WallpaperChangerSettings::HandleMessage(Message* pcMessage)
{
	switch (pcMessage->GetCode())
	{
		/*case M_NODE_MONITOR:
		{
			pcDirectoryList->Clear();
			LoadDirectoryList();
			break;
		}*/
		
		case M_APPLY:
		{
			SaveSettings();
			break;
		}
		
		case M_CANCEL:
		{
			Message* pcMsg = new Message(M_PREFS_CANCEL);
			pcParentLooper->PostMessage(pcMsg,pcParentView);
			break;
		}
		
		case M_DEFAULT:
		{
			break;
		}
		
		case M_CHANGE_IMAGE:
		{
			ListViewStringRow* pcRow = (ListViewStringRow*)pcDirectoryList->GetRow(pcDirectoryList->GetLastSelected());
			String cImage = getenv( "HOME" );
			cImage += String("/Pictures/") + pcRow->GetString(0);
			BitmapImage* pcNewImage = new BitmapImage(new File(cImage));
			Bitmap* pcNewBitmap = new Bitmap(201,90,CS_RGB32);
			Scale(pcNewImage->LockBitmap(),pcNewBitmap,filter_box,0);
			pcNewImage->SetBitmapData(pcNewBitmap->LockRaster(),IPoint(201,90),CS_RGB32);
			pcImageView->SetImage(pcNewImage);
			break;
		}
	}
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:48,代码来源:WallpaperChangerSettings.cpp

示例6: cSelf


//.........这里部分代码省略.........
	pcSettingsMenu->AddItem( "Configure", new Message( ID_MENU_SETTINGS_CONFIGURE ) );
	m_pcMenuBar->AddItem( pcSettingsMenu );

	m_pcBookmarksManager = new BookmarksManager();
	BookmarksMenu *pcBookmarksMenu = m_pcBookmarksManager->CreateMenu( "Bookmarks", Path( "" ) );
	m_pcMenuBar->AddItem( pcBookmarksMenu );

	m_pcMenuBar->SetTargetForItems( this );

	cMenuFrame.bottom = m_pcMenuBar->GetPreferredSize( false ).y;
	m_pcMenuBar->SetFrame( cMenuFrame );
	AddChild( m_pcMenuBar );

	/* Setup the toolbar */
	bool bShowButtonText = m_pcSettings->GetBool( "show_button_text", true );
	m_pcToolBar = new ToolBar( Rect(), "toolbar", CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP );

	ResStream *pcStream;
	File cSelf( open_image_file( get_image_id() ) );
	Resources cCol( &cSelf );		

	m_pcBackButton = new ImageButton( Rect(), "back", "Back", new Message(ID_BUTTON_BACK), NULL, ImageButton::IB_TEXT_BOTTOM, true, bShowButtonText, true );
	pcStream = cCol.GetResourceStream( "back.png" );
	m_pcBackButton->SetImage( pcStream );
	delete( pcStream );

	m_pcForwardButton = new ImageButton( Rect(), "foward", "Forward", new Message(ID_BUTTON_FORWARD), NULL, ImageButton::IB_TEXT_BOTTOM, true, bShowButtonText, true );
	pcStream = cCol.GetResourceStream( "forward.png" );
	m_pcForwardButton->SetImage( pcStream );
	delete( pcStream );

	m_pcReloadButton = new ImageButton( Rect(), "reload", "Reload", new Message(ID_BUTTON_RELOAD), NULL, ImageButton::IB_TEXT_BOTTOM, true, bShowButtonText, true );
	pcStream = cCol.GetResourceStream( "reload.png" );
	m_pcReloadButton->SetImage( pcStream );
	delete( pcStream );

	m_pcStopButton = new ImageButton( Rect(), "stop", "Stop", new Message(ID_BUTTON_STOP), NULL, ImageButton::IB_TEXT_BOTTOM, true, bShowButtonText, true );
	pcStream = cCol.GetResourceStream( "stop.png" );
	m_pcStopButton->SetImage( pcStream );
	delete( pcStream );

	m_pcHomeButton = new ImageButton( Rect(), "home", "Home", new Message(ID_BUTTON_HOME), NULL, ImageButton::IB_TEXT_BOTTOM, true, bShowButtonText, true );
	pcStream = cCol.GetResourceStream( "home.png" );
	m_pcHomeButton->SetImage( pcStream );
	delete( pcStream );

	m_pcBackButton->SetEnable( false );
	m_pcForwardButton->SetEnable( false );
	m_pcStopButton->SetEnable( false );

	m_pcToolBar->AddChild( m_pcBackButton, ToolBar::TB_FIXED_WIDTH );
	m_pcToolBar->AddChild( m_pcForwardButton, ToolBar::TB_FIXED_WIDTH );
	m_pcToolBar->AddChild( m_pcReloadButton, ToolBar::TB_FIXED_WIDTH );
	m_pcToolBar->AddChild( m_pcStopButton, ToolBar::TB_FIXED_WIDTH );
	m_pcToolBar->AddChild( m_pcHomeButton, ToolBar::TB_FIXED_WIDTH );

	m_pcUrlEdit = new UrlEdit( Rect(), "urledit", CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP );
	m_pcUrlEdit->SetMinPreferredSize( 32 );
	m_pcUrlEdit->SetMaxPreferredSize( 256 );
	m_pcUrlEdit->SetEditMessage( new Message( ID_URL_CHANGED ) );
	m_pcUrlEdit->SetSelectionMessage( new Message( ID_URL_CHANGED ) );
	m_pcUrlEdit->SetTarget( this, this );

	m_pcToolBar->AddChild( m_pcUrlEdit, ToolBar::TB_FREE_WIDTH );

	cToolFrame.top = cMenuFrame.bottom + 1.0f;
	cToolFrame.bottom = cToolFrame.top + m_pcToolBar->GetPreferredSize(false).y;
	m_pcToolBar->SetFrame( cToolFrame );
	AddChild( m_pcToolBar );

	m_pcStatusBar = new StatusBar( Rect(), "statusbar", CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_BOTTOM );
	m_pcStatusBar->AddPanel( "text", "" );

	m_pcProgress = new ProgressPanel( "progress", 10 );
	m_pcStatusBar->AddPanel( m_pcProgress );

	cStatusFrame.top = cStatusFrame.bottom - 20;
	m_pcStatusBar->SetFrame( cStatusFrame );
	AddChild( m_pcStatusBar );

	cTabFrame.top = cToolFrame.bottom + 1.0f;
	cTabFrame.bottom = cStatusFrame.top - 1.0f;

	m_pcTabView = new TabView( cTabFrame, "webviewtabs", CF_FOLLOW_ALL );
	m_pcTabView->SetMessage( new Message( ID_TAB_CHANGED ) );
	AddChild( m_pcTabView );

	/* Create a tab and open the homepage, if one is configured */
	CreateTab( m_pcSettings->GetString( "homepage", "about:blank" ) );

	/* Set Window icon */
	pcStream = cCol.GetResourceStream( "icon24x24.png" );
	BitmapImage *pcIcon = new BitmapImage( pcStream );
	delete( pcStream );
	SetIcon( pcIcon->LockBitmap() );
	delete( pcIcon );

	/* Nothing is being loaded at this point */
	UpdateButtonState( false );
}
开发者ID:PyroOS,项目名称:Pyro,代码行数:101,代码来源:main.cpp


注:本文中的BitmapImage::LockBitmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。