Re: Parameters for RenderDocument
"Pit M." <[email protected]> Tue, 21 Jun 2011 04:44:33 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.embedding |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <902be1a5-93ce-4292-be80-d47af5d0063e@em7g2000vbb.googlegroups.com> |
On 21 Jun., 03:27, Joffrey <[email protected]> wrote: > 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 ;) Merci! i get a lot of linking errors when compiling your code: 1>win32_test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall gfxContext::gfxContext(class gfxASurface *)" (__imp_??0gfxContext@@QAE@PAVgfxASurface@@@Z) referenced in function "unsigned int __stdcall combitRenderingTry4(class nsIDOMWindowUtils *,float,float,float,float)" (? combitRenderingTry4@@YGIPAVnsIDOMWindowUtils@@MMMM@Z) 1>win32_test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall gfxImageSurface::gfxImageSurface(struct gfxIntSize const &,enum gfxASurface::gfxImageFormat)" (__imp_?? 0gfxImageSurface@@QAE@ABUgfxIntSize@@W4gfxImageFormat@gfxASurface@@@Z) referenced in function "unsigned int __stdcall combitRenderingTry4(class nsIDOMWindowUtils *,float,float,float,float)" (? combitRenderingTry4@@YGIPAVnsIDOMWindowUtils@@MMMM@Z) 1>win32_test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall gfxIntSize::gfxIntSize(int,int)" (__imp_??0gfxIntSize@@QAE@HH@Z) referenced in function "unsigned int __stdcall combitRenderingTry4(class nsIDOMWindowUtils *,float,float,float,float)" (? combitRenderingTry4@@YGIPAVnsIDOMWindowUtils@@MMMM@Z) 1>win32_test.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall gfxASurface::EndPrinting(void)" (? EndPrinting@gfxASurface@@UAEIXZ) ... and more do you use XPCOM.DLL ? Which Firefox version do you support? Kind Regards Pit