Original Post
Hi Guys I am new to DirectX and I am working on saving / printing images for a graphics engine which produces 3D graphs. I am trying to fetch DC from backbuffer and use StretchDIBits to inject into a print DC. But the lines and text I get are full of "jaggies". A portion of my prototype code is shown below. ************************************************ HRESULT hr; D3DDISPLAYMODE mode; if (FAILED(hr=m_pDevice->GetDisplayMode(D3DADAPTER_DEFAULT,&mode))) return ; IDirect3DSurface9* ipSurface = NULL; IDirect3DSurface9* origTarget = NULL; IDirect3DSurface9* ipBackSurface = NULL; HRESULT hrO = m_pDevice->GetRenderTarget( 0, &origTarget); D3DSURFACE_DESC obSurfaceDesc; origTarget->GetDesc(&obSurfaceDesc); HRESULT hrReAA = m_pDevice->CreateRenderTarget( obSurfaceDesc.Width, obSurfaceDesc.Height/*756,472*/, mode.Format, obSurfaceDesc.MultiSampleType, obSurfaceDesc.MultiSampleQuality,FALSE, &ipBackSurface, NULL ); HRESULT hrReBB = m_pDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&ipBackSurface); HRESULT hrReCC = m_pDevice->CreateOffscreenPlainSurface(obSurfaceDesc.Width, obSurfaceDesc.Height/*756, 472*/, mode.Format, D3DPOOL_SYSTEMMEM, &ipSurface, NULL); HRESULT hrReDD = m_pDevice->GetRenderTargetData(ipBackSurface,ipSurface);//>GetFrontBufferData(1, ipSurface); D3DXSaveSurfaceToFile(_T("c:\\Test\\Surface3.bmp"),D3DXIFF_BMP,ipSurface,NULL,NULL); HDC hDC_BackSurface = NULL; HRESULT hrRetVal = ipBackSurface->GetDC(&hDC_BackSurface); ******The device creation was done this way*********** D3DPRESENT_PARAMETERS oD3dpp; oD3dpp.BackBufferWidth = nWidth; oD3dpp.BackBufferHeight = nHeight; oD3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; oD3dpp.BackBufferCount = 1; oD3dpp.MultiSampleType = D3DMULTISAMPLE_4_SAMPLES; oD3dpp.MultiSampleQuality = 0; oD3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; oD3dpp.hDeviceWindow = hWnd; oD3dpp.Windowed = true; // fullscreen oD3dpp.EnableAutoDepthStencil = true; oD3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; // depth format oD3dpp.Flags = 0; oD3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; oD3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; HRESULT result = m_pD3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING,&oD3dpp,&m_pDevice); ************************************************ Can somebody please help. I am stuck here and not able to proceed. Thanks in advance... Ram