You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by jianlizhao <ji...@hotmail.com> on 2012/05/23 11:06:34 UTC

how Get Bitmap file from SVG module?

Hi Armin:
I ask you some question as below:
In  module svg, have two Interfaces, one is  XSVGPrinter, the other is
XSVGWriter.

1) Can I use these interfaces, output Bitmap file?

2) under the module svg, in the file of svgimagenode.cxx,

void extractFromGraphic (
            const Graphic & rGraphic
            drawinglayer :: primitive2d :: Primitive2DSequence & rEmbedded,
            basegfx :: B2DRange & rViewBox,
            BitmapEx & rBitmapEx)

is the  parameters rBitmapEx get Bitmap file?

Thanks...
Best Regards!


Re: how Get Bitmap file from SVG module?

Posted by Armin Le Grand <Ar...@me.com>.
	Hi Eric,

On 24.05.2012 03:43, Yong Lin Ma wrote:
> Let me try to translate the message below.

Thanks, that helped. Ansering below...

> Hi Armin,
> I see two interfaces XSVGPrinter and XSVGWriter in svg mdoule
>
> Could they be used for graphic in Bitmap format?

No.

> For function extractFromGraphic in svgimagenode
>
> void extractFromGraphic (
>              const Graphic&  rGraphic
>              drawinglayer :: primitive2d :: Primitive2DSequence&  rEmbedded,
>              basegfx :: B2DRange&  rViewBox,
>              BitmapEx&  rBitmapEx)
>
> What is parameter rBitmapEx work for?

This is a helper method in module svxio. It is not exported from the 
svgio module to make that clear. It should not be called directly and 
may change in the future.

Instead, use the classes Graphic and GraphicObject and work with the 
SvgData class used there if you want to do something in the environment 
of the office core code.

 From outside you may use the service XSvgParser to convert from 
io::XInputStream to uno::Sequence< uno::Reference< 
::graphic::XPrimitive2D > > (the imported primitive representation of 
the SVG). Then use the service XPrimitive2DRenderer to convert such a 
primitive to a rendering::XBitmap. Grep the code to find usage examples.

HTH!

> On Wed, May 23, 2012 at 5:06 PM, jianlizhao<ji...@hotmail.com>  wrote:
>> Hi Armin:
>> I ask you some question as below:
>> In  module svg, have two Interfaces, one is  XSVGPrinter, the other is
>> XSVGWriter.
>>
>> 1) Can I use these interfaces, output Bitmap file?
>>
>> 2) under the module svg, in the file of svgimagenode.cxx,
>>
>> void extractFromGraphic (
>>             const Graphic&  rGraphic
>>             drawinglayer :: primitive2d :: Primitive2DSequence&  rEmbedded,
>>             basegfx :: B2DRange&  rViewBox,
>>             BitmapEx&  rBitmapEx)
>>
>> is the  parameters rBitmapEx get Bitmap file?
>>
>> Thanks...
>> Best Regards!
>>
>



Re: how Get Bitmap file from SVG module?

Posted by Yong Lin Ma <ma...@apache.org>.
Let me try to translate the message below.

Hi Armin,
I see two interfaces XSVGPrinter and XSVGWriter in svg mdoule

Could they be used for graphic in Bitmap format?

For function extractFromGraphic in svgimagenode

void extractFromGraphic (
            const Graphic & rGraphic
            drawinglayer :: primitive2d :: Primitive2DSequence & rEmbedded,
            basegfx :: B2DRange & rViewBox,
            BitmapEx & rBitmapEx)

What is parameter rBitmapEx work for?

On Wed, May 23, 2012 at 5:06 PM, jianlizhao <ji...@hotmail.com> wrote:
> Hi Armin:
> I ask you some question as below:
> In  module svg, have two Interfaces, one is  XSVGPrinter, the other is
> XSVGWriter.
>
> 1) Can I use these interfaces, output Bitmap file?
>
> 2) under the module svg, in the file of svgimagenode.cxx,
>
> void extractFromGraphic (
>            const Graphic & rGraphic
>            drawinglayer :: primitive2d :: Primitive2DSequence & rEmbedded,
>            basegfx :: B2DRange & rViewBox,
>            BitmapEx & rBitmapEx)
>
> is the  parameters rBitmapEx get Bitmap file?
>
> Thanks...
> Best Regards!
>

Re: how Get Bitmap file from SVG module?

Posted by Regina Henschel <rb...@t-online.de>.
Hi jianlizhao,

it is still not clear to me, what you want to do:

Do you want to write macros or extensions and need help to use the API?

or

Do you want to work on the core itself. If it is this, what do you want 
to do? What feature do you want to implement or what bug do you want to fix?

jianlizhao schrieb:
> Hi Armin:
> I ask you some question as below:
> In  module svg, have two Interfaces, one is  XSVGPrinter, the other is
> XSVGWriter.
>
> 1) Can I use these interfaces, output Bitmap file?

If you will use the API the interface XGraphicRasterizer seems to be the 
correct one.

>
> 2) under the module svg, in the file of svgimagenode.cxx,
>
> void extractFromGraphic (
>              const Graphic&  rGraphic
>              drawinglayer :: primitive2d :: Primitive2DSequence&  rEmbedded,
>              basegfx :: B2DRange&  rViewBox,
>              BitmapEx&  rBitmapEx)
>
> is the  parameters rBitmapEx get Bitmap file?

As far as I understand it, you have to use methode getDecomposition from 
XSvgParser and then method rasterize from XPrimitve2DRenderer. But Armin 
can surely tell it, he had implemented it ;)

Kind regards
Regina

Re: how Get Bitmap file from SVG module?

Posted by Armin Le Grand <Ar...@me.com>.
	Hi jianlizhao,

On 23.05.2012 11:06, jianlizhao wrote:
> Hi Armin:
> I ask you some question as below:
> In  module svg, have two Interfaces, one is  XSVGPrinter, the other is
> XSVGWriter.

Both are interfaces, XSVGPrinter is not used at all and XSVGWriter is 
the current SVG export which has nothing to do with the new import. 
There also is no module svg, the module I added for the new SVG import 
is svgio.

> 1) Can I use these interfaces, output Bitmap file?

No.

> 2) under the module svg, in the file of svgimagenode.cxx,
>
> void extractFromGraphic (
>              const Graphic&  rGraphic
>              drawinglayer :: primitive2d :: Primitive2DSequence&  rEmbedded,
>              basegfx :: B2DRange&  rViewBox,
>              BitmapEx&  rBitmapEx)
>
> is the  parameters rBitmapEx get Bitmap file?

I am not sure what you want to do. To work with imported SVGs you need a 
Graphic (see vcl and GraphicObject, too) where it is loaded. From 
Graphic you may try

     const SvgDataPtr& getSvgData() const;

If getSvgData().is() there is a SVG graphic. At the contained SvgData 
you can use

     const BitmapEx& getReplacement() const;

to get the BitmapEx of the SVG. There is no need to work with stuff from 
svgio directly. All usages work with it are using the service XSvgParser 
and do the work for you, where XSvgParser is implemented in svgio.

I still do not understand what you want to do, please explain this, else 
I cannot really help you.

> Thanks...
> Best Regards!
>
>

Sincerely,
	Armin
--
ALG