Coder Social home page Coder Social logo

Pixel about dxgicapturesample HOT 4 OPEN

pgurenko avatar pgurenko commented on August 14, 2024
Pixel

from dxgicapturesample.

Comments (4)

pgurenko avatar pgurenko commented on August 14, 2024

Hi JR,

After the call to GetOutputBits, pBuf should have the 361*2 integers each representing the actual pixek in BGRA:

hr = m_spWICFactory->CreateBitmapFromMemory(dwOutputWidth, dwOutputHeight, GUID_WICPixelFormat32bppBGRA, dwOutputWidth*4, dwOutputWidth*dwOutputHeight*4, (BYTE*)pBuf, &spBitmap);

You can get an idea on how to access those by looking at the mouse pointer drawing code here:

pDesktopBits32[jDP*dwDestWidth + iDP] = (pDesktopBits32[jDP*dwDestWidth + iDP] ^ pShapeBuffer32[i + (m_pDXGIPointer->GetShapeInfo().Pitch/4)*j]) | 0xFF000000;

from dxgicapturesample.

jrsmile avatar jrsmile commented on August 14, 2024

Hi, thanks for pointing me to the correct solution.
i came up with this: https://github.com/jrsmile/DXGICaptureSample/blob/master/DXGICaptureSample/DXGICaptureSample.cpp

the first thing i tried was to crop the framebuffer to my desired RECT. as a result it spid out a defect bmp.
so i removed the bmp conversion alltogether and went back to fullscreen RECT. now the buffer works. but it adds a lot of overhead during capture.

could you tell me how to solve this?

from dxgicapturesample.

jrsmile avatar jrsmile commented on August 14, 2024

sorry to disturb you again, i have a problem with the above mentioned example. when loosing focus the application hangs and only occasionaly spits out a new line of recorded pixels. is there some kind of thread sleep involved when ithe application is not in foreground?

from dxgicapturesample.

pgurenko avatar pgurenko commented on August 14, 2024

so i removed the bmp conversion alltogether and went back to fullscreen RECT. now the buffer works. but it adds a lot of overhead during capture.
could you tell me how to solve this?

Not sure this is the right code for the job then: if you need only part of the screen, probably old goo GDI will work better, this technique is for whole desktop/monitor capture.

sorry to disturb you again, i have a problem with the above mentioned example. when loosing focus the application hangs and only occasionaly spits out a new line of recorded pixels. is there some kind of thread sleep involved when ithe application is not in foreground?

Not sure I understand the case: you only capture once in your code, when does this loosing focus gets place? First idea is process does something heavy and OS just does not give it enough CPU when in background (changing process priority could tell whether it's the case).
There is no sleeps in the capture code.

from dxgicapturesample.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.