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


C++ BBitmap::RemoveChild方法代码示例

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


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

示例1: BBitmap

static BBitmap*
MakeActuatorBitmap(bool lit)
{
	BBitmap* map = new BBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE, true);
	const rgb_color yellow = {255, 255, 0};
	const rgb_color red = {200, 200, 200};
	const rgb_color black = {0, 0, 0};
	const BPoint points[10] = {
		BPoint(8, 0), BPoint(9.8, 5.8), BPoint(16, 5.8),
		BPoint(11, 9.0), BPoint(13, 16), BPoint(8, 11),
		BPoint(3, 16), BPoint(5, 9.0), BPoint(0, 5.8),
		BPoint(6.2, 5.8) };

	BView* view = new BView(BRect(0, 0, 16, 16), NULL, B_FOLLOW_ALL_SIDES, 0L);
	map->AddChild(view);
	map->Lock();
	view->SetHighColor(B_TRANSPARENT_32_BIT);
	view->FillRect(ICON_BITMAP_RECT);
	view->SetHighColor(lit ? yellow : red);
	view->FillPolygon(points, 10);
	view->SetHighColor(black);
	view->StrokePolygon(points, 10);
	map->Unlock();
	map->RemoveChild(view);
	delete view;
	return map;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:27,代码来源:ShortcutsSpec.cpp

示例2: CreateIcon

BBitmap* MainView::CreateIcon(const rgb_color colorIn)
{
	BRect rect(0, 0, 15, 15);
	BBitmap* toReturn = new BBitmap(rect, B_CMAP8, true);
	BView* drawing = new BView(rect, 
								"drawer", 
								B_FOLLOW_LEFT | B_FOLLOW_TOP,
								B_WILL_DRAW);
	if (!drawing || !toReturn) { return NULL; }	
	toReturn->AddChild(drawing);
	if (toReturn->Lock()) {
		drawing->SetHighColor(kWhite);
		drawing->FillRect(rect);
		drawing->SetHighColor(kBlack);
		drawing->SetPenSize(1);
		drawing->StrokeRect(rect);
		drawing->SetHighColor(colorIn);
		drawing->FillRect(rect.InsetBySelf(1, 1));
		drawing->Sync();
		toReturn->Unlock();			
	}
	toReturn->RemoveChild(drawing);
	delete drawing;
	return toReturn;
}
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:25,代码来源:clsMainWindow.cpp

示例3: view

