Ejemplo n.º 1
0
int DisplayTree::Render(
    const Matrix& transform,
    const ColorMatrix* color_matrix,
    int clip_width,
    int clip_height,
    renderer_base& ren_base,
    renderer_scanline& ren) const {

  if (!visible) return 0;
  Matrix m(transform);
  if (placement) {
    m.premultiply(placement->matrix);
  }
  m.premultiply(matrix);
  const ColorMatrix* color_m = color_matrix;
  if (const ColorMatrix* cm = GetColorMatrix()) {
    // We don't currently support multiplying color matrices.
    assert(color_m == NULL);
    color_m = cm;
  }
  if (shape) {
    RenderShape(*shape, m, color_m, clip_width, clip_height, ren_base, ren);
  }
  for (std::vector<DisplayTree*>::const_iterator it =
         children.begin(); it != children.end(); ++it) {
    (*it)->Render(m, color_m, clip_width, clip_height, ren_base, ren);
  }
  return 0;
}
Ejemplo n.º 2
0
// *************************************************************
//		GetImageAttributes()
// *************************************************************
Gdiplus::ImageAttributes* ImageHelper::GetImageAttributes(IImage* img)
{
	if (!img) return NULL;

	Gdiplus::ImageAttributes* attr = new Gdiplus::ImageAttributes();

	attr->SetWrapMode(Gdiplus::WrapModeTileFlipXY);

	VARIANT_BOOL useTransparency;
	img->get_UseTransparencyColor(&useTransparency);

	OLE_COLOR clr1, clr2;
	img->get_TransparencyColor(&clr1);
	img->get_TransparencyColor2(&clr2);

	SetTransparency(*attr, useTransparency ? true : false, clr1, clr2);

	Gdiplus::ColorMatrix m = GetColorMatrix(img);
	attr->SetColorMatrix(&m);

	Gdiplus::REAL gamma;	
	img->get_Gamma(&gamma);
	attr->SetGamma(gamma);

	return attr;
}