{"id":28547126,"url":"https://github.com/skywind3000/basicbitmap","last_synced_at":"2025-08-11T22:35:51.366Z","repository":{"id":54458481,"uuid":"48671966","full_name":"skywind3000/BasicBitmap","owner":"skywind3000","description":"Simple and high-performance and platform independent Bitmap class (34% faster than GDI/GDI+, 40% faster than DDraw)","archived":false,"fork":false,"pushed_at":"2021-02-16T16:59:03.000Z","size":161,"stargazers_count":137,"open_issues_count":4,"forks_count":41,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-07-07T07:42:28.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skywind3000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-28T03:32:47.000Z","updated_at":"2025-06-24T09:46:48.000Z","dependencies_parsed_at":"2022-08-13T16:20:12.170Z","dependency_job_id":null,"html_url":"https://github.com/skywind3000/BasicBitmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skywind3000/BasicBitmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skywind3000%2FBasicBitmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skywind3000%2FBasicBitmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skywind3000%2FBasicBitmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skywind3000%2FBasicBitmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skywind3000","download_url":"https://codeload.github.com/skywind3000/BasicBitmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skywind3000%2FBasicBitmap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269969257,"owners_count":24505427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T00:09:32.766Z","updated_at":"2025-08-11T22:35:51.359Z","avatar_url":"https://github.com/skywind3000.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BasicBitmap\n\nAs the purpose of providing a simple compact, high-performance and platform independent Bitmap library, BasicBitmap is created based on a subset of my vector graphic library: https://github.com/skywind3000/pixellib .\n\n## Features\n\n- Highly optimized C++ code which could be compiled and executed in any platform\n- Multiple pixel formats from 8 to 32 bits: A8R8G8B8, R8G8B8, A4R4G4B4, R5G6B5, A8, etc.\n- Blit in opaque or transparent mode (with a maskcolor/colorkey)\n- Converting between different pixel formats\n- Blending with different compositors\n- Scaling with different filters (nearest, linear, bilinear)\n- High quality resampling to different size (Bicubic/Bilinear)\n- Loading bmp/tga from memory or file and saving bmp to file\n- Loading png/jpg with gdiplus (only in windows xp or above)\n- Saving bmp/ppm files\n- Self-contained and not rely on other libraries\n- Compact and portable, just copy BasicBitmap.h/.cpp into your project\n- Core routines can be replaced by external (eg. SSE2 implementations)\n- Blitting is 40% faster than DirectDraw FastBlt (with AVX/SSE2 optimizing enabled).\n- Blending is 34% faster than GDI's AlphaBlend (with SSE2 enabled).\n\n## Interfaces\n\nThe `BasicBitmap` class provides these public methods below:\n\n| Method | Description |\n|-|-|\n| Fill | fill color in rectangle |\n| Clear | clear the whole bitmap |\n| Blit | blit from source bitmap with same bpp |\n| Convert | convert from different pixel-format |\n| SetPixel | draw pixel in raw color |\n| GetPixel | read pixel in raw color |\n| SetColor | draw pixel in A8R8G8B8 |\n| GetColor | read pixel in A8R8G8B8 |\n| Scale | scale bitmap using different filter and blend op |\n| DrawLine | draw a line |\n| QuickText | draw text with internal mini-8x8 ascii font |\n| SampleBilinear | sample pixel with bilinear |\n| SampleBicubic | sample pixel with bicubic |\n| Resample | resample bitmap |\n| LoadBmpFromMemory | load bmp file from memory |\n| LoadTgaFromMemory | load tga file from memory |\n| LoadBmp | load bmp file |\n| LoadTga | load tga file |\n| SaveBmp | save bmp file |\n| SavePPM | save ppm file |\n| DownSampleBy2 | down sample 2x2 pixels into one pixel |\n| SetDIBitsToDevice | (windows) draw bitmap to hdc |\n| GetDIBits | (windows) get DIB bits to bitmap |\n| GdiPlusInit | (windows) initialize gdiplus |\n| GdiPlusLoadImageFromMemory | (windows) load jpg/png from memory |\n| GdiPlusLoadImage | (windows) use gdiplus to load jpg/png |\n| CreateBitmapInDIB | (windows) create bitmap with DIB section |\n\n\n\n## Performance\n\nBlit Performance\n----------------\n\nFull window (800x600) blitting (both opacity and transparent), compare to GDI/SDL/DirectDraw:\n\n|   32 Bits Blit       |  Opacity  | Transparent |\n|----------------------|-----------|-------------|\n| BasicBitmap C++      | fps=2325  |   fps=1368  |\n| BasicBitmap AVX/SSE2 | fps=2904  |   fps=2531  |\n| GDI                  | fps=2333  |   fps=1167  |\n| SDL                  | fps=2671  |   fps=1015  |\n| DirectDraw           | fps=2695  |   fps=2090  |\n\nNote: use BltFast with DirectDrawSurface7 in System Memory to perform Opacity \u0026 Transparent blit. BitBlt and TransparentBlt(msimg32.dll) are used in the GDI testing case. \n\n|   16 Bits Blit       |  Opacity  | Transparent |\n|----------------------|-----------|-------------|\n| BasicBitmap C++      | fps=4494  |  fps=1253   |\n| BasicBitmap AVX/SSE2 | fps=9852  |  fps=2909   |\n| DirectDraw BltFast   | fps=5889  |  fps=861    |\n\nBlitting performance in SDL \u0026 GDI are slower than DirectDraw, just compare to ddraw as well.\n\n|    8 Bits Blit       |  Opacity  | Transparent |\n|----------------------|-----------|-------------|\n| BasicBitmap C++      | fps=11142 |  fps=1503   |\n| BasicBitmap AVX/SSE2 | fps=18181 |  fps=5449   |\n| DirectDraw BltFast   | fps=14705 |  fps=4832   |\n\nDirectDrawSurface in *Video Memory* takes the benefit of hardware acceleration which is definitely faster than BasicBitmap. If you really need hardware acceleration, use OpenGL/DX as well. \n\n*BasicBitmap* is a software implementation which aims to achieve the best performance in all other software implementations: like GDI/GDI+, SDL/DirectDraw in System Memory, for examples.\n\nSo just compare to DirectDrawSurface in *System Memory*. Use it in the condition that you only need a lightweight software solution: GUI/Cross Platform/hardware unavailable/image processing/video compositing, etc.\n\n\n\nBlending Performance\n----------------------\n\n|  SRC OVER         |    FPS    |\n|-------------------|-----------|\n| BasicBitmap C++   |    594    |\n| BasicBitmap SSE2  |   1731    |\n| GDI (msimg32.dll) |   1137    |\n\nnote: 800x600 full window src-over blending vs GDI's AlphaBlend function (in msimg32.dll).\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskywind3000%2Fbasicbitmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskywind3000%2Fbasicbitmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskywind3000%2Fbasicbitmap/lists"}