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. distorted bitmaps and meta's using diff resolutions

distorted bitmaps and meta's using diff resolutions

Scheduled Pinned Locked Moved C / C++ / MFC
graphics
1 Posts 1 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.
  • I Offline
    I Offline
    IGeorgeI
    wrote on last edited by
    #1

    When I copy and paste bitmaps and pictures from my app to another like WORD, the image seems ok under 1280 by 1024. When I change screen resolutions, try to copy and past again, the pictures get distorted and or clipped here is meta code //------------------------------------------------------------------------------ // Create a meta record for drawing the given component. //------------------------------------------------------------------------------ BOOL ZClipboard::setMetaFile(CRect rect, CDC *dc, ZComponent *c, HWND hWnd) { // Meta file DCs operate in HIMETRIC units, we // must scale the extents to these units so that // the object appears the same size when pasted. double units_per_inch = 25.4 / 0.01 + 0.5; // 25.4 mm at 0.01 mm per unit. double scale = units_per_inch / 96.0; // divide by screen units // Now scale the extents to HIMETRIC units. rect.left = int(rect.left * scale + 0.5); rect.top = int(rect.top * scale + 0.5); rect.right = int(rect.right * scale + 0.5); rect.bottom = int(rect.bottom * scale + 0.5); HENHMETAFILE hMF = NULL; CMetaFileDC metadc; if (metadc.CreateEnhanced(dc, NULL, &rect, NULL)) { metadc.SetAttribDC(dc->m_hDC); // This must be set! // Translate the current window origin // to the context of the component. // Un-translate the current window origin // to the parent coords of the component. { ZGraphics meta_g(&metadc); meta_g -= c->getLocationOnCanvas(); meta_g -= c->getLocation(); c->paintAll(meta_g); } hMF = metadc.CloseEnhanced(); // Close the DC. } else return false; // Open the clipboard. OpenClipboard() takes one // parameter, the handle of the window that will temporarily // be it's owner. If NULL is passed, the current process // is assumed. After opening, empty the clipboard so we // can put our metafile on it. if (hMF) { OpenClipboard(hWnd); EmptyClipboard(); SetClipboardData(CF_ENHMETAFILE,hMF); CloseClipboard(); } return true; } here is bitmap code //------------------------------------------------------------------------------ // Get a snapshot of the screen at the location of the given rectangle //------------------------------------------------------------------------------ BOOL ZClipboard::setBitmap(CRect rect, CDC *dc, HWND

    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