New answers tagged

0

Ok, I had to add this answer because I found something on my own: Basically there is this function SDL_ConvertPixels() hidden in the wiki and it's located inside SDL_surface.h header and not inside SDL_pixels.h (mystery...). This function converts pixels from any supported PixelFormat to another one. Plus, a suggestion for everybody: When working with bits, ...


2

If I understand it right, you are asking how to extract bites of one bitmask and set it on the other, for example : const uint mask = 0x000000FF; //single color mask const uint aOff = 3 * 8; //offsets of colors from the end for ARGB const uint rOff = 2 * 8; const uint gOff = 1 * 8; const uint bOff = 0 * 8; uint pixel1 = 0xFFFF0000; //red in ARGB uint ...


0

SDL Wiki SDL_LockTexture function: pixels: this is filled in with a pointer to the locked pixels, appropriately offset by the locked area So based on this I imagined that I was given a block of pixels padded by the rect's X and Y coordinates so to get to the first pixel I needed to manually get to it, like I tried to do: Uint32* d = dest_buffer + ...


1

You would need to convert your texture into a rectangle, which is just a position and size. Your entity that is displaying the texture, should have the position, and the texture itself could potentially hold the size (this is completely dependent on how you are currently doing your spritebatch draw calls). It would end up looking something like: Dim ...


2

I didn't go with the way of implementing a custom Awesomium class for this. Instead I just updated data of a single texture by querying the surface from Awesomium. // Gets the surface of the web view. Awesomium::BitmapSurface* surface = static_cast<Awesomium::BitmapSurface*>(webView->surface()); if (surface != NULL) { unsigned char* pixels = ...



Top 50 recent answers are included