Implemented more BPicture related stuff. With this change, at least buttons can be drawn in pictures almost perfectly
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16344 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2879eb37ec
commit
f06f67c546
@ -16,15 +16,13 @@
|
||||
static void
|
||||
nop()
|
||||
{
|
||||
printf("nop\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
move_pen_by(ViewLayer *view, BPoint delta)
|
||||
{
|
||||
//view->MovePenBy(delta)
|
||||
printf("MovePenBy(%.2f, %.2f)\n", delta.x, delta.y);
|
||||
view->CurrentState()->SetPenLocation(delta - view->CurrentState()->PenLocation());
|
||||
}
|
||||
|
||||
|
||||
@ -214,84 +212,82 @@ clip_to_picture(void *user, BPicture *picture, BPoint pt,
|
||||
|
||||
|
||||
static void
|
||||
push_state(void *user)
|
||||
push_state(ViewLayer *view)
|
||||
{
|
||||
printf("PushState\n");
|
||||
view->PushState();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pop_state(void *user)
|
||||
pop_state(ViewLayer *view)
|
||||
{
|
||||
printf("PopState\n");
|
||||
view->PopState();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
enter_state_change(void *user)
|
||||
enter_state_change(ViewLayer *view)
|
||||
{
|
||||
printf("EnterStateChange\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
exit_state_change(void *user)
|
||||
exit_state_change(ViewLayer *view)
|
||||
{
|
||||
printf("ExitStateChange\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
enter_font_state(void *user)
|
||||
enter_font_state(ViewLayer *view)
|
||||
{
|
||||
printf("EnterFontState\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
exit_font_state(void *user)
|
||||
exit_font_state(ViewLayer *view)
|
||||
{
|
||||
printf("ExitFontState\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_origin(void *user, BPoint pt)
|
||||
set_origin(ViewLayer *view, BPoint pt)
|
||||
{
|
||||
printf("SetOrigin(%.2f, %.2f)\n", pt.x, pt.y);
|
||||
view->CurrentState()->SetOrigin(pt);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_pen_location(ViewLayer *view, BPoint pt)
|
||||
{
|
||||
//view->MovePenTo(pt);
|
||||
|
||||
printf("SetPenLocation(%.2f, %.2f)\n", pt.x, pt.y);
|
||||
view->CurrentState()->SetPenLocation(pt);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_drawing_mode(void *user, drawing_mode mode)
|
||||
set_drawing_mode(ViewLayer *view, drawing_mode mode)
|
||||
{
|
||||
printf("SetDrawingMode(%d)\n", mode);
|
||||
view->CurrentState()->SetDrawingMode(mode);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode,
|
||||
float miterLimit)
|
||||
set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode, float miterLimit)
|
||||
{
|
||||
//view->SetLineMode(capMode, joinMode, miterLimit);
|
||||
printf("SetLineMode(%d, %d, %.2f)\n", capMode, joinMode, miterLimit);
|
||||
DrawState *state = view->CurrentState();
|
||||
state->SetLineCapMode(capMode);
|
||||
state->SetLineJoinMode(joinMode);
|
||||
state->SetMiterLimit(miterLimit);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_pen_size(ViewLayer *view, float size)
|
||||
{
|
||||
//view->SetPenSize(size);
|
||||
printf("SetPenSize(%.2f)\n", size);
|
||||
view->CurrentState()->SetPenSize(size);
|
||||
}
|
||||
|
||||
|
||||
@ -310,35 +306,35 @@ set_back_color(ViewLayer *view, rgb_color color)
|
||||
|
||||
|
||||
static void
|
||||
set_stipple_pattern(void *user, pattern p)
|
||||
set_stipple_pattern(ViewLayer *view, pattern p)
|
||||
{
|
||||
printf("SetStipplePattern\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_scale(void *user, float scale)
|
||||
set_scale(ViewLayer *view, float scale)
|
||||
{
|
||||
printf("SetScale(%.2f)\n", scale);
|
||||
view->CurrentState()->SetScale(scale);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_family(void *user, char *family)
|
||||
set_font_family(ViewLayer *view, char *family)
|
||||
{
|
||||
printf("SetFontFamily(%s)\n", family);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_style(void *user, char *style)
|
||||
set_font_style(ViewLayer *view, char *style)
|
||||
{
|
||||
printf("SetFontStyle(%s)\n", style);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_spacing(void *user, int32 spacing)
|
||||
set_font_spacing(ViewLayer *view, int32 spacing)
|
||||
{
|
||||
printf("SetFontSpacing(%ld)\n", spacing);
|
||||
}
|
||||
@ -358,35 +354,35 @@ set_font_size(ViewLayer *view, float size)
|
||||
|
||||
|
||||
static void
|
||||
set_font_rotate(void *user, float rotation)
|
||||
set_font_rotate(ViewLayer *view, float rotation)
|
||||
{
|
||||
printf("SetFontRotate(%.2f)\n", rotation);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_encoding(void *user, int32 encoding)
|
||||
set_font_encoding(ViewLayer *view, int32 encoding)
|
||||
{
|
||||
printf("SetFontEncoding(%ld)\n", encoding);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_flags(void *user, int32 flags)
|
||||
set_font_flags(ViewLayer *view, int32 flags)
|
||||
{
|
||||
printf("SetFontFlags(%ld)\n", flags);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_shear(void *user, float shear)
|
||||
set_font_shear(ViewLayer *view, float shear)
|
||||
{
|
||||
printf("SetFontShear(%.2f)\n", shear);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_font_face(void *user, int32 flags)
|
||||
set_font_face(ViewLayer *view, int32 flags)
|
||||
{
|
||||
printf("SetFontFace(%ld)\n", flags);
|
||||
}
|
||||
@ -395,7 +391,6 @@ set_font_face(void *user, int32 flags)
|
||||
static void
|
||||
reserved()
|
||||
{
|
||||
printf("reserved\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -2218,6 +2218,17 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
return false;
|
||||
|
||||
switch (code) {
|
||||
case AS_LAYER_SET_ORIGIN:
|
||||
{
|
||||
float x, y;
|
||||
link.Read<float>(&x);
|
||||
link.Read<float>(&y);
|
||||
|
||||
picture->BeginOp(B_PIC_SET_ORIGIN);
|
||||
picture->AddCoord(BPoint(x, y));
|
||||
picture->EndOp();
|
||||
break;
|
||||
}
|
||||
case AS_FILL_RECT:
|
||||
case AS_STROKE_RECT:
|
||||
{
|
||||
@ -2245,6 +2256,32 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
picture->EndOp();
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_STROKE_LINEARRAY:
|
||||
{
|
||||
int32 lineCount;
|
||||
link.Read<int32>(&lineCount);
|
||||
for (int32 i = 0; i < lineCount; i++) {
|
||||
float x1, y1, x2, y2;
|
||||
link.Read<float>(&x1);
|
||||
link.Read<float>(&y1);
|
||||
link.Read<float>(&x2);
|
||||
link.Read<float>(&y2);
|
||||
|
||||
rgb_color color;
|
||||
link.Read<rgb_color>(&color);
|
||||
|
||||
picture->BeginOp(B_PIC_SET_FORE_COLOR);
|
||||
picture->AddColor(color);
|
||||
picture->EndOp();
|
||||
|
||||
picture->BeginOp(B_PIC_STROKE_LINE);
|
||||
picture->AddCoord(BPoint(x1, y1));
|
||||
picture->AddCoord(BPoint(x2, y2));
|
||||
picture->EndOp();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_LAYER_SET_LOW_COLOR:
|
||||
case AS_LAYER_SET_HIGH_COLOR:
|
||||
@ -2270,8 +2307,8 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
link.Read<escapement_delta>(&delta);
|
||||
link.ReadString(&string);
|
||||
|
||||
picture->BeginOp(B_PIC_MOVE_PEN_BY);
|
||||
picture->AddCoord(location - fCurrentLayer->CurrentState()->PenLocation());
|
||||
picture->BeginOp(B_PIC_SET_PEN_LOCATION);
|
||||
picture->AddCoord(location);
|
||||
picture->EndOp();
|
||||
|
||||
picture->BeginOp(B_PIC_DRAW_STRING);
|
||||
|
Loading…
x
Reference in New Issue
Block a user