How can i stretch bitmaps to fill all of screen
Posted: Sun Dec 06, 2015 2:09 pm
Hello, everybody!
I wrote a bit-array drawer for my OS
I'm converting bitmaps to bit-arrays in my C program.
Then i'm drawing them with my bit-array drawer. I will write a real BMP loader when i finish ext2 implementation on my os, but currently it is the easiest solution for me.
But i have a problem
I'm drawing bitmap, but resolution can change computer by computer, right?
So i must stretch the bitmap to screen... (decrease or intercase the bitmap size to fill the all of screen with bitmap)
But i don't know how can i do this...
This is a simple array as an example how i save bitmaps:
//A 5 * 3 bitmap:
uint32_t bitmap1[] = {
0, 0xFFFFFF, 0, 0, 0xFEFEFE, // =*==*
0xFFFFFF, 0, 0, 0xFF0F00, 0, // *==*=
0, 0, 0xF0A0F0, 0, 0xFFFFFF // ==*=*
}
Yeah, i store my bitmaps like this...
Then for example i want:
I have an 640*480 bitmap, if the screen resolution 320*200 i want to resize (decrease the size) the bitmap to 320*200, or if the screen resolution is 800*600 i want to resize (intercase the size) the bitmap to 800*600
How can i do that?
Note: Bitmap is 24 bit
Thanks for helping
I wrote a bit-array drawer for my OS
I'm converting bitmaps to bit-arrays in my C program.
Then i'm drawing them with my bit-array drawer. I will write a real BMP loader when i finish ext2 implementation on my os, but currently it is the easiest solution for me.
But i have a problem
I'm drawing bitmap, but resolution can change computer by computer, right?
So i must stretch the bitmap to screen... (decrease or intercase the bitmap size to fill the all of screen with bitmap)
But i don't know how can i do this...
This is a simple array as an example how i save bitmaps:
//A 5 * 3 bitmap:
uint32_t bitmap1[] = {
0, 0xFFFFFF, 0, 0, 0xFEFEFE, // =*==*
0xFFFFFF, 0, 0, 0xFF0F00, 0, // *==*=
0, 0, 0xF0A0F0, 0, 0xFFFFFF // ==*=*
}
Yeah, i store my bitmaps like this...
Then for example i want:
I have an 640*480 bitmap, if the screen resolution 320*200 i want to resize (decrease the size) the bitmap to 320*200, or if the screen resolution is 800*600 i want to resize (intercase the size) the bitmap to 800*600
How can i do that?
Note: Bitmap is 24 bit
Thanks for helping