Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdint.h>
- #include <stdio.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include "dbg.h"
- #include "Bitmap.h"
- int main(int argc, char* argv[])
- {
- Bitmap img;
- img.loadBMP("24bit.bmp");
- uint8_t imgWidth = img.width;
- uint8_t imgHeight = img.height;
- uint8_t imgBPP = img.bpp / 8;
- uint16_t Scanline = imgWidth * imgBPP; // 128 * 3bpp = one horiz line
- uint8_t i, j, k;
- // ASCII 48 = '0'
- uint8_t X = 64;
- uint8_t Y = 0;
- uint8_t Width = 7;
- uint8_t Height = 15;
- char tmpChar[Width][Height][imgBPP];
- // Load the above glyph into memory
- for(j = 0; j < Height; ++j) {
- for(i = 0; i < Width; ++i) {
- for(k = 0; k < imgBPP; ++k) {
- tmpChar[i][j][k] = img.data[ ((Scanline*Y)+(Scanline+j)) + // Y Offset + Y Count
- ((imgBPP*X)+(imgBPP*i)) + // X Off + X Count
- k]; // Current ColorBit
- }
- }
- }
- // Print out the glyph in memory in a nice grid
- for(j = 0; j < Height; ++j) {
- printf("\n");
- for(i = 0; i < Width; ++i) {
- for(k = 0; k < imgBPP; ++k) {
- printf("%+d ", tmpChar[i][j][k]);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement