How can I get the bitmap of just a portion of the SVG file?

Asked by Amin Ry

Hi

I want to just render just a portion of SVG file, with specific scaling, Is there any way to do that?
Example:
Render x=30, y=40, width=500, height=400 of SVG file
to a bitmap with size: W=1000 H=800

bye.

Question information

Language:
English Edit question
Status:
Answered
For:
libsvg-android Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
pltxtra (pltxtra) said :
#1

Hi,

the easiest way is to rasterize the SVG file to a off-screen bitmap that you allocate separately, then you copy the specific parts of the bitmap that you are interested in.

    Best Regards
       Anton

Revision history for this message
Amin Ry (roudaky) said :
#2

Hi

Actually If I first convert to BMP then if the user zoom in, the quality will be reduced, besides if I want to make a large bitmap, then out of memory exception happen, because Android does not allow to allocate that much memory.
I wish the library had the crop function built in, so that I don't need to rasterize the whole image.

regards

Revision history for this message
pltxtra (pltxtra) said :
#3

I see, unfortunately the library does not support that..

On Tue, Mar 15, 2011 at 4:31 PM, Amin Ry <
<email address hidden>> wrote:

> Question #149106 on libsvg-android changed:
> https://answers.launchpad.net/libsvg-android/+question/149106
>
> Amin Ry posted a new comment:
> Hi
>
> Actually If I first convert to BMP then if the user zoom in, the quality
> will be reduced, besides if I want to make a large bitmap, then out of
> memory exception happen, because Android does not allow to allocate that
> much memory.
> I wish the library had the crop function built in, so that I don't need to
> rasterize the whole image.
>
> regards
>
> --
> You received this question notification because you are an answer
> contact for libsvg-android.
>

Revision history for this message
pltxtra (pltxtra) said :
#4

Amin,

one thing that is possible; scale the SVG itself. This will probably solve the problem.

For some hints, have a look here:
http://www.codeproject.com/KB/android/Android_SVG_support.aspx

That guy has done things that are similar to what you want to do.

Revision history for this message
Amin Ry (roudaky) said :
#5

Hi

I have seen that project, but that one does not work for large images still.

for large images we are required to just draw part of the image, because otherwise the android does not let us use that much memory.

regards

Can you help with this problem?

Provide an answer of your own, or ask Amin Ry for more information if necessary.

To post a message you must log in.