Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. "Printing" to a bitmap? - How?

"Printing" to a bitmap? - How?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestionc++data-structureshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jim Howard
    wrote on last edited by
    #1

    Programming would be a good way to make a living if it were not for these pesky users. I work on an application that draws some graphs of data obtained from test instruments. The graphing is done by our own MFC based graph class. It draws onto a CDC object in response to a windows draw message in the normal MFC way. We can render our graphs on the screen or the printer with no problems. There's a lot of code in the class, but it's very standard MFC drawing, nothing unusual. Just when I thought I was safe to take off early on Friday, management comes up with this: "Hey Jim, our big important customers love our graphs, but they want to be able to save them as jpegs so they can embed them in their word processing documents. Can you hack something up? They are visiting next week and we'd like a demo." Great. I have one little problem with this request. I have no idea how to even start! I'm sure that saving it as a regular uncompressed bitmap would be fine, I have a graphics class that lets me display, save, and print bitmaps in both jpeg and windows bitmap formats. But how do I get the bitmap in the first place? Is there anyway to have a "bitmap device context"? I'm trying to think, but nothing is happening. I know there are programs that do this, so it must be possible. Your suggestions and pointers are very welcome. :confused: :mad: X| Jim

    T 1 Reply Last reply
    0
    • J Jim Howard

      Programming would be a good way to make a living if it were not for these pesky users. I work on an application that draws some graphs of data obtained from test instruments. The graphing is done by our own MFC based graph class. It draws onto a CDC object in response to a windows draw message in the normal MFC way. We can render our graphs on the screen or the printer with no problems. There's a lot of code in the class, but it's very standard MFC drawing, nothing unusual. Just when I thought I was safe to take off early on Friday, management comes up with this: "Hey Jim, our big important customers love our graphs, but they want to be able to save them as jpegs so they can embed them in their word processing documents. Can you hack something up? They are visiting next week and we'd like a demo." Great. I have one little problem with this request. I have no idea how to even start! I'm sure that saving it as a regular uncompressed bitmap would be fine, I have a graphics class that lets me display, save, and print bitmaps in both jpeg and windows bitmap formats. But how do I get the bitmap in the first place? Is there anyway to have a "bitmap device context"? I'm trying to think, but nothing is happening. I know there are programs that do this, so it must be possible. Your suggestions and pointers are very welcome. :confused: :mad: X| Jim

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      "Bitmap device context" is called "memory device context" in Windows. Check the docs for CreateCompatibleDC. Tomasz Sowinski -- http://www.shooltz.com.pl

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups