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
U

User 1619799

@User 1619799
About
Posts
5
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Performance issue when drawing on MFC
    U User 1619799

    Nice tips @Leon, many thanks for your help!

    C / C++ / MFC c++ graphics help question performance

  • Performance issue when drawing on MFC
    U User 1619799

    Hello all & Thanks for reading this, -I would have a question on you: -I have created a small application on MFC/C++ that draw different geometric shapes on screen using the mouse (like Paint). These shapes can be moved and rotated, so, I had to keep all these created shapes in a vector and draw all of them in OnDraw(). -My problem is, when I create many shapes (more than 50-60) and I try to move/rotate one of the shapes, these movements/rotations become very-very slow. -Could you give me some tips in order to make my application faster when moving/rotating?

    OnDraw(CDC* pDC)
    {

    for (int i = 0; i < numberObjects; i++)
    objects\[i\]->DrawShape(pDC);
    

    }

    Many thanks!

    C / C++ / MFC c++ graphics help question performance

  • Gdiplus: DrawImage not working
    U User 1619799

    Actually the problem was related to the way of copying from srcHDC to ImageHDC. I have done like this:

    HDC svgDC = cairo_win32_surface_get_dc(surface);

    image.Create(width, height, 32);

    image.SetHasAlphaChannel(TRUE);

    HDC imageHDC = image.GetDC();

    BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
    AlphaBlend(imageHDC, 0, 0, width, height, svgDC, 0, 0, width, height, blend);

    image.ReleaseDC();

    Best regards!

    C / C++ / MFC graphics help csharp c++ visual-studio

  • Gdiplus: DrawImage not working
    U User 1619799

    Hi all, I need some help from you: I try to render an SVG image on the screen (with alpha channel). The problem is, when I try to draw the image on the screen, I see absolutely nothing. First of all, my SVG image is loaded correctly, and the ATL CImage from the below code, contains a correct image. The problem start when I try to use Gdiplus + alpha channel. For instance, if I use PixelFormat24bppRGB instead of PixelFormat32bppARGB, the image is drawn correctly, but alpha channel is not preserved - a black halo is shown around my image. Do you see any problem in my code? PS: I use Win7, 32 bit + Visual Studio 2013 Ultimate. Many thanks!

    void CAppView::OnDraw(CDC* pDC)
    {

    int width = 600, height = 600;
    
    GError\* pError = NULL;
    
    rsvg\_init();
    g\_my\_svg = rsvg\_handle\_new\_from\_file("d:\\\\myImage.svg", &pError);
    rsvg\_handle\_get\_dimensions(g\_my\_svg, &g\_dimension);
    
    
    cairo\_surface\_t \*surface = cairo\_win32\_surface\_create\_with\_dib(CAIRO\_FORMAT\_ARGB32, width, height);
    cairo\_t\* cr = cairo\_create(surface);
    
    rsvg\_handle\_render\_cairo(g\_my\_svg, cr);
    
    HDC srcHDC = cairo\_win32\_surface\_get\_dc(surface);
    
    // Create ATL CImage, then, copy the content of srcHDC in the CImage HDC
    CImage image;
    image.Create(width, height, 32);
    
    HDC imageHDC = image.GetDC();
    
    TransparentBlt(imageHDC, 0, 0, width, height, srcHDC, 0, 0, width, height, RGB(0, 0, 0));
    
    
    // Initialize Gdiplus
    Gdiplus::GdiplusStartupInput gdiplusStartupInput;
    ULONG\_PTR gdiplusToken;
    Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
    

    // Problems starts from this point.

    // Create a Gdiplus bitmap, and copy the content of CImage in bitmap, then write the bitmap on the screen.
    Gdiplus::Bitmap bmp(image.GetWidth(), image.GetHeight(), image.GetPitch(), PixelFormat32bppARGB, static\_cast(image.GetBits()));
    Gdiplus::Graphics graphics(pDC->GetSafeHdc());
    graphics.DrawImage(&bmp, Gdiplus::Rect(0, 0, width, height));
    
    
    
    Gdiplus::GdiplusShutdown(gdiplusToken);
    image.ReleaseDC();
    image.Destroy();
    cairo\_surface\_flush(surface);
    cairo\_destroy(cr);
    cairo\_surface\_destroy(surface);
    

    }

    C / C++ / MFC graphics help csharp c++ visual-studio

  • Tool for automation
    U User 1619799

    Hello all,

    I need a little help: I want to create an application that automatize different applications in the sense that my application will be able to press automatically different buttons on another application.

    For example: my application will start, let's say, Microsoft Office, will press some buttons in MSOffice, and will close MSOffice.

    Could you give me an idea how to do that ? I have no clue... some code in C/C++ would be perfect.

    Thank you very much!

    <script src="//www.codeproject.com:8011/bar17428.js" type="text/javascript" ></script>

    C / C++ / MFC javascript tools tutorial c++ com
  • Login

  • Don't have an account? Register

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