Revision: 8839
http://playerstage.svn.sourceforge.net/playerstage/?rev=8839&view=rev
Author: jpgr87
Date: 2010-07-29 01:11:17 +0000 (Thu, 29 Jul 2010)
Log Message:
-----------
Applied patch #3016030: Multiline Drawing for Player and Stage
Modified Paths:
--------------
code/player/trunk/client_libs/libplayerc/dev_graphics2d.c
code/player/trunk/client_libs/libplayerc/playerc.h
code/player/trunk/client_libs/libplayerc/test/test_graphics2d.c
code/player/trunk/client_libs/libplayerc++/graphics2dproxy.cc
code/player/trunk/client_libs/libplayerc++/playerc++.h
code/player/trunk/libplayerinterface/interfaces/055_graphics2d.def
Modified: code/player/trunk/client_libs/libplayerc/dev_graphics2d.c
===================================================================
--- code/player/trunk/client_libs/libplayerc/dev_graphics2d.c 2010-07-29
01:02:07 UTC (rev 8838)
+++ code/player/trunk/client_libs/libplayerc/dev_graphics2d.c 2010-07-29
01:11:17 UTC (rev 8839)
@@ -112,6 +112,23 @@
&cmd, NULL);
}
+
+int playerc_graphics2d_draw_multiline(playerc_graphics2d_t *device,
+ player_point_2d_t pts[],
+ int count )
+{
+ player_graphics2d_cmd_polyline_t cmd;
+
+ cmd.points_count = count;
+ cmd.points = pts;
+ cmd.color = device->color;
+
+ return playerc_client_write(device->info.client, &device->info,
+ PLAYER_GRAPHICS2D_CMD_MULTILINE,
+ &cmd, NULL);
+}
+
+
int playerc_graphics2d_draw_polygon(playerc_graphics2d_t *device,
player_point_2d_t pts[],
int count,
Modified: code/player/trunk/client_libs/libplayerc/playerc.h
===================================================================
--- code/player/trunk/client_libs/libplayerc/playerc.h 2010-07-29 01:02:07 UTC
(rev 8838)
+++ code/player/trunk/client_libs/libplayerc/playerc.h 2010-07-29 01:11:17 UTC
(rev 8839)
@@ -1678,6 +1678,13 @@
player_point_2d_t pts[],
int count );
+/** @brief Draw a set of lines whose end points are at pts[2n] and pts[2n+1] */
+PLAYERC_EXPORT int playerc_graphics2d_draw_multiline(playerc_graphics2d_t
*device,
+ player_point_2d_t pts[],
+ int count );
+
+
+
/** @brief Draw a polygon */
PLAYERC_EXPORT int playerc_graphics2d_draw_polygon(playerc_graphics2d_t
*device,
player_point_2d_t pts[],
Modified: code/player/trunk/client_libs/libplayerc/test/test_graphics2d.c
===================================================================
--- code/player/trunk/client_libs/libplayerc/test/test_graphics2d.c
2010-07-29 01:02:07 UTC (rev 8838)
+++ code/player/trunk/client_libs/libplayerc/test/test_graphics2d.c
2010-07-29 01:11:17 UTC (rev 8839)
@@ -93,6 +93,28 @@
usleep(500000);
+
+ TEST("changing color");
+ col.red = 50;
+ col.green = 255;
+ col.blue = 123;
+ col.alpha = 0;
+
+ if(playerc_graphics2d_setcolor(device, col) < 0)
+ FAIL();
+ else
+ PASS();
+
+ TEST("drawing multiline");
+
+ if(playerc_graphics2d_draw_polyline(device, pts, RAYS) < 0)
+ FAIL();
+ else
+ PASS();
+
+ usleep(500000);
+
+
TEST("changing color");
col.red = 0;
col.green = 128;
Modified: code/player/trunk/client_libs/libplayerc++/graphics2dproxy.cc
===================================================================
--- code/player/trunk/client_libs/libplayerc++/graphics2dproxy.cc
2010-07-29 01:02:07 UTC (rev 8838)
+++ code/player/trunk/client_libs/libplayerc++/graphics2dproxy.cc
2010-07-29 01:11:17 UTC (rev 8839)
@@ -104,6 +104,13 @@
playerc_graphics2d_draw_polyline(mDevice,pts,count);
}
+void
+Graphics2dProxy::DrawMultiline( player_point_2d_t pts[], int count )
+{
+ scoped_lock_t lock(mPc->mMutex);
+ playerc_graphics2d_draw_multiline(mDevice,pts,count);
+}
+
void
Graphics2dProxy::DrawPolygon( player_point_2d_t pts[], int count, bool filled,
player_color_t fill_color )
{
Modified: code/player/trunk/client_libs/libplayerc++/playerc++.h
===================================================================
--- code/player/trunk/client_libs/libplayerc++/playerc++.h 2010-07-29
01:02:07 UTC (rev 8838)
+++ code/player/trunk/client_libs/libplayerc++/playerc++.h 2010-07-29
01:11:17 UTC (rev 8839)
@@ -771,6 +771,10 @@
/// Draw a line connecting set of points
void DrawPolyline(player_point_2d_t pts[], int count);
+
+
+ /// Draw multiple lines. Lines ending points are at pts[2n] pts[2n+1]
where 2n+1<count
+ void DrawMultiline(player_point_2d_t pts[], int count);
};
/**
Modified: code/player/trunk/libplayerinterface/interfaces/055_graphics2d.def
===================================================================
--- code/player/trunk/libplayerinterface/interfaces/055_graphics2d.def
2010-07-29 01:02:07 UTC (rev 8838)
+++ code/player/trunk/libplayerinterface/interfaces/055_graphics2d.def
2010-07-29 01:11:17 UTC (rev 8839)
@@ -15,7 +15,10 @@
message { CMD, POLYLINE, 3, player_graphics2d_cmd_polyline_t };
/** Command subtype: draw a polygon */
message { CMD, POLYGON, 4, player_graphics2d_cmd_polygon_t };
+/** Command subtype: draw a set of lines */
+message { CMD, MULTILINE, 5, player_graphics2d_cmd_multiline_t };
+
/** @brief Data: This interface produces no data. */
/** @brief Requests: This interface accepts no requests. */
@@ -62,3 +65,16 @@
/** If non-zero, the polygon should be drawn filled, else empty. */
uint8_t filled;
} player_graphics2d_cmd_polygon_t;
+
+/** @brief Command: Draw multiple lines (@ref PLAYER_GRAPHICS2D_CMD_MULTILINE)
+Draw a set of lines. End points of lines are at points[2n] and points[2n+1]
where 2n+1<count
+*/
+typedef struct player_graphics2d_cmd_multiline
+{
+ /** Number of points in this packet. */
+ uint32_t points_count;
+ /** Array of points to be joined by lines. */
+ player_point_2d_t *points;
+ /** Color in which the line should be drawn. */
+ player_color_t color;
+} player_graphics2d_cmd_multiline_t;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit