Exemplo n.º 1
0
void IPMapper::initMappingMatrix(Mat_<cv::Point>* pointMatrix)
{
    for(int y = 0;y < pointMatrix->rows;y++)
    {
        for(int x = 0;x < pointMatrix->cols;x++)
        {
            Point toTransform(x-pointMatrix->cols/2,y);
            
            vector<Point> toMap;
            toMap.push_back(toTransform);
            vector<Point2d> result;
            invProjectPoints(&toMap, &result);
            
            if(result.at(0).x >= 0 && result.at(0).x < 640 && result.at(0).y >= 0 && result.at(0).y < 480)
            {
                pointMatrix->at<Point>(y,x) = (Point)result.at(0);
            }
            
        }
    }
}
Exemplo n.º 2
0
extern "C" void pathext_stroke_path(fz_device *dev, fz_path *path,
                                    fz_stroke_state *, const fz_matrix *ctm,
                                    fz_colorspace *, float *, float)
{
  PathExt *ext = static_cast<PathExt*>(dev->user);
  if( ext == 0 ) {
    return;
  }

  QPainterPath qPath;
  float *c = path->coords;
  for(int i = 0; i < path->cmd_len; i++) {
    if(        path->cmds[i] == FZ_MOVETO ) {
      qPath.moveTo(c[0], c[1]);
      c += 2;
    } else if( path->cmds[i] == FZ_LINETO ) {
      qPath.lineTo(c[0], c[1]);
      c += 2;
    } else if( path->cmds[i] == FZ_CURVETO ) {
      qPath.cubicTo(c[0], c[1], c[2], c[3], c[4], c[5]);
      c += 6;
    } else if( path->cmds[i] == FZ_CLOSE_PATH ) {
      if( !ext->closed ) {
        return;
      }
      qPath.closeSubpath();
    } else {
      return;
    }
  }

  const QTransform qCtm = toTransform(ctm);
  qPath = qCtm.map(qPath);

  ext->paths.push_back(qPath);
}