void DrumsetDropField::AttachedToWindow() {
	
	BFont font;
	font.SetFamilyAndStyle("Swis721 BT","Roman"); 
	font.SetSize( 8.0 );
	SetFont(&font);
	
	SetLowColor( 66, 99, 132 );
	SetHighColor( 210, 220, 230 );
		
	BeginPicture( new BPicture() );
	DrawBitmap(((App *)be_app)->FetchResourceBitmap("dropfield"), BPoint(0.0, 0.0));
	DrawString("Drop instrument here!", BPoint(6.0, 12.0));
	fNormalBitmap = EndPicture();
	
	BeginPicture( new BPicture() );
	DrawBitmap(((App *)be_app)->FetchResourceBitmap("dropfield"), BPoint(0.0, 0.0));
	SetDrawingMode(B_OP_ALPHA);
	SetHighColor(0,0,0,80);
	FillRect(Bounds().InsetByCopy(1.0, 1.0));
	SetHighColor( 255, 255, 255 );
	DrawString("Drop instrument here!", BPoint(7.0, 13.0));
	fActiveBitmap = EndPicture();

	SetTarget(Parent());

}
void TPanelWindowView::BuildViewsPicture( bool mode )
{
	BAutolock(Window());
	BeginPicture( fMyPicture );

	float w, h;

	w = Bounds().Width();
	h = Bounds().Height();

/*	FillArc( BRect( 0, 0, h, h ), 90, 90 );
	FillArc( BRect( w-h, 0, w, h ), 0, 90 );

	FillRect( BRect( h/2, 0, w-(h/2), h/2) );
	FillRect( BRect( 0, h/2, w, h ) );*/

	if ( mode )
	{
		FillRect( BRect( 0, h - 2, w, h ) );

		fPanels.Lock();
		for ( int i=0; i<fPanels.CountItems(); i++ )
		{
			TInnerPanel *panel = fPanels.ItemAt(i);
			if ( panel->Frame().Width() > 30 )
				panel->DrawBackFrame();
		}
		fPanels.Unlock();
	}
	else
		FillRect( BRect( 0, 0, w, h ) );

	EndPicture();
}
Example #3
0
void
MouseView::_CreateButtonsPicture()
{
	BeginPicture(&fButtonsPicture);
	SetScale(1.8 * fScaling);
	SetOrigin(-21 * fScaling, -14 * fScaling);

	BShape mouseShape;
	mouseShape.MoveTo(BPoint(48, 12));
	// top
	BPoint control3[3] = { BPoint(44, 8), BPoint(20, 8), BPoint(16, 12) };
	mouseShape.BezierTo(control3);
	// left
	BPoint control[3] = { BPoint(12, 16), BPoint(13, 27), BPoint(13, 27) };
	mouseShape.BezierTo(control);
	// bottom
	BPoint control4[] = { BPoint(18, 30), BPoint(46, 30), BPoint(51, 27) };
	mouseShape.BezierTo(control4);
	// right
	BPoint control2[3] = { BPoint(51, 27), BPoint(50, 14), BPoint(48, 12) };
	mouseShape.BezierTo(control2);

	mouseShape.Close();

	SetHighColor(255, 0, 0, 255);
	FillShape(&mouseShape, B_SOLID_HIGH);

	EndPicture();
	SetScale(1);
}
void VisualColorControl::AttachedToWindow()
{
	BPoint *points = new BPoint[3];
	points[0] = BPoint(0,0);
	points[1] = BPoint(-4,-4);
	points[2] = BPoint(4,-4);

	// calculate the initial ramps
	CalcRamps();

	// create the arrow-pictures
	BeginPicture(new BPicture());
		SetHighColor(100,100,255);
		FillPolygon(points,3);
		SetHighColor(0,0,0);
		StrokePolygon(points,3);
	down_arrow = EndPicture();

	if (Parent() != NULL)
		SetViewColor(Parent()->ViewColor());

	BStringView *sv = new BStringView(BRect(0,COLOR_HEIGHT/2,1,COLOR_HEIGHT/2),"label view",label1);
	AddChild(sv);
	float sv_width = sv->StringWidth(label1);
	sv_width = max_c(sv_width,sv->StringWidth(label2));
	sv_width = max_c(sv_width,sv->StringWidth(label3));
	font_height fHeight;
	sv->GetFontHeight(&fHeight);
	sv->ResizeTo(sv_width,fHeight.ascent+fHeight.descent);
	sv->MoveBy(0,-(fHeight.ascent+fHeight.descent)/2.0);
	BRect sv_frame = sv->Frame();
	sv_frame.OffsetBy(0,COLOR_HEIGHT);
	sv->SetAlignment(B_ALIGN_CENTER);
	sv = new BStringView(sv_frame,"label view",label2);
	AddChild(sv);
	sv->SetAlignment(B_ALIGN_CENTER);
	sv_frame.OffsetBy(0,COLOR_HEIGHT);
	sv = new BStringView(sv_frame,"label view",label3);
	AddChild(sv);
	sv->SetAlignment(B_ALIGN_CENTER);
	sv_frame.OffsetBy(0,COLOR_HEIGHT);
	sv = new BStringView(sv_frame,"label view",label4);
	AddChild(sv);
	sv->SetAlignment(B_ALIGN_CENTER);

	ramp_left_edge = sv->Bounds().IntegerWidth()+2;

	ResizeBy(ramp_left_edge,0);

	delete[] points;
}
Example #5
0
void
PictureView::AllAttached()
{	
	BeginPicture(new BPicture);
	
	DrawStuff(this);

	BPicture *picture = EndPicture();
	if (picture == NULL)
		return;

	BMessage message;
	picture->Archive(&message);
	message.PrintToStream();

	BMallocIO stream;
	
	status_t status = picture->Flatten(&stream);
	delete picture;

	if (status != B_OK)
		printf("Error flattening BPicture: %s\n", strerror(status));
	
	if (status == B_OK) {
		stream.Seek(0, SEEK_SET);
		fPicture = new BPicture();
		status = fPicture->Unflatten(&stream);
		if (status != B_OK) {
			printf("Error unflattening BPicture: %s\n", strerror(status));
			return;
		}
	}

	BMessage message2;
	fPicture->Archive(&message2);
	message2.PrintToStream();
}
Example #6
0
void PathView::Draw(BRect updateRect) {
	if (fMode == kDrawOutline) {

	} else if (fMode == kStroke) {
		const int n = fPath.CountPoints();
		BShape shape;
		for (int i = 0; i < n; i++) {
			if (i == 0)
				shape.MoveTo(fPath.PointAt(i));
			else
				shape.LineTo(fPath.PointAt(i));
		}
		if (fPath.IsClosed()) shape.Close();
		SetPenSize(fWidth);
		StrokeShape(&shape);

		ShapeLPB path(&fPath, fWidth, LineCapMode(), LineJoinMode(), LineMiterLimit()); 
		path.CreateLinePath();
		SetPenSize(1);

		BPicture picture;
		BeginPicture(&picture);
		FillShape(path.Shape());
		EndPicture();

		PushState();
		ClipToPicture(&picture);
		SetHighColor(0, 255, 0);
		FillRect(Bounds());
		PopState();
		
		SetOrigin(200, 0);
		SetHighColor(255, 0, 0);
		StrokeShape(path.Shape());
		Flush();
	}
}