how to save one svg image by programing

This is a discussion on how to save one svg image by programing within the C++ Programming forums, part of the General Programming Boards category; I wonder how to saving one picture( bitmap format in memory ) in svg format in c++ ( on windows ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    13

    how to save one svg image by programing

    I wonder how to saving one picture( bitmap format in memory ) in svg format in c++ ( on windows ).anyone help me ? I need your help . my programing tool is visual c++ 6.0.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    Quote Originally Posted by sfguofen View Post
    I wonder how to saving one picture( bitmap format in memory ) in svg format in c++ ( on windows ).anyone help me ? I need your help . my programing tool is visual c++ 6.0.
    Have you read the specs yet? If not, start there first. After writing a bit of code you can always ask questions here if you get stuck.

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    13
    Quote Originally Posted by Sebastiani View Post
    Have you read the specs yet? If not, start there first. After writing a bit of code you can always ask questions here if you get stuck.
    yes i have read the syntax of svg ,and i can create some pictures by wirting code in notepad. the problem is that i cannot make the chinese display correctly and the solutions I found are mainly based on the ultraedit32 . I must make the tranformation by programing other than the ultraedit32, because that was one function of my program . can you give me some advices

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    Well, let's see the code you're using then. As far as I can tell, it's just an issue of setting up the font element correctly.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    > I wonder how to saving one picture( bitmap format in memory ) in svg format in c++
    You're already too late.

    If you want to generate SVG, then you need to start with the "DrawRectangle" call (and all the other API calls you made to paint the picture in your bitmap), and output the relevant SVG at that point.

    Examining a whole bunch of red pixels in a bitmap sometime later will be a hell of a lot harder to do, with less than optimal results.

    Unless all you want is
    <image xlink:href="mypicture.bmp">
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Aug 2009
    Posts
    13
    Quote Originally Posted by Salem View Post
    > I wonder how to saving one picture( bitmap format in memory ) in svg format in c++
    You're already too late.

    If you want to generate SVG, then you need to start with the "DrawRectangle" call (and all the other API calls you made to paint the picture in your bitmap), and output the relevant SVG at that point.

    Examining a whole bunch of red pixels in a bitmap sometime later will be a hell of a lot harder to do, with less than optimal results.

    Unless all you want is
    <image xlink:href="mypicture.bmp">
    could you give any details .I don't know how to output the relevant svg at that point . what's the function I should call .

  7. #7
    Registered User
    Join Date
    Aug 2009
    Posts
    13
    Quote Originally Posted by sfguofen View Post
    could you give any details .I don't know how to output the relevant svg at that point . what's the function I should call .
    my code is as followings, I really don't know how to make it display the chinese
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
    <svg>
    <circle cx = "100" cy = "100" r = "50" style="fill:rgb(255,255,255); stroke:rgb(0,0,0);stroke-width :1 "/>
    <circle cx = "200" cy = "100" r = "50" style="fill:rgb(255,255,255); stroke:rgb(0,0,0);stroke-width :1 "/>
    <rect x = "100" y = "50" width = "100" height = "100" style=" fill:rgb(255,255,255) ; stroke:rgb(0,0,0);stroke-width:0"/>
    <line x1= "100" y1 = "50" x2 = "200" y2 ="50" style="stroke:rgb(0,0,0) ;stroke-width:1"/>
    <line x1 = "100" y1 = "150" x2 = "200" y2 = "150" style="stroke:rgb(0,0,0) ;stroke-width:1" />
    <text style= "fill:black;" font-size = "30" font-family="LiSu" x = "100" y = "70" width="200" height="30">你好吗?
    </text>
    </svg>

  8. #8
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    Quote Originally Posted by sfguofen View Post
    could you give any details .I don't know how to output the relevant svg at that point . what's the function I should call .
    What Salem was pointing out to you is that it would make more sense to generate the SVG file *while* you are generating the bitmap (since SVG is optimised for vector representations of images, you could generate the appropriate SVG element at the point where each individual shape, etc, is being rendered to the bitmap).

  9. #9
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
    You've encoded the file as an English-language UTF-8 document.

  10. #10
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    Read this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 12:10 PM
  3. How to get image from the screen and then save it to a file?
    By nomer in forum Windows Programming
    Replies: 2
    Last Post: 05-25-2006, 08:46 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. How to save an 'image' from the graphics mode to HD
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 07-14-2002, 10:25 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21