Esempio n. 1
0
ompl_interface::ModelBasedPlanningContextPtr ompl_interface::OMPLInterface::getPlanningContext(const std::string &config, const std::string &factory_type) const
{
  ModelBasedPlanningContextPtr ctx = context_manager_.getPlanningContext(config, factory_type);
  if (ctx)
    configureContext(ctx);
  return ctx;
}
Esempio n. 2
0
void BenchCairo::runBlitImageF(BenchOutput& output, const BenchParams& params)
{
  cairo_t* cr = cairo_create(screenCairo);
  configureContext(cr, params);

  BenchRandom rPts(app);

  Fog::SizeI screenSize(
    params.screenSize.w - params.shapeSize,
    params.screenSize.h - params.shapeSize);

  uint32_t spriteIndex = 0;
  uint32_t spritesLength = (uint32_t)sprites.getLength();

  uint32_t i, quantity = params.quantity;
  for (i = 0; i < quantity; i++)
  {
    Fog::PointF pt(rPts.getPointF(screenSize));

    cairo_set_source_surface(cr, spritesCairo[spriteIndex], pt.x, pt.y);
    cairo_rectangle(cr, 
      double(pt.x),
      double(pt.y),
      double(params.shapeSize),
      double(params.shapeSize));
    cairo_fill(cr);

    if (++spriteIndex >= spritesLength)
      spriteIndex = 0;
  }

  cairo_destroy(cr);
}
Esempio n. 3
0
void BenchCairo::runFillRectRotate(BenchOutput& output, const BenchParams& params)
{
  cairo_t* cr = cairo_create(screenCairo);
  configureContext(cr, params);

  BenchRandom rRect(app);
  BenchRandom rArgb(app);

  float cx = (float)params.screenSize.w * 0.5f;
  float cy = (float)params.screenSize.h * 0.5f;
  float angle = 0.0f;

  if (params.source == BENCH_SOURCE_SOLID)
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++, angle += 0.01f)
    {
      Fog::RectF r(rRect.getRectF(params.screenSize, params.shapeSize, params.shapeSize));
      Fog::Argb32 c0(rArgb.getArgb32());

      cairo_translate(cr, cx, cy);
      cairo_rotate(cr, angle);
      cairo_translate(cr, -cx, -cy);

      cairo_set_source_rgba(cr, double(c0.r) * sc, double(c0.g) * sc, double(c0.b) * sc, double(c0.a) * sc);
      cairo_rectangle(cr, r.x, r.y, r.w, r.h);
      cairo_fill(cr);

      cairo_identity_matrix(cr);
    }
  }
  else
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++, angle += 0.01f)
    {
      Fog::RectF r(rRect.getRectF(params.screenSize, params.shapeSize, params.shapeSize));
      Fog::Argb32 c0(rArgb.getArgb32());
      Fog::Argb32 c1(rArgb.getArgb32());
      Fog::Argb32 c2(rArgb.getArgb32());

      cairo_translate(cr, cx, cy);
      cairo_rotate(cr, angle);
      cairo_translate(cr, -cx, -cy);

      cairo_pattern_t* pattern = createLinearGradient(r.x, r.y, r.x + r.w, r.y + r.h, c0, c1, c2);
      cairo_set_source(cr, pattern);

      cairo_rectangle(cr, r.x, r.y, r.w, r.h);
      cairo_fill(cr);

      cairo_identity_matrix(cr);
      cairo_pattern_destroy(pattern);
    }
  }

  cairo_destroy(cr);
}
Esempio n. 4
0
ompl_interface::ModelBasedPlanningContextPtr ompl_interface::OMPLInterface::getPlanningContext(const planning_scene::PlanningSceneConstPtr& planning_scene,
                                                                                               const planning_interface::MotionPlanRequest &req,
                                                                                               moveit_msgs::MoveItErrorCodes &error_code) const
{
  ModelBasedPlanningContextPtr ctx = context_manager_.getPlanningContext(planning_scene, req, error_code);
  if (ctx)
    configureContext(ctx);
  return ctx;
}
Esempio n. 5
0
void BenchCairo::runCreateDestroy(BenchOutput& output, const BenchParams& params)
{
  uint32_t i, quantity = params.quantity;
  for (i = 0; i < quantity; i++)
  {
    cairo_t* cr = cairo_create(screenCairo);
    configureContext(cr, params);
    cairo_destroy(cr);
  }
}
Esempio n. 6
0
void BenchCairo::runFillRound(BenchOutput& output, const BenchParams& params)
{
  cairo_t* cr = cairo_create(screenCairo);
  configureContext(cr, params);

  BenchRandom rRect(app);
  BenchRandom rArgb(app);
  BenchRandom rRadius(app);

  if (params.source == BENCH_SOURCE_SOLID)
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++)
    {
      Fog::RectF r(rRect.getRectF(params.screenSize, params.shapeSize, params.shapeSize));
      float rad = rRadius.getFloat(4.0f, 40.0f);

      Fog::Argb32 c0(rArgb.getArgb32());
      cairo_set_source_rgba(cr, double(c0.r) * sc, double(c0.g) * sc, double(c0.b) * sc, double(c0.a) * sc);

      addRound(cr, r, rad);
      cairo_fill(cr);
    }
  }
  else
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++)
    {
      Fog::RectF r(rRect.getRectF(params.screenSize, params.shapeSize, params.shapeSize));
      float rad = rRadius.getFloat(4.0f, 40.0f);

      Fog::Argb32 c0(rArgb.getArgb32());
      Fog::Argb32 c1(rArgb.getArgb32());
      Fog::Argb32 c2(rArgb.getArgb32());

      cairo_pattern_t* pattern = createLinearGradient(r.x, r.y, r.x + r.w, r.y + r.h, c0, c1, c2);
      cairo_set_source(cr, pattern);

      addRound(cr, r, rad);
      cairo_fill(cr);

      cairo_pattern_destroy(pattern);
    }
  }

  cairo_destroy(cr);
}
Esempio n. 7
0
void BenchCairo::runBlitImageRotate(BenchOutput& output, const BenchParams& params)
{
  cairo_t* cr = cairo_create(screenCairo);
  configureContext(cr, params);

  double cx = (double)params.screenSize.w * 0.5;
  double cy = (double)params.screenSize.h * 0.5;
  float angle = 0.0f;

  BenchRandom rPts(app);

  Fog::SizeI screenSize(
    params.screenSize.w - params.shapeSize,
    params.screenSize.h - params.shapeSize);

  uint32_t spriteIndex = 0;
  uint32_t spritesLength = (uint32_t)sprites.getLength();

  uint32_t i, quantity = params.quantity;
  for (i = 0; i < quantity; i++, angle += 0.01f)
  {
    Fog::PointI pt(rPts.getPointI(screenSize));

    cairo_matrix_t matrix;
    cairo_matrix_init_translate(&matrix, cx, cy);
    cairo_matrix_rotate(&matrix, angle);
    cairo_matrix_translate(&matrix, -cx, -cy);
    cairo_set_matrix(cr, &matrix);

    cairo_set_source_surface(cr, spritesCairo[spriteIndex], pt.x, pt.y);
    cairo_rectangle(cr, pt.x, pt.y, params.shapeSize, params.shapeSize);
    cairo_fill(cr);

    if (++spriteIndex >= spritesLength)
      spriteIndex = 0;
  }

  cairo_destroy(cr);
}
Esempio n. 8
0
void BenchCairo::runFillPolygon(BenchOutput& output, const BenchParams& params, uint32_t complexity)
{
  cairo_t* cr = cairo_create(screenCairo);
  configureContext(cr, params);

  BenchRandom rPts(app);
  BenchRandom rArgb(app);

  Fog::SizeI polyScreen(
    params.screenSize.w - params.shapeSize,
    params.screenSize.h - params.shapeSize);
  float polySize = (int)params.shapeSize;

  if (params.source == BENCH_SOURCE_SOLID)
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++)
    {
      Fog::PointF base(rPts.getPointF(polyScreen));
      Fog::Argb32 c0(rArgb.getArgb32());

      cairo_set_source_rgba(cr, double(c0.r) * sc, double(c0.g) * sc, double(c0.b) * sc, double(c0.a) * sc);

      for (uint32_t j = 0; j < complexity; j++)
      {
        float x = rPts.getFloat(base.x, base.x + polySize);
        float y = rPts.getFloat(base.y, base.y + polySize);

        if (j == 0)
          cairo_move_to(cr, x, y);
        else
          cairo_line_to(cr, x, y);

      }
      cairo_close_path(cr);
      cairo_fill(cr);
    }
  }
  else
  {
    uint32_t i, quantity = params.quantity;
    for (i = 0; i < quantity; i++)
    {
      Fog::PointF base(rPts.getPointF(polyScreen));
      Fog::Argb32 c0(rArgb.getArgb32());
      Fog::Argb32 c1(rArgb.getArgb32());
      Fog::Argb32 c2(rArgb.getArgb32());

      cairo_pattern_t* pattern = createLinearGradient(base.x, base.y, base.x + polySize, base.y + polySize, c0, c1, c2);
      cairo_set_source(cr, pattern);

      for (uint32_t j = 0; j < complexity; j++)
      {
        float x = rPts.getFloat(base.x, base.x + polySize);
        float y = rPts.getFloat(base.y, base.y + polySize);

        if (j == 0)
          cairo_move_to(cr, x, y);
        else
          cairo_line_to(cr, x, y);

      }
      cairo_close_path(cr);
      cairo_fill(cr);
      cairo_pattern_destroy(pattern);
    }
  }

  cairo_destroy(cr);
}