sdl surface where bpp = 1

656 Views Asked by At

6/4/14

I need to (if possible) create a surface in SDL 1.2 where the bpp = 1. bpp is Bits Per Pixel.

I'm working in 100% black and white, the 'surface' size is so ridiculously large my physical memory is bottle-necking me. I have 4GB of ram, and the program needs to run on budget machines, meaning 2-4 gigs. I've been using a color depth of 8; I imagine I'm wasting about 3/4 of my memory realistically? I'm saving the surface as a .bmp file, which is supposed to support a black/white format where bpp = 1.

Is there any way to lower the bpp in SDL or should I look for an alternative?


6/5/14

I hit a bottle-neck on my machine at about 39000x39000 pixels at a color depth of 8 bits. Because SDL stores surfaces in physical memory, I'm running out of RAM. Processing power is not an issue as I'm rendering a still image. I'm hoping to double that resolution, but I'll take what I can get. Yes I can potentially split the image into multiple files, but because it will be high-res laser printed at a later date, it will have to be open as a single file then anyways. The goal is to package the program as a single unit, not requiring additional steps to stitch and convert the images later in another program.

SDL and c++ in general don't seem to have support for single bit variables (bool not included), so assigning a color value to a 1 bpp pixel using SDL is beyond me.

0

There are 0 best solutions below