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 ;)
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to