PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

how do i write databytes to backbuffer?

hi guys,

how do i write databytes to backbuffer? i wish to set the RGB data myself ie array of bytes to buffer rather than using the setpixels of the CGapiSurface class.

thank you frens
Hi,

Use GetBuffer() to get raw access to the internal buffer of the surface. When you are done, call ReleaseBuffer(). See the Plasma sample application for an example of this.
Donovan · 05 Dec 2002, 11:12 UTC — pitch??
thanks for replying. what is pitch in the gapi context?
Pitch is the number of bytes to move in x and y directions on the buffer.

For example, if (X=0, Y=0) is stored in the pointer "WORD* pBuffer", to advance one pixel to the right you should write: "pBuffer += (xPitch >> 1)". To advance one pixel down, you should write: "pBuffer += (yPitch >> 1"). There are several optimizations that can be done, such as always going in the positive direction of the smallest pitch value to optimize cache performance...
Donovan · 05 Dec 2002, 11:22 UTC — where can i learn more?
gee...thanks. may i know how u mange to get such info? where can i get such documentation? the gapidraw site only explain the classes. i need more documentation than these....your help is greatly appreciated!!! :wink: