예제 #1
0
NS_IMETHODIMP
MouseEvent::GetScreenY(int32_t* aScreenY)
{
  NS_ENSURE_ARG_POINTER(aScreenY);
  *aScreenY = ScreenY();
  return NS_OK;
}
예제 #2
0
void
ChartRenderer::DrawBarChart(const LeastSquares &lsdata)
{
  if (x.unscaled || y.unscaled)
    return;

  canvas.Select(look.bar_brush);
  canvas.SelectNullPen();

  const auto &slots = lsdata.GetSlots();
  for (unsigned i = 0, n = slots.size(); i != n; i++) {
    int xmin((i + 1.2) * x.scale
             + (rc.left + padding_left));
    int ymin = ScreenY(y.min);
    int xmax((i + 1.8) * x.scale
             + (rc.left + padding_left));
    int ymax = ScreenY(slots[i].y);
    canvas.Rectangle(xmin, ymin, xmax, ymax);
  }
}
예제 #3
0
void 
ChartRenderer::DrawFilledLine(const double xmin, const double ymin,
                              const double xmax, const double ymax,
                              const Brush &brush)
{
  RasterPoint line[4];

  line[0] = ToScreen(xmin, ymin);
  line[1] = ToScreen(xmax, ymax);

  line[2].x = line[1].x;
  line[2].y = ScreenY(0);
  line[3].x = line[0].x;
  line[3].y = line[2].y;

  canvas.Select(brush);
  canvas.SelectNullPen();
  canvas.DrawTriangleFan(line, 4);
}
예제 #4
0
void
ChartRenderer::DrawYGrid(double tic_step, const Pen &pen,
                         double unit_step, bool draw_units)
{
  assert(tic_step > 0);

  canvas.Select(pen);
  canvas.Select(look.axis_value_font);
  canvas.SetBackgroundTransparent();

  RasterPoint line[2];

  /* increase tic step so graph not too crowded */
  while ((y.max-y.min)/tic_step > 10) {
    tic_step *= 2;
    unit_step *= 2;
  }

  line[0].x = rc.left + padding_left;
  line[1].x = rc.right;

  const int x = line[0].x;

  auto start = (int)(y.min / tic_step) * tic_step;

  for (auto yval = start; yval <= y.max; yval += tic_step) {
    const int ymin = ScreenY(yval);
    line[0].y = line[1].y = ymin;

    // STYLE_THINDASHPAPER
    if (ymin >= rc.top && ymin <= rc.bottom - padding_bottom) {
      canvas.DrawLine(line[0], line[1]);

      if (draw_units) {
        TCHAR unit_text[MAX_PATH];
        FormatTicText(unit_text, yval * unit_step / tic_step, unit_step);

        canvas.DrawText(x, ymin, unit_text);
      }
    }
  }
}
예제 #5
0
NS_IMETHODIMP
Touch::GetScreenY(int32_t* aScreenY)
{
  *aScreenY = ScreenY();
  return NS_OK;
}
예제 #6
0
 gcc_pure
 RasterPoint ToScreen(fixed x, fixed y) const {
   return RasterPoint{ ScreenX(x), ScreenY(y) };
 }
예제 #7
0
 gcc_pure
 PixelPoint ToScreen(double x, double y) const {
   return PixelPoint{ ScreenX(x), ScreenY(y) };
 }