Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 327235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:23:00+00:00 2026-05-12T09:23:00+00:00

I have some legacy MFC apps, and I’d like to use the Cairo drawing

  • 0

I have some legacy MFC apps, and I’d like to use the Cairo drawing engine to add some charts and graphs.

I’m searching for a small example of how to get that to work. Basically, once I’ve created a PNG or GIF file, how do I get that show up in an MFC CView window?

My google-fu is not finding any good clues.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:23:00+00:00Added an answer on May 12, 2026 at 9:23 am

    From my demo samples,

    // cairo_surface_t *surface;
    // cairo_t *cr;
    
    // surface = call_win32_surface_create_with_dib_T(CAIRO_FORMAT_ARGB32, 240, 80);
    // cr = call_create_T (surface);
    
    // call_surface_write_to_png_T (surface, "hello.png");
    
    
    HDC src = call_win32_surface_get_dc_T(surface); // <--------
    BitBlt(dest, 0, 0, 240, 80, src, 0,0, SRCCOPY); // <--------
    

    Assuming that you already have a surface you can use something like the above sample.
    dest is the HDC handle to the window you want to render the cairo surface.

    Update: CView::OnDraw()

    You should implement the OnDraw() method for your CView (inherited?) class.

    You can use the pDC pointer to draw the cairo surface, ie:

    pDC->BitBlt(0, 0, 240, 80, src, 0,0, SRCCOPY); // "HDC src" is mentioned above
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some legacy code that I am now trying to re-use under Spring.
We have some legacy code that needs to identify in the Page_Load which event
I have inherited some legacy PHP code what was written back when it was
Presently I have a some legacy code, which generates the op code. If the
Today, I have seen some legacy code. In the destructor there is a statement
I have some really complicated legacy code I've been working on that crashes when
I have been working on some legacy C++ code that uses variable length structures
I have a MySQL instance running locally on port 3306, but for some legacy
I have a name in a database, lets say its DFectuoso and some legacy
I have to change some connection strings in an incredibly old legacy application, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.