The Wayback Machine - https://web.archive.org/web/20230320120649/https://github.com/marc-q/libbmp
Skip to content

marc-q/libbmp

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

This macro can be used to set pixels without a function call.
66bec6d

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
April 20, 2017 18:24
June 21, 2017 17:05
October 11, 2016 15:59
June 21, 2017 17:05

libbmp

A simple Bitmap (BMP) library written in C without dependencies.
For a native C++ version look inside the CPP folder.

Example: Checkerboard-pattern

#include <stdio.h>
#include "libbmp.h"

int
main ()
{
	bmp_img img;
	bmp_img_init_df (&img, 512, 512);
	
	// Draw a checkerboard pattern:
	for (size_t y = 0, x; y < 512; y++)
	{
		for (x = 0; x < 512; x++)
		{
			if ((y % 128 < 64 && x % 128 < 64) ||
			    (y % 128 >= 64 && x % 128 >= 64))
			{
				bmp_pixel_init (&img.img_pixels[y][x], 250, 250, 250);
			}
			else
			{
				bmp_pixel_init (&img.img_pixels[y][x], 0, 0, 0);
			}
		}
	}
	
	bmp_img_write (&img, "test.bmp");
	bmp_img_free (&img);
	return 0;
}

Important Notes

  • Since the C and C++ version have many things in common, both of them are maintained in a single repository.
    To report language specific things, make use of the C or C++ label.

About

A simple Bitmap (BMP) library.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published