[C++] Rendering a rotated page using pdftron::PDF::Rasterizer

Q: I've having some problems with the PDF::Rasterizer.
I'm trying to rotate the image by 90,180,270 degrees using the matrix
passed
to the rasterizer. However my output is is always blank, am i doing
something incorrectly?

sample:
if(PDF::Page::Rotate::e_270==m_rotation ||
PDF::Page::Rotate::e_90==m_rotation)
  {
    int t;
    t=m_width;
    m_width = m_height;
    m_height=t;
  }

Common::Matrix2D rMatrix;
    switch(m_rotation) {
        case PDF::Page::Rotate::e_90:
      rMatrix.Set(0,1,-1,0,0,0);
      break;
    case PDF::Page::Rotate::e_180:
      rMatrix.Set(-1,0,0,-1,0,0);
      break;
    case PDF::Page::Rotate::e_270:
      rMatrix.Set(0,-1,1,0,0,0);
      break;
    }
    m_mtx*=rMatrix;

  m_raster.Rasterize(m_Page, &(m_buffer[0]), m_width, m_height,
-m_stride, m_mtx);
----------
A: You could use page.GetDefaultMatrix() with additional rotation
angle passed as the fourth paramater. In this for any reason doesn't
work, you may want to use the following snippet:

  Rect crop = page.GetCropBox();
  switch (rot)
  {
  case Page::e_0:
    return flip_y ? Common::Matrix2D(1, 0, 0, -1, -crop.x1,
crop.y1+crop.Height()) : Common::Matrix2D(1, 0, 0, 1, -crop.x1, -
crop.y1);
  case Page::e_90:
    return flip_y ? Common::Matrix2D(0, 1, 1, 0, -crop.y1, -crop.x1)
            : Common::Matrix2D(0, 1, -1, 0, crop.y1+crop.Height(), -
crop.x1);
  case Page::e_180:
    return flip_y ? Common::Matrix2D(-1, 0, 0, 1, crop.x1+crop.Width(), -
crop.y1) : Common::Matrix2D(-1, 0, 0, -1, crop.x1+crop.Width(),
crop.y1+crop.Height());
  case Page::e_270:
    return flip_y ? Common::Matrix2D(0, -1, -1, 0,
crop.y1+crop.Height(), crop.x1+crop.Width()) : Common::Matrix2D(0, -1,
1, 0, -crop.y1, crop.x1+crop.Width());
  default:
    assert(false);
  }