Re: Parameters for RenderDocument
Joffrey <[email protected]> Mon, 20 Jun 2011 18:27:52 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.embedding |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <f6619b7a-d6a9-470e-b16d-84f8596c9746@glegroupsg2000goo.googlegroups.com> |
Yata!
I use this following:
<code>
nscoord aX = NSFloatPixelsToAppUnits(x,float(nsDeviceContext::AppUnitsPerCSSPixel()));
nscoord aY = NSFloatPixelsToAppUnits(y,float(nsDeviceContext::AppUnitsPerCSSPixel()));
nscoord aWidth = NSFloatPixelsToAppUnits(width,float(nsDeviceContext::AppUnitsPerCSSPixel()));
nscoord aHeight = NSFloatPixelsToAppUnits(height,float(nsDeviceContext::AppUnitsPerCSSPixel()));
nsRect r(
aX,
aY,
aWidth,
aHeight );
printf("2 - x: %04f, y: %04f, w: %04f, h: %04f\n", x,y,width,height);
PRInt32 w = static_cast<PRInt32>(width);
PRInt32 h = static_cast<PRInt32>(height);
nsRefPtr<gfxImageSurface> targetSurface = new gfxImageSurface(
gfxIntSize(w,h), gfxASurface::ImageFormatRGB24);
nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
nscolor bgcolor = NS_RGB(255,0,0);//NS_RGBA(0,0,0,0);
utils->RenderDocument(r,
0x20,//0x20, // les flags sont retournés par
// /mozilla-central/source/layout/base/nsIPressShell.h
// ici, j'utilise RENDER_DOCUMENT_RELATIVE
// pour appeler les pixels logiques et non css
bgcolor, ctx);
</code>
And I am working with **targetSurface->Data()**
In my header, i wrote :
<code>
#include "nsIDOMWindowUtils.h"
#include "gfxASurface.h"
#include "gfxImageSurface.h"
nsresult gfxASurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName)
{ return NS_ERROR_NOT_IMPLEMENTED; }
</code>
Bon courage ;)