[webkit-help] Webpage thumbnails

Emerick Rogul emerick at gmail.com
Fri Apr 2 07:08:42 PDT 2010


Hi everyone,

I'm using the Chromium port of WebKit in my Windows application.  I'm
working on a component that will produce a reduced-scale thumbnail of
the current web page.  I can't seem to get the rendered image to scale
properly using Skia and I'm not sure what I'm doing wrong.

Here's what I'm attempting:

WebKit::WebSize webSize = frame->view()->size();

// Create the canvas and scale it down 50%
skia::VectorCanvas canvas(hdc, webSize.width, webSize.height);
canvas.drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
canvas.scale(SkScalar(0.50), SkScalar(0.50));

// Paint the view into the canvas
WebKit::WebRect rect(0, 0, webSize.width, webSize.height);
frame->view()->layout();
frame->view()->paint(&canvas, rect);

This results in an image, but it has two problems:

1 - It's just a small portion of the webpage.  Specifically, if my HDC
contains a 800x800 bitmap, then this will only return an 800x800
portion of the webpage.  What I want is *all* of the webpage, scaled
to fit into an 800x800 (in this example) bitmap.

2 - The image quality is really low.  Barely legible, in fact.

I'm pretty sure I'm doing something wrong here or missing something
basic.  Could anyone give me a good shove in the right direction?

Thanks,

Emerick


More information about the webkit-help mailing list