1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// This was created in office hours on 4/12/2019.
// This is an ILLUSTRATION and has not been tested.  Expect syntax errors, etc.
//
// OK to use any code in this file, at your own risk.

void _make_6x6_24bit() {
    // Create a 6x6 image, initialized to all black.
    BMPImage* img = create_bmp(6, 6, 0,   0,   0);
    // BMPImage* img = create_bmp(6, 6, 255, 255, 255);  // all white
    // BMPImage* img = create_bmp(6, 6, 255, 0,   0);    // all red
    
    //             x  y  ┌r┐  ┌g┐  ┌b┐
    set_pixel(img, 0, 0, 255,   0,   0);  // (0, 0) ← red
    set_pixel(img, 1, 0, 255,   0,   0);  // (1, 0) ← red
    set_pixel(img, 2, 0,   0,   0, 255);  // (2, 0) ← blue
    // … and so on.
}

void _corrupt_img_height(BMPImage* img, int height_delta) {
    img -> header.height += height_delta;
}

/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

© Copyright 2019 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.