[cairo] null stream pdf surface

Kozhevnikov Mikhail mikhailkozhevnikov at yandex.ru
Tue Aug 24 13:32:53 PDT 2010


Hi,

Sorry, forgot the attachment. Here it goes.
I think I got what you mean. We have two modes -- one is exactly what you mean, when we select the target image size based on the content size. In the other one we have to fit the content into given target image size. In the latter case, I'd like to render it into a temporary surface and then copy to the target surface with scaling.

Cheers, 
Mikhail.

24.08.2010, 23:13, "Behdad Esfahbod" <behdad at behdad.org>:
> I wasn't suggesting any scaling. Maybe you can explain again what exactly you
> are trying to achieve. What I can guess is that you have a fixed surface
> size, and you want to scale the text to exactly fit in?
>
> If that's the problem, I have all the answers since I've done this many times.
>
> behdad
>
> On 08/24/10 14:43, Kozhevnikov Mikhail wrote:
>
>>  Hi Behdad,
>>
>>  Thank for your suggestion! I think that should work great for vector surfaces, but scaling down a png would not look nice (I've tried it out -- see the results attached). The scale factor of 5 I use in the example is not quite realistic, of course, but the conclusion is that apparently we cannot avoid the loss of quality in general case. I think I'll settle with re-rendering until the real meta-surface arrives.
>>
>>  Cheers,
>>  Mikhail.
>>
>>  24.08.2010, 21:00, "Behdad Esfahbod" <behdad at behdad.org>:
>>>  On 08/23/10 20:20, Kozhevnikov Mikhail wrote:
>>>>   Hi,
>>>>
>>>>   I'm trying to draw a graph with textual labels so as to fit exactly the size of the image requested by the user -- that is, the content should touch the border in at least one dimension. I thought of rendering the stuff into a metasurface, and then, knowing the size of the result, transform it and embed into the target image, which is a png, usually. However, when doing so I notice the text looks a bit worse (see example attached). Is it supposed to go like this?
>>>>   I can just re-render the content into he target surface directly, but that would require some more changes to the code in order to be efficient.
>>>  I suggest that you always create a temp surface of the same type as your final
>>>  target. Font settings defaults differ from surface type to surface type...
>>>  You can create a 0x0 temp surface. Works just as well.
>>>
>>>  Cheers,
>>>  behdad
>>>>   Cheers,
>>>>   Mikhail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-direct.png
Type: image/png
Size: 985 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100825/e9e0c46b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-meta-png.png
Type: image/png
Size: 743 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100825/e9e0c46b/attachment-0001.png>


More information about the cairo mailing list