Revision: 61516
          http://sourceforge.net/p/brlcad/code/61516
Author:   bob1961
Date:     2014-07-02 11:57:39 +0000 (Wed, 02 Jul 2014)
Log Message:
-----------
Added an fbclear command to libged/libtclcad/Ged.tcl.

Modified Paths:
--------------
    brlcad/trunk/include/ged.h
    brlcad/trunk/src/libged/CMakeLists.txt
    brlcad/trunk/src/libtclcad/tclcad_obj.c
    brlcad/trunk/src/tclscripts/lib/Ged.tcl

Added Paths:
-----------
    brlcad/trunk/src/libged/fbclear.c

Modified: brlcad/trunk/include/ged.h
===================================================================
--- brlcad/trunk/include/ged.h  2014-07-02 08:59:13 UTC (rev 61515)
+++ brlcad/trunk/include/ged.h  2014-07-02 11:57:39 UTC (rev 61516)
@@ -1144,6 +1144,11 @@
 GED_EXPORT extern int ged_fb2pix(struct ged *gedp, int argc, const char 
*argv[]);
 
 /**
+ * Fclear clears a framebuffer.
+ */
+GED_EXPORT extern int ged_fbclear(struct ged *gedp, int argc, const char 
*argv[]);
+
+/**
  * Find combinations that reference object
  */
 GED_EXPORT extern int ged_find(struct ged *gedp, int argc, const char *argv[]);

Modified: brlcad/trunk/src/libged/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libged/CMakeLists.txt      2014-07-02 08:59:13 UTC (rev 
61515)
+++ brlcad/trunk/src/libged/CMakeLists.txt      2014-07-02 11:57:39 UTC (rev 
61516)
@@ -100,6 +100,7 @@
   facedef.c
   facetize.c
   fb2pix.c
+  fbclear.c
   find.c
   form.c
   fracture.c

Added: brlcad/trunk/src/libged/fbclear.c
===================================================================
--- brlcad/trunk/src/libged/fbclear.c                           (rev 0)
+++ brlcad/trunk/src/libged/fbclear.c   2014-07-02 11:57:39 UTC (rev 61516)
@@ -0,0 +1,100 @@
+/*                        F B C L E A R . C
+ * BRL-CAD
+ *
+ * Copyright (c) 1986-2014 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ *
+ */
+/** @file libged/fbclear.c
+ *
+ * Clear a framebuffer.
+ *
+ */
+
+#include "common.h"
+
+#include <stdlib.h>
+#ifdef HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#  include <sys/stat.h>
+#endif
+#ifdef HAVE_WINSOCK_H
+#  include <winsock.h>
+#endif
+#include "bio.h"
+
+#include "fb.h"
+#include "ged.h"
+
+static char usage[] = "\
+Usage: fbclear [rgb]";
+
+#define FB_CONSTRAIN(_v, _a, _b) \
+    (((_v) > (_a)) ? ((_v) < (_b) ? (_v) : (_b)) : (_a))
+
+int
+ged_fbclear(struct ged *gedp, int argc, const char *argv[])
+{
+    int ret;
+    unsigned char *clearColor;
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_FBSERV(gedp, GED_ERROR);
+    GED_CHECK_FBSERV_FBP(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+    bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc == 1) {
+       clearColor = PIXEL_NULL;
+    } else if (argc == 2) {
+       int r, g, b;
+
+       if (sscanf(argv[1], "%d %d %d", &r, &g, &b) != 3) {
+           bu_log("fb_clear: bad color spec - %s", argv[1]);
+           return BRLCAD_ERROR;
+       }
+
+       clearColor[RED] = FB_CONSTRAIN(r, 0, 255);
+       clearColor[GRN] = FB_CONSTRAIN(g, 0, 255);
+       clearColor[BLU] = FB_CONSTRAIN(b, 0, 255);
+    } else {
+       bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
+       return GED_ERROR;
+    }
+
+    ret = fb_clear(gedp->ged_fbsp->fbs_fbp, clearColor);
+
+    if (ret == BRLCAD_OK)
+       return GED_OK;
+
+    return GED_ERROR;
+}
+
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/trunk/src/libged/fbclear.c
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: brlcad/trunk/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_obj.c     2014-07-02 08:59:13 UTC (rev 
61515)
+++ brlcad/trunk/src/libtclcad/tclcad_obj.c     2014-07-02 11:57:39 UTC (rev 
61516)
@@ -1056,6 +1056,7 @@
     {"facetize",       (char *)0, TO_UNLIMITED, to_pass_through_func, 
ged_facetize},
     {"voxelize",       (char *)0, TO_UNLIMITED, to_pass_through_func, 
ged_voxelize},
     {"fb2pix",         "[-h -i -c] [-s squaresize] [-w width] [-n height] 
[file.pix]", TO_UNLIMITED, to_view_func, ged_fb2pix},
+    {"fbclear",        "[r g b]", TO_UNLIMITED, to_view_func, ged_fbclear},
     {"find_arb_edge",  "arb vx vy ptol", 5, to_view_func, 
ged_find_arb_edge_nearest_pt},
     {"find_bot_edge",  "bot vx vy", 5, to_view_func, 
ged_find_bot_edge_nearest_pt},
     {"find_botpt",     "bot vx vy", 5, to_view_func, 
ged_find_botpt_nearest_pt},

Modified: brlcad/trunk/src/tclscripts/lib/Ged.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/lib/Ged.tcl     2014-07-02 08:59:13 UTC (rev 
61515)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl     2014-07-02 11:57:39 UTC (rev 
61516)
@@ -234,6 +234,7 @@
        method faceplate {args}
        method facetize {args}
        method fb2pix {args}
+       method fbclear {args}
        method find_bot_edge_in_face {_bot _face _mx _my}
        method find_botpt_in_face {_bot _face _mx _my}
        method find_pipept {args}
@@ -405,6 +406,7 @@
        method pane_eye {_pane args}
        method pane_eye_pos {_pane args}
        method pane_fb2pix {_pane args}
+       method pane_fbclear {_pane args}
        method pane_find_botpt {_pane args}
        method pane_find_bot_edge_in_face {_pane _bot _face _mx _my}
        method pane_find_botpt_in_face {_pane _bot _face _mx _my}
@@ -1789,11 +1791,17 @@
     eval $mGed voxelize $args
 }
 
+
 ::itcl::body cadwidgets::Ged::fb2pix {args} {
     eval $mGed fb2pix $itk_component($itk_option(-pane)) $args
 }
 
 
+::itcl::body cadwidgets::Ged::fbclear {args} {
+    eval $mGed fbclear $itk_component($itk_option(-pane)) $args
+}
+
+
 ::itcl::body cadwidgets::Ged::find_bot_edge_in_face {_bot _face _mx _my} {
     pane_find_bot_edge_in_face $itk_option(-pane) $_bot $_face $_mx $_my
 }
@@ -2589,11 +2597,17 @@
     eval $mGed eye_pos $itk_component($_pane) $args
 }
 
+
 ::itcl::body cadwidgets::Ged::pane_fb2pix {_pane args} {
     eval $mGed fb2pix $itk_component($_pane) $args
 }
 
 
+::itcl::body cadwidgets::Ged::pane_fbclear {_pane args} {
+    eval $mGed fbclear $itk_component($_pane) $args
+}
+
+
 ::itcl::body cadwidgets::Ged::pane_find_botpt {_pane args} {
     eval $mGed find_botpt $itk_component($_pane) $args
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to