incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianlizhao <jianlizh...@hotmail.com>
Subject how Get Bitmap file from SVG module?
Date Thu, 24 May 2012 14:07:36 GMT
Hi Armin:
I am very glad to receipt your letter,

I see the following content in your blog:
There were also ODF-compatible File Format adaptions needed, more concrete
the in ODF already contained and described multi-image support. In ODF, the
original SVG is now embedded to the 'Pictures' folder inside the ODF file as
one would expect from such a feature and can be easily extracted (unzip the
ODF file and there you are). There is also a Png file written as replacement
image. The draw:frame is now multi-image capable (as the spec allows). In
the case of a SVG it writes a good quality Png and the original SVG as
draw:image elements. Since older (and other) office versions are only
capable of loading a single (and thus the first) image, the Png is written
first. This allows file exchange with other and older offices without
breaking backward compatibility and/or ODF file exchange.

I have two questions :
1) I would also like to use this method to insert the picture, so that in
document will retain the original file, the original file  is there are
other useful.
2) How do I access the original file.

Thanks...
Best Regards!


-----邮件原件-----
发件人: Armin Le Grand [mailto:Armin.Le.Grand@me.com] 
发送时间: 2012年5月24日 18:10
收件人: ooo-dev@incubator.apache.org
主题: Re: how Get Bitmap file from SVG module?

	Hi jianlizhao,

On 24.05.2012 10:57, jianlizhao wrote:
> Hi Armin:
> Read your letter, I know my idea is stupid.
> 
> I would like to achieve an ADDON expansion in openoffice's write,
> The extension function is plug a new type of picture into openoffice's
> write, need following requirements
> 
> 1) There were also ODF-compatible File Format adaptions needed.That is to
> say,
>     That is not installed the extended  on the openoffice's write  can
open
> the saved file.
> 2) If the extension is installed, can use the extended functionality to
deal
> with the inserted picture.
> 
> This function is very similar to  your SVGIO, so I need to look deeper
> SVGIO.

Sorry, it is not similar and I would not suggest svgio as an example to
extend for picture formats. The way to extend picture formats is to look
at how e.g. png, jpeg and others are handled in the office and to extend
these by a filter. Be warned, this is a complex (and fragile) system
which will need a lot of care.

Your raw format is pixel data, so this will fit much better than svgio.
Svgio needed an exception to be hold at Graphic/GraphicObject at all,
this will not be needed for another pixel-based format and thus is a
very bad example for your case.

All this would need to be done in the core, there are deep vcl- and
tools-based mechanisms behind this, including the GraphicManager who
will automatically buffer the picture data and import/export it on
demand to rduce mem footprint. I think it cannot be done as an extension.

What you could do in an extension is to implement the loader (raw data
to Bitmap/BitmapEx) and insert that pixel data using API to the writer
somehow. It will then not be embedded as the original raw bitmap data,
but it will be in the system in a compatible way.

HTH!

> Then modeled this idea, realization my needs.
> 
> I have installed openoffice's SDK.Debugging through a simple C++ example
of
> the addon.
> Do you have any good suggestions.
> 
> Thanks...
> Best Regards!
> 
> 
> 
> -----邮件原件-----
> 发件人: Armin Le Grand [mailto:Armin.Le.Grand@me.com]
> 发送时间: 2012年5月23日 20:51
> 收件人: ooo-dev@incubator.apache.org
> 主题: Re: how Get Bitmap file from SVG module?
> 
> 	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
> 
> 
> 




Mime
View raw message