×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    13

    SVG Render Problem

    Hi everyone,

    i have got a few problems on rendering SVG format.
    i am using M2G library for Controlling SVG images.

    My code is below;

    //Svg image Path
    String SVG_IMAGE = "/thumbsUp.svg";

    //Getting image With InputStream
    InputStream svgDemoStream = getClass().getResourceAsStream(SVG_IMAGE);
    if (svgDemoStream == null)
    {
    throw new Error("Could not load " + SVG_IMAGE);
    }

    try
    {
    System.err.print("Loading SVGImage .... ");

    //Creating SVG image with inputstream
    SVGImage svgImage = (SVGImage)SVGImage.createImage(svgDemoStream, null);
    System.err.println(" ... Done");

    //adding image to the canvas object
    svgCanvas = new SVGImageCanvas(svgImage);
    svgCanvas.addCommand(this.okCmd);
    svgCanvas.addCommand(this.backCmd);
    svgCanvas.setCommandListener(this);
    this.display.setCurrent(svgCanvas);
    }
    catch (IOException e)
    {
    e.printStackTrace();
    throw new Error("Could not load " + SVG_IMAGE);
    }


    Also my Canvas object something like this;

    class SVGImageCanvas extends Canvas
    {
    /**
    * The SVGImage painted by the canvas.
    */
    public SVGImage svgImage;

    /**
    * The ScalableGraphics used to paint into the midp
    * Graphics instance.
    */
    // create the scalable graphics instance
    public ScalableGraphics sg = ScalableGraphics.createInstance();

    /**
    * @param svgImage the SVGImage this canvas should paint.
    */
    public SVGImageCanvas(SVGImage svgImage) {
    this.svgImage = svgImage;
    }

    public void paint(Graphics g)
    {
    // clear the display
    g.setColor(255, 255, 255);
    g.fillRect(0, 0, getWidth(), getHeight());
    // bind our scalable graphics to the given graphics
    sg.bindTarget(g);
    // render at fixed position and size
    svgImage.setViewportWidth(getWidth());
    svgImage.setViewportHeight(getHeight());
    sg.render(0, 0, svgImage);
    // release the graphics context
    sg.releaseTarget();
    }
    }


    When i run m application i got empty screen and not render thumbsUp.svg image..


    if Anyone has a solution share with me ?

    thanks for reply

    Kamil İNAL

  2. #2
    Registered User
    Join Date
    Sep 2009
    Posts
    13

    Re: SVG Render Problem

    Hi everyone,

    On debug mode this code works fine i can see the SVG image on canvas but on test mode false canvas object shows empty white screen..What is the problem??
    could someone help me??

    thanks for any advice

Similar Threads

  1. Replies: 10
    Last Post: 2009-04-17, 16:49
  2. SVG Problem
    By LAS_VEGAS in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2008-06-30, 14:20
  3. Problem with svg icon
    By patrickfrei in forum Symbian Media (Closed)
    Replies: 30
    Last Post: 2007-02-15, 06:13
  4. SVG on 5500 problem...
    By eagerb in forum Mobile Java General
    Replies: 8
    Last Post: 2007-01-16, 01:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×