BBitmap*
PictureView::_CopyPicture(uint8 alpha)
{
	bool hasAlpha = alpha != 255;

	if (!fPicture)
		return NULL;

	BRect rect = fPictureRect.OffsetToCopy(B_ORIGIN);
	BView view(rect, NULL, B_FOLLOW_NONE, B_WILL_DRAW);
	BBitmap* bitmap = new(nothrow) BBitmap(rect, hasAlpha ? B_RGBA32
		: fPicture->ColorSpace(), true);
	if (bitmap == NULL || !bitmap->IsValid()) {
		delete bitmap;
		return NULL;
	}

	if (bitmap->Lock()) {
		bitmap->AddChild(&view);
		if (hasAlpha) {
			view.SetHighColor(0, 0, 0, 0);
			view.FillRect(rect);
			view.SetDrawingMode(B_OP_ALPHA);
			view.SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
			view.SetHighColor(0, 0, 0, alpha);
		}
		view.DrawBitmap(fPicture, fPicture->Bounds().OffsetToCopy(B_ORIGIN),
			rect, B_FILTER_BITMAP_BILINEAR);
		view.Sync();
		bitmap->RemoveChild(&view);
		bitmap->Unlock();
	}

	return bitmap;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:35,代码来源:PictureView.cpp

示例4: make_bitmap

BBitmap* SwatchView::make_bitmap(void)
{
	BRect rect(0.0, 0.0, 12.0, 12.0);
	
	BBitmap *bitmap = new BBitmap(rect, B_RGB32, true);
	BView *view = new BView(rect, "", B_FOLLOW_NONE, B_WILL_DRAW);

	bitmap->Lock();

	bitmap->AddChild(view);

	view->SetDrawingMode(B_OP_ALPHA);
	view->SetHighColor(m_color);
	view->FillRect(rect);
	
	view->SetDrawingMode(B_OP_COPY);
	view->SetHighColor(0, 0, 0, 255);
	view->StrokeRect(rect);
	view->Sync();

	bitmap->RemoveChild(view);
	delete view;

	bitmap->Unlock();
	
	return bitmap;
}
开发者ID:HaikuArchives,项目名称:HyperStudio,代码行数:27,代码来源:SwatchView.cpp

示例5: _updateBitmap

void MediaJack::_updateBitmap()
{
	D_METHOD(("MediaJack::_updateBitmap()\n"));

	if (m_bitmap)
	{
		delete m_bitmap;
	}
	BBitmap *tempBitmap = new BBitmap(Frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true);
	tempBitmap->Lock();
	{
		BView *tempView = new BView(tempBitmap->Bounds(), "", B_FOLLOW_NONE, 0);
		tempBitmap->AddChild(tempView);
		tempView->SetOrigin(0.0, 0.0);

		MediaRoutingView* mediaView = dynamic_cast<MediaRoutingView*>(view());
		int32 layout = mediaView ? mediaView->getLayout() : MediaRoutingView::M_ICON_VIEW;

		_drawInto(tempView, tempView->Bounds(), layout);

		tempView->Sync();
		tempBitmap->RemoveChild(tempView);
		delete tempView;
	}
	tempBitmap->Unlock();
	m_bitmap = new BBitmap(tempBitmap);
	delete tempBitmap;
}
开发者ID:mariuz,项目名称:haiku,代码行数:28,代码来源:MediaJack.cpp

示例6: CreateIcon

/*!
 *	\brief		Create the square icon filled with submitted color.
 *	\param[in]	color		The color of the requested icon.
 *	\param[in]	toChange	If there is an allocated item, it may be changed.
 *							If the submitted pointer is not NULL (which is default),
 *							this BBitmap is tested for dimensions match, and if dimensions
 *							allow, its contents are replaced with new icon. Else, old icon
 *							is deleted, and a new is created. In this case, both the
 *							"toChange" pointer and returned pointer point to the same
 *							BBitmap. 
 */
BBitmap* CategoryMenuItem::CreateIcon(const rgb_color colorIn, BBitmap* toChange )
{
	font_height fh;
	BFont plainFont( be_plain_font );
	plainFont.GetHeight( &fh );
	
	int squareSize = ceilf( fh.ascent + fh.descent + fh.leading - 2 );	//!< Side of the square.
	BRect rect(0, 0, squareSize, squareSize );
	BBitmap* toReturn = NULL;
	if ( !toChange )	// Checking availability of the input
	{
		toReturn = new BBitmap(rect, B_RGB32, true);
	} else {
		// It would be a good idea to check also the color space,
		// but it may be changed by the BBitmap itself, so...
		if ( ceilf ( ( toChange->Bounds() ).Width() ) != squareSize )
		{
			delete toChange;
			toChange = new BBitmap(rect, B_RGB32, true);
			if ( !toChange )
			{
				/* Panic! */
				exit(1);
			}			
		}
		toReturn = toChange;
	}
	
	BView* drawing = new BView( rect, 
								"Drawer", 
								B_FOLLOW_LEFT | B_FOLLOW_TOP,
								B_WILL_DRAW);
	if (!drawing || !toReturn) { return NULL; }	
	toReturn->AddChild(drawing);
	if (toReturn->Lock()) {
		
		// Clean the area
		drawing->SetHighColor( ui_color( B_DOCUMENT_BACKGROUND_COLOR ) );
		drawing->FillRect(rect);
		
		// Draw the black square
		drawing->SetHighColor( ui_color( B_DOCUMENT_TEXT_COLOR ) );
		drawing->SetPenSize(1);
		drawing->StrokeRect(rect);
		
		// Fill the inside of the square
		drawing->SetHighColor( colorIn );
		drawing->FillRect(rect.InsetBySelf(1, 1));
		
		// Flush the actions to BBitmap
		drawing->Sync();
		toReturn->Unlock();
	}
	toReturn->RemoveChild(drawing);			// Cleanup
	delete drawing;
	return toReturn;
}	// <-- end of function CategoryMenuItem::CreateIcon
开发者ID:HaikuArchives,项目名称:Eventual,代码行数:68,代码来源:CategoryItem.cpp

示例7: scaledBounds

status_t
MakeScreenshot(BBitmap **here)
{
	status_t err;
	BScreen bs;
	BWindow *win;
	BBitmap *shot;
	BBitmap *scaledBmp = NULL;
	be_app->Lock();
	win = be_app->WindowAt(0);
	if (win) {
		win->Lock();
		win->Hide();
		win->Unlock();
	}
	snooze(500000);
	err = bs.GetBitmap(&shot);
	if (!err) {
		BRect scaledBounds(0,0,640-1,480-1);
		scaledBmp = new BBitmap(scaledBounds, B_BITMAP_ACCEPTS_VIEWS, B_RGB32/*shot->ColorSpace()*/);
		err = scaledBmp->InitCheck();
		if (!err) {
			err = ENOSYS;
#ifdef B_ZETA_VERSION
			err = ScaleBitmap(*shot, *scaledBmp);
#endif
			if (err) {
				// filtered scaling didn't work, do it manually
				BView *v = new BView(scaledBounds, "scaleview", B_FOLLOW_NONE, 0);
				scaledBmp->AddChild(v);
				v->LockLooper();
				v->DrawBitmap(shot);
				v->Sync();
				v->UnlockLooper();
				scaledBmp->RemoveChild(v);
				delete v;
				err = B_OK;
			}
		}
		delete shot;
	}

	if (win) {
		win->Lock();
		win->Show();
		win->Unlock();
	}
	be_app->Unlock();
	
	if (err)
		return err;
	
	*here = scaledBmp;

	return B_OK;
}
开发者ID:HaikuArchives,项目名称:HaikuThemeManager,代码行数:56,代码来源:MakeScreenshot.cpp

示例8: thisView

// Create a bitmap of the graph
BBitmap * AppWindow::GetGraph(BRect &rect, color_space space) {
rect = view->Bounds();
BBitmap *bitmap = new BBitmap(rect, space, true);
View thisView(rect, view->ip, view->graph, view->f1);
	if (bitmap->Lock()) {
		bitmap->AddChild(&thisView);
		thisView.Draw(rect);
		thisView.Sync();
		bitmap->RemoveChild(&thisView);
		bitmap->Unlock();
		return bitmap;
	} else {
		delete bitmap;
		return NULL;
	}
}
开发者ID:HaikuArchives,项目名称:PlottingTools,代码行数:17,代码来源:Application.cpp

示例9: BBitmap

// GetClipping -- this will return NULL if the user hasn't selected any region of
//                the screen. If she has, it will return a BBitmap representing that
//                selection. You MUST delete it. It's not mine.
//                Anything else, it returns NULL.
BBitmap * PictureViewer::GetClipping() {
        if (thePic == NULL) return NULL;
        if (clipping == false) return NULL;
         
        BBitmap *dragImage = new BBitmap(BRect(0,0,clippingRegion.Width(),clippingRegion.Height()), thePic->ColorSpace(),true,false);

        BView *tempView = new BView(dragImage->Bounds(),"yo",0,0);
           dragImage->AddChild(tempView);
           dragImage->Lock();
           tempView->SetViewColor(0,0,0);
           float left = -clippingRegion.left;
           float top = -clippingRegion.top;
           tempView->MovePenTo( left, top);
           tempView->DrawBitmap(thePic);
           dragImage->Unlock();
           dragImage->RemoveChild(tempView);
           delete tempView;
        return dragImage;
}
开发者ID:HaikuArchives,项目名称:Peek,代码行数:23,代码来源:pictureViewer.cpp

示例10: BBitmap

BBitmap *bitmap (char *title)
{
	strcpy (title, "Grabbed");
	BBitmap *b = new BBitmap (BRect (0, 0, 127, 127), B_RGB_32_BIT, true);
	BView *v = new BView (BRect (0, 0, 127, 127), "bg", 0, 0);
	b->Lock();
	b->AddChild (v);
	rgb_color fg, bg;
	fg.red = 255; fg.green = 255; fg.blue = 255; fg.alpha = 255;
	bg.red = 0;   bg.green = 0;   bg.blue = 0;   bg.alpha = 127;
	v->SetHighColor (fg);
	v->SetLowColor (bg);
	v->FillRect (BRect (0, 0, 127, 127), B_MIXED_COLORS);
	v->Sync();
	b->RemoveChild (v);
	b->Unlock();
	delete v;
	return (b);
}
开发者ID:gedrin,项目名称:Becasso,代码行数:19,代码来源:CaptureTest.cpp

示例11: FrameResized

void CounterView::FrameResized (float width, float height)
{
  BRect BitmapRect (0, 0, width, height);
  char  TempString [40];

  m_BndRect = Bounds ();

  m_MovingDotSize = (int) (height / 20);
  if (m_MovingDotSize < 1)
    m_MovingDotSize = 1;
  m_MoveSpeed = m_MovingDotSize / 2.0;
  
  // Resize the offscreen bitmap and its view.

  if (m_BackingBitmap != NULL)
  {
    m_BackingBitmap->RemoveChild (&m_BackingView);
    delete m_BackingBitmap;
    m_BackingBitmap = NULL;
  }

  m_BackingView.ResizeTo (width, height);

  m_BackingBitmap = new BBitmap (BitmapRect, B_RGBA32, true /* Accepts subviews */);
  if (!m_BackingBitmap->IsValid ())
  {
    delete m_BackingBitmap;
    m_BackingBitmap = NULL;
  }
  else
  {
    m_BackingBitmap->AddChild (&m_BackingView);
    m_BackingBitmap->Lock ();
    m_BackingView.SetDrawingMode (B_OP_ALPHA);
    m_BackingView.SetFontSize (height * 0.8);
    sprintf (TempString, "%d", m_CurrentCount);
    m_TextStartPoint.x = width / 2 - m_BackingView.StringWidth (TempString) / 2;
    m_TextStartPoint.y = height / 2 + height * 0.25;
    m_BackingBitmap->Unlock ();
  }
}
开发者ID:kallisti5,项目名称:VNCServer,代码行数:41,代码来源:UserAppMessageMonitor.cpp

示例12: _updateBitmap

void MediaNodePanel::_updateBitmap()
{
	if (m_bitmap)
	{
		delete m_bitmap;
	}
	BBitmap *tempBitmap = new BBitmap(Frame().OffsetToCopy(0.0, 0.0), B_CMAP8, true);
	tempBitmap->Lock();
	{
		BView *tempView = new BView(tempBitmap->Bounds(), "", B_FOLLOW_NONE, 0);
		tempBitmap->AddChild(tempView);
		tempView->SetOrigin(0.0, 0.0);
	
		int32 layout = dynamic_cast<MediaRoutingView *>(view())->getLayout();	
		_drawInto(tempView, tempView->Bounds(), layout);

		tempView->Sync();
		tempBitmap->RemoveChild(tempView);
		delete tempView;
	}
	tempBitmap->Unlock();
	m_bitmap = new BBitmap(tempBitmap);
	delete tempBitmap;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:24,代码来源:MediaNodePanel.cpp

示例13: ceilf

/*!	\function	CategoryMenuItem::CreateIcon
 *	\brief		Create the square icon filled with submitted color.
 *	\param[in]	color		The color of the requested icon.
 *	\param[in]	toChange	If there is an allocated item, it may be changed.
 *							If the submitted pointer is not NULL (which is default),
 *							this BBitmap is tested for dimensions match, and if dimensions
 *							allow, its contents are replaced with new icon. Else, old icon
 *							is deleted, and a new is created. In this case, both the
 *							"toChange" pointer and returned pointer point to the same
 *							BBitmap.
 */
BBitmap*	CategoryMenuItem::CreateIcon( const rgb_color color,
										  BBitmap* toChange )
{
	BBitmap* toReturn = NULL;	//!< This is the value to be returned.
	BRect tempRect;
	float width, height, squareSide;
	
	// Get size of the square
	this->GetContentSize( &width, &height );
	squareSide = ceilf( height ) - 2;
	
	// Compare submitted bitmap to calculated size
	if ( toChange )
	{
		tempRect = toChange->Bounds();
		if ( ( tempRect.Width() != squareSide ) ||
			 ( tempRect.Height() != squareSide ) )
		{
			// Dimensions don't match - need to delete the bitmap and reallocate it
			delete toChange;
			tempRect.Set( 0, 0, squareSide, squareSide );
			toChange = new BBitmap( tempRect, B_RGB32, true );
			if ( !toChange )
			{
				/* Panic! */
				exit(1);
			}
			
			toReturn = toChange;
		}
		else
		{
			/*!	\note	Note about color spaces
			 *			Actually, even if the dimensions are correct, the existing
			 *			BBitmap may be not suitable due to incorrect color space.
			 *			However, BBitmap may change the color space on its own, (and
			 *			probably will, since there's no much sense in having 32 bits
			 *			per pixel for bitmap with only 2 colors - black for the frame
			 *			and Category's color for the inside). Therefore, color space is
			 *			not checked. It's assumed that existing color space is good enough.
			 */
			// Dimensions match, color space is not checked - continuing
			toReturn = toChange;
		}
	}
	else	// No bitmap is submitted
	{
		toReturn = new BBitmap( tempRect, B_RGB32, true );
		if ( !toReturn )
		{
			/* Panic! */
			exit(1);
		}
	}
	
	/* Here toReturn is already set. */
	
	// Add the drawing view to the bitmap
	tempRect.Set( 0, 0, squareSide, squareSide );
	BView* drawing = new BView (tempRect,
								"Drawer", 
								B_FOLLOW_LEFT | B_FOLLOW_TOP,
								B_WILL_DRAW);
	if (!drawing || !toReturn) {
		/* Panic! */
		return NULL;
	}	
	toReturn->AddChild(drawing);
	if (toReturn->Lock()) {

		// Clean the area
		drawing->SetHighColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
		drawing->FillRect( tempRect );
		
		// Draw the black square
		drawing->SetHighColor( ui_color( B_MENU_ITEM_TEXT_COLOR ) );
		drawing->SetPenSize( 1 );
		drawing->StrokeRect( tempRect );
		
		// Fill the inside of the square
		drawing->SetHighColor( color );
		drawing->FillRect( tempRect.InsetBySelf( 1, 1 ) );
		
		// Flush the actions to BBitmap
		drawing->Sync();
		toReturn->Unlock();	
	}

	toReturn->RemoveChild( drawing );
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:101,代码来源:CategoryItem.cpp

示例14: MouseDown


//.........这里部分代码省略.........
	// pick up a stack
	if (stack < 7 && fBoard[stack] != NULL
		&& point.x > hSpacing && point.y > 2 * 15 + CARD_HEIGHT) {
		// find clicked on card
		int cardNumber = 1;
		card* picked = fBoard[stack];
		while (picked->fNextCard != NULL) {
			if (point.y - 18 * cardNumber - CARD_HEIGHT - 15 < 18) {
				break;
			}
			picked = picked->fNextCard;
			cardNumber++;
		}
		if (picked->fNextCard == NULL) {
			// on last card, if below than not clicking on card
			if (point.y - 18 * cardNumber - CARD_HEIGHT - 15 >= CARD_HEIGHT) {
				return;
			}
			
			if (fDoubleClick == -1)
				fDoubleClick = 1;
			else if (fDoubleClick > -1 && fAutoPlayEnabled) {
				MoveOneToFoundation(stack, stack);
				
				CheckBoard();	
				Invalidate();
				fDoubleClick = -1;
				
				return;
			}
		}
		
		if (picked->fRevealed == false)
			return;
		
		card* currentCard = picked->fNextCard;
		card* lastCard = picked;
		short pickedHeight = 1;
		for (short i = 1; currentCard != NULL;
				i++) {
			pickedHeight++;
			if (lastCard->fIsColorRed == currentCard->fIsColorRed)
				return;
			lastCard = currentCard;
			currentCard = currentCard->fNextCard;
		}
		
		fPickedCardBoardPos = stack;
		fPickedCard = picked;
		fIsCardPicked = true;

		_RemoveCardFromPile(stack, picked);

		BMessage msg(B_SIMPLE_DATA);
		msg.AddPointer("view", this);
		BBitmap* img;
		if (pickedHeight == 1)
			img = new BBitmap(
				fCards[picked->fColor * CARDS_IN_SUIT + picked->fValue]);
		else {
			img = new BBitmap(BRect(0, 0, CARD_WIDTH - 1,
				CARD_HEIGHT + (pickedHeight - 1) * 18),
				fBack[0]->ColorSpace(), true);
			BView* imgView = new BView(img->Bounds(), NULL, 0, 0);
			BRect destRect = fBack[0]->Bounds();
			img->AddChild(imgView);
			img->Lock();
			currentCard = picked;

			imgView->SetDrawingMode(B_OP_COPY);
			imgView->DrawBitmap(fCards
				[currentCard->fColor * CARDS_IN_SUIT + currentCard->fValue],
				destRect);
			destRect.top = (pickedHeight - 1) * 18;
			destRect.bottom = destRect.top + CARD_HEIGHT;

			imgView->DrawBitmap(fBack[0], destRect);
				// we don't know the top card yet, so we'll overwrite this

			imgView->SetDrawingMode(B_OP_ALPHA);
			for (short j = 0; j < pickedHeight; j++) {
				destRect.top = j * 18;
				destRect.bottom = destRect.top + CARD_HEIGHT;
				imgView->DrawBitmap(fCards[currentCard->fColor
					* CARDS_IN_SUIT + currentCard->fValue], destRect);
				currentCard = currentCard->fNextCard;
			}
			
			imgView->Sync();
			img->Unlock();
			img->RemoveChild(imgView);
			delete imgView;
		}
		DragMessage(&msg, img, B_OP_BLEND,
			BPoint((int)(point.x - hSpacing) % (CARD_WIDTH + hSpacing),
			point.y - cardNumber * 18 - 131));
		
		Invalidate();
	}
}
开发者ID:hannahyp,项目名称:BeKlondike,代码行数:101,代码来源:KlondikeView.cpp

示例15: MouseMoved

void PatternNrButton::MouseMoved( BPoint where, uint32 code, const BMessage *a_message) {

	int32 buttons;
	Window()->CurrentMessage()->FindInt32("buttons", &buttons);
	if (!buttons && fMousePressed) fMousePressed = false;
	
	if	(!Value() || !buttons || !IsEnabled() || !fMousePressed ) return;

	// Pattern wird über ein anderes gezogen
	if (a_message && a_message->what=='drpt') {
		int32	wo = FindButtonNr( where ) - 1;
		if ( wo!=fMarked ) {
			if ( wo > -1 && (wo+1)!=Value() ) {
				SetHighColor( 30, 30, 30, 150 );
				StrokeRoundRect( fBitmap[0][0]->Bounds().OffsetToCopy( wo * 17.0, 0.0 ), 3.0, 3.0 );
				SetHighColor( 128, 128, 128, 90 );
				FillRoundRect( fBitmap[0][0]->Bounds().OffsetToCopy( wo * 17.0, 0.0 ), 3.0, 3.0 );
			}
			if (fMarked>-1) DrawBitmap( fBitmap[fMarked][Value()-1 == fMarked ? 1 : 0], BPoint( fMarked * 17.0, 0.0 ) );

			fMarked = wo;
		}
	}
	
	// Keine Drop-Message -> Nummer wird herausgezogen
	else {

		BBitmap		*dragBitmap = new BBitmap( BRect( 0.0, 0.0, fBitmap[0][0]->Bounds().right + 1, fBitmap[0][0]->Bounds().bottom + 1 ), B_RGBA32, true );
		BView		view( dragBitmap->Bounds(), 0, 0, 0 );
		dragBitmap->Lock();
		dragBitmap->AddChild( &view );
		view.SetHighColor( B_TRANSPARENT_COLOR );
		view.FillRect( view.Bounds() );

		// Bitmap
		view.SetDrawingMode(B_OP_ALPHA);
		view.SetHighColor(255, 0, 0, 150); 
		view.SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
		view.DrawBitmap( fBitmap[Value()-1][1], BPoint( 0.0, 0.0 ) );
		
		// Transparenz
		view.SetDrawingMode(B_OP_COPY);
		view.SetHighColor( B_TRANSPARENT_COLOR );
		BRect	bounds( Bounds() );
		bounds.right = 14; bounds.bottom--;
		view.SetPenSize( 2 );
		view.StrokeRoundRect( bounds.InsetByCopy( -2.0, -2.0), 5, 5 );
		bounds.InsetBy( -1.0, -1.0);
		view.StrokeLine( BPoint( bounds.right, bounds.bottom ), BPoint(bounds.right - 1, bounds.bottom - 1) );

		// Schatten
		view.SetHighColor( 0, 0, 0, 30 );
		view.SetPenSize( 1.0 );
		view.StrokeLine( BPoint( bounds.right, 4.0 ), BPoint( bounds.right, bounds.bottom - 3.0 ) );
		view.StrokeLine( BPoint( bounds.right - 3.0, bounds.bottom ) );
		view.StrokeLine( BPoint( 4.0, bounds.bottom) );

		bounds.right++; bounds.bottom++;
		view.SetHighColor( 0, 0, 0, 10 );
		view.StrokeLine( BPoint( bounds.right, 4.0 ), BPoint( bounds.right, bounds.bottom - 4.0 ) );
		view.StrokeLine( BPoint( bounds.right - 4.0, bounds.bottom ) );
		view.StrokeLine( BPoint( 4.0, bounds.bottom) );

		view.StrokeLine( BPoint( bounds.right, bounds.bottom - 2.0 ), BPoint( bounds.right - 2.0, bounds.bottom ) );

		dragBitmap->RemoveChild( &view );
		dragBitmap->Unlock();

		BMessage	drag_message('drpt');
		drag_message.AddInt32("source", Value() );
		drag_message.AddInt32("be:actions", B_TRASH_TARGET);

		DragMessage(&drag_message, dragBitmap, B_OP_ALPHA, BPoint( where.x - (Value() - 1) * 17.0, where.y ) );

	}
}
开发者ID:HaikuArchives,项目名称:PecoBeat,代码行数:76,代码来源:PatternNrButton.cpp


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