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:
@@ -16,15 +16,13 @@
|
|||||||
static void
|
static void
|
||||||
nop()
|
nop()
|
||||||
{
|
{
|
||||||
printf("nop\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
move_pen_by(ViewLayer *view, BPoint delta)
|
move_pen_by(ViewLayer *view, BPoint delta)
|
||||||
{
|
{
|
||||||
//view->MovePenBy(delta)
|
view->CurrentState()->SetPenLocation(delta - view->CurrentState()->PenLocation());
|
||||||
printf("MovePenBy(%.2f, %.2f)\n", delta.x, delta.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -214,84 +212,82 @@ clip_to_picture(void *user, BPicture *picture, BPoint pt,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_state(void *user)
|
push_state(ViewLayer *view)
|
||||||
{
|
{
|
||||||
printf("PushState\n");
|
view->PushState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pop_state(void *user)
|
pop_state(ViewLayer *view)
|
||||||
{
|
{
|
||||||
printf("PopState\n");
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enter_state_change(void *user)
|
enter_state_change(ViewLayer *view)
|
||||||
{
|
{
|
||||||
printf("EnterStateChange\n");
|
printf("EnterStateChange\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exit_state_change(void *user)
|
exit_state_change(ViewLayer *view)
|
||||||
{
|
{
|
||||||
printf("ExitStateChange\n");
|
printf("ExitStateChange\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enter_font_state(void *user)
|
enter_font_state(ViewLayer *view)
|
||||||
{
|
{
|
||||||
printf("EnterFontState\n");
|
printf("EnterFontState\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exit_font_state(void *user)
|
exit_font_state(ViewLayer *view)
|
||||||
{
|
{
|
||||||
printf("ExitFontState\n");
|
printf("ExitFontState\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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
|
static void
|
||||||
set_pen_location(ViewLayer *view, BPoint pt)
|
set_pen_location(ViewLayer *view, BPoint pt)
|
||||||
{
|
{
|
||||||
//view->MovePenTo(pt);
|
view->CurrentState()->SetPenLocation(pt);
|
||||||
|
|
||||||
printf("SetPenLocation(%.2f, %.2f)\n", pt.x, pt.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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
|
static void
|
||||||
set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode,
|
set_line_mode(ViewLayer *view, cap_mode capMode, join_mode joinMode, float miterLimit)
|
||||||
float miterLimit)
|
|
||||||
{
|
{
|
||||||
//view->SetLineMode(capMode, joinMode, miterLimit);
|
DrawState *state = view->CurrentState();
|
||||||
printf("SetLineMode(%d, %d, %.2f)\n", capMode, joinMode, miterLimit);
|
state->SetLineCapMode(capMode);
|
||||||
|
state->SetLineJoinMode(joinMode);
|
||||||
|
state->SetMiterLimit(miterLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pen_size(ViewLayer *view, float size)
|
set_pen_size(ViewLayer *view, float size)
|
||||||
{
|
{
|
||||||
//view->SetPenSize(size);
|
view->CurrentState()->SetPenSize(size);
|
||||||
printf("SetPenSize(%.2f)\n", size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -310,35 +306,35 @@ set_back_color(ViewLayer *view, rgb_color color)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_stipple_pattern(void *user, pattern p)
|
set_stipple_pattern(ViewLayer *view, pattern p)
|
||||||
{
|
{
|
||||||
printf("SetStipplePattern\n");
|
printf("SetStipplePattern\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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
|
static void
|
||||||
set_font_family(void *user, char *family)
|
set_font_family(ViewLayer *view, char *family)
|
||||||
{
|
{
|
||||||
printf("SetFontFamily(%s)\n", family);
|
printf("SetFontFamily(%s)\n", family);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_style(void *user, char *style)
|
set_font_style(ViewLayer *view, char *style)
|
||||||
{
|
{
|
||||||
printf("SetFontStyle(%s)\n", style);
|
printf("SetFontStyle(%s)\n", style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_spacing(void *user, int32 spacing)
|
set_font_spacing(ViewLayer *view, int32 spacing)
|
||||||
{
|
{
|
||||||
printf("SetFontSpacing(%ld)\n", spacing);
|
printf("SetFontSpacing(%ld)\n", spacing);
|
||||||
}
|
}
|
||||||
@@ -358,35 +354,35 @@ set_font_size(ViewLayer *view, float size)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_rotate(void *user, float rotation)
|
set_font_rotate(ViewLayer *view, float rotation)
|
||||||
{
|
{
|
||||||
printf("SetFontRotate(%.2f)\n", rotation);
|
printf("SetFontRotate(%.2f)\n", rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_encoding(void *user, int32 encoding)
|
set_font_encoding(ViewLayer *view, int32 encoding)
|
||||||
{
|
{
|
||||||
printf("SetFontEncoding(%ld)\n", encoding);
|
printf("SetFontEncoding(%ld)\n", encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_flags(void *user, int32 flags)
|
set_font_flags(ViewLayer *view, int32 flags)
|
||||||
{
|
{
|
||||||
printf("SetFontFlags(%ld)\n", flags);
|
printf("SetFontFlags(%ld)\n", flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_shear(void *user, float shear)
|
set_font_shear(ViewLayer *view, float shear)
|
||||||
{
|
{
|
||||||
printf("SetFontShear(%.2f)\n", shear);
|
printf("SetFontShear(%.2f)\n", shear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_font_face(void *user, int32 flags)
|
set_font_face(ViewLayer *view, int32 flags)
|
||||||
{
|
{
|
||||||
printf("SetFontFace(%ld)\n", flags);
|
printf("SetFontFace(%ld)\n", flags);
|
||||||
}
|
}
|
||||||
@@ -395,7 +391,6 @@ set_font_face(void *user, int32 flags)
|
|||||||
static void
|
static void
|
||||||
reserved()
|
reserved()
|
||||||
{
|
{
|
||||||
printf("reserved\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2218,6 +2218,17 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (code) {
|
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_FILL_RECT:
|
||||||
case AS_STROKE_RECT:
|
case AS_STROKE_RECT:
|
||||||
{
|
{
|
||||||
@@ -2245,6 +2256,32 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
picture->EndOp();
|
picture->EndOp();
|
||||||
break;
|
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_LOW_COLOR:
|
||||||
case AS_LAYER_SET_HIGH_COLOR:
|
case AS_LAYER_SET_HIGH_COLOR:
|
||||||
@@ -2270,8 +2307,8 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
link.Read<escapement_delta>(&delta);
|
link.Read<escapement_delta>(&delta);
|
||||||
link.ReadString(&string);
|
link.ReadString(&string);
|
||||||
|
|
||||||
picture->BeginOp(B_PIC_MOVE_PEN_BY);
|
picture->BeginOp(B_PIC_SET_PEN_LOCATION);
|
||||||
picture->AddCoord(location - fCurrentLayer->CurrentState()->PenLocation());
|
picture->AddCoord(location);
|
||||||
picture->EndOp();
|
picture->EndOp();
|
||||||
|
|
||||||
picture->BeginOp(B_PIC_DRAW_STRING);
|
picture->BeginOp(B_PIC_DRAW_STRING);
|
||||||
|
|||||||
Reference in New Issue
Block a user