-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.c
33 lines (25 loc) · 891 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <assert.h>
#include <stdlib.h>
#include "bitmap.h"
int main(void)
{
//Read bitmap pixels, convert to HSV:
bitmap_pixel_hsv_t* pixels;
uint32_t widthPx, heightPx;
bitmap_error_t error = bitmapReadPixels("test.bmp", (bitmap_pixel_t**)&pixels, &widthPx, &heightPx, BITMAP_COLOR_SPACE_RGB);
assert(error == BITMAP_ERROR_SUCCESS);
//Write bitmap pixels, assume HSV in source:
bitmap_parameters_t params;
params.bottomUp = BITMAP_BOOL_TRUE;
params.widthPx = widthPx;
params.heightPx = heightPx;
params.colorDepth = BITMAP_COLOR_DEPTH_24;
params.compression = BITMAP_COMPRESSION_NONE;
params.dibHeaderFormat = BITMAP_DIB_HEADER_INFO;
params.colorSpace = BITMAP_COLOR_SPACE_RGB;
error = bitmapWritePixels("test.mod.bmp", BITMAP_BOOL_TRUE, ¶ms, (bitmap_pixel_t*)pixels);
assert(error == BITMAP_ERROR_SUCCESS);
//Free the pixel array:
free(pixels);
return 0;
}