mirror of
https://github.com/digarok/b2d.git
synced 2024-10-31 21:06:45 +00:00
Multiplatform CICD
This commit is contained in:
parent
8ee13530c5
commit
9305909c2a
114
.github/workflows/release.yml
vendored
Normal file
114
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
name: Release Builds
|
||||||
|
on: push
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-store-artifact:
|
||||||
|
name: Build
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
- name: Make GNU
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
working-directory: ./src
|
||||||
|
run: make
|
||||||
|
shell: bash
|
||||||
|
- name: Make Windows
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
working-directory: ./src
|
||||||
|
run: nmake
|
||||||
|
- name: Test
|
||||||
|
run: cd tests ; ./test.sh
|
||||||
|
- name: Upload binary artifact
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ format('binary-{0}', matrix.os) }}
|
||||||
|
path: b2d
|
||||||
|
- name: Upload binary artifact exe
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ format('binary-{0}', matrix.os) }}
|
||||||
|
path: b2d.exe
|
||||||
|
|
||||||
|
create-release:
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
name: Create Release
|
||||||
|
needs: build-and-store-artifact
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1.0.0
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: Release ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
- name: Debug dump
|
||||||
|
env:
|
||||||
|
UPLOAD_URL: ${{ toJson( steps.create_release.outputs.upload_url )}}
|
||||||
|
run: |
|
||||||
|
echo "$UPLOAD_URL" > release_url.txt
|
||||||
|
echo "UPLOAD_URL= $UPLOAD_URL"
|
||||||
|
- name: Upload URL for later use
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: data
|
||||||
|
path: release_url.txt
|
||||||
|
|
||||||
|
package-and-upload:
|
||||||
|
name: Package and Upload
|
||||||
|
needs: create-release
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Download Release Data
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: data
|
||||||
|
- name: Get Tag Name
|
||||||
|
id: get_data
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
URL=`cat data/release_url.txt | tr -d '"'`
|
||||||
|
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
||||||
|
echo ::set-output name=RELEASE_URL::$URL
|
||||||
|
echo "URL = $URL"
|
||||||
|
echo name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
||||||
|
- name: Download Release Binary
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: ${{ format('binary-{0}', matrix.os) }}
|
||||||
|
|
||||||
|
- name: Package NIX
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
run: |
|
||||||
|
zip --junk-paths b2d.zip ${{ format('binary-{0}/b2d', matrix.os) }} README.md
|
||||||
|
- name: Package WIN
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
run: |
|
||||||
|
7z.exe a b2d.zip ${{ format('./binary-{0}/b2d.exe', matrix.os) }} README.md
|
||||||
|
- name: Upload Release Asset
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.get_data.outputs.RELEASE_URL }}
|
||||||
|
asset_path: ./b2d.zip
|
||||||
|
asset_name: ${{ format('b2d-{0}-{1}.zip', matrix.os, steps.get_data.outputs.SOURCE_TAG ) }}
|
||||||
|
asset_content_type: application/zip
|
18
README.md
18
README.md
@ -4,7 +4,25 @@ The b2d project provides modern builds of versions of bmp2dhr, a utility for con
|
|||||||
# Releases
|
# Releases
|
||||||
- see the releases page
|
- see the releases page
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
The `b2d` command will show a small amount of help upon execution without any arguments.
|
||||||
|
|
||||||
|
Here's an example of converting a BMP to a LoRes Apple II screen:
|
||||||
|
|
||||||
|
`b2d myimage.bmp L N`
|
||||||
|
|
||||||
|
The `L` is for LoRes output, and the `N` specifies to not include any header, just the raw image data.
|
||||||
|
|
||||||
# About
|
# About
|
||||||
b2d project is by Dagen Brock
|
b2d project is by Dagen Brock
|
||||||
|
|
||||||
Bmp2DHR version 1.0 and 1.1 were publically released by Bill Buckels in 2014 and 2015 respectively. All rights reserved. See archival directory for more information.
|
Bmp2DHR version 1.0 and 1.1 were publically released by Bill Buckels in 2014 and 2015 respectively. All rights reserved. See archival directory for more information.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
```
|
||||||
|
1.3 - Initial b2d project release
|
||||||
|
- Add no header option
|
||||||
|
- Bugfixes
|
||||||
|
- Cross-platform fixes and CICD work for new builds
|
||||||
|
```
|
||||||
|
44
src/b2d.c
44
src/b2d.c
@ -1581,20 +1581,20 @@ ushort WriteVbmpHeader(FILE *fp) {
|
|||||||
memset((char *)&mybmp.bfi.bfType[0], 0, sizeof(BMPHEADER));
|
memset((char *)&mybmp.bfi.bfType[0], 0, sizeof(BMPHEADER));
|
||||||
|
|
||||||
/* create the info header */
|
/* create the info header */
|
||||||
mybmp.bmi.biSize = (ulong)40;
|
mybmp.bmi.biSize = (uLong)40;
|
||||||
mybmp.bmi.biWidth = (ulong)140;
|
mybmp.bmi.biWidth = (uLong)140;
|
||||||
mybmp.bmi.biHeight = (ulong)192;
|
mybmp.bmi.biHeight = (uLong)192;
|
||||||
mybmp.bmi.biPlanes = 1;
|
mybmp.bmi.biPlanes = 1;
|
||||||
mybmp.bmi.biBitCount = 4;
|
mybmp.bmi.biBitCount = 4;
|
||||||
mybmp.bmi.biCompression = (ulong)BI_RGB;
|
mybmp.bmi.biCompression = (uLong)BI_RGB;
|
||||||
|
|
||||||
mybmp.bmi.biSizeImage = (ulong)outpacket;
|
mybmp.bmi.biSizeImage = (uLong)outpacket;
|
||||||
mybmp.bmi.biSizeImage *= mybmp.bmi.biHeight;
|
mybmp.bmi.biSizeImage *= mybmp.bmi.biHeight;
|
||||||
|
|
||||||
/* create the file header */
|
/* create the file header */
|
||||||
mybmp.bfi.bfType[0] = 'B';
|
mybmp.bfi.bfType[0] = 'B';
|
||||||
mybmp.bfi.bfType[1] = 'M';
|
mybmp.bfi.bfType[1] = 'M';
|
||||||
mybmp.bfi.bfOffBits = (ulong)sizeof(BMPHEADER) + sizeof(RGBQUAD) * 16;
|
mybmp.bfi.bfOffBits = (uLong)sizeof(BMPHEADER) + sizeof(RGBQUAD) * 16;
|
||||||
mybmp.bfi.bfSize = mybmp.bmi.biSizeImage + mybmp.bfi.bfOffBits;
|
mybmp.bfi.bfSize = mybmp.bmi.biSizeImage + mybmp.bfi.bfOffBits;
|
||||||
|
|
||||||
/* write the header for the output BMP */
|
/* write the header for the output BMP */
|
||||||
@ -2583,7 +2583,7 @@ int savesprite() {
|
|||||||
/* read and remap a mask line from an open mask file */
|
/* read and remap a mask line from an open mask file */
|
||||||
/* required by dithered and non-dithered routines when in use */
|
/* required by dithered and non-dithered routines when in use */
|
||||||
sshort ReadMaskLine(ushort y) {
|
sshort ReadMaskLine(ushort y) {
|
||||||
ulong pos;
|
uLong pos;
|
||||||
ushort x, packet;
|
ushort x, packet;
|
||||||
uchar ch;
|
uchar ch;
|
||||||
|
|
||||||
@ -2600,7 +2600,7 @@ sshort ReadMaskLine(ushort y) {
|
|||||||
} else
|
} else
|
||||||
packet = 140;
|
packet = 140;
|
||||||
|
|
||||||
pos = (ulong)(191 - y);
|
pos = (uLong)(191 - y);
|
||||||
pos *= packet;
|
pos *= packet;
|
||||||
pos += maskbmp.bfi.bfOffBits;
|
pos += maskbmp.bfi.bfOffBits;
|
||||||
|
|
||||||
@ -3661,24 +3661,24 @@ ushort WriteDIBHeader(FILE *fp, ushort pixels, ushort rasters) {
|
|||||||
memset((char *)&mybmp.bfi.bfType[0], 0, sizeof(BMPHEADER));
|
memset((char *)&mybmp.bfi.bfType[0], 0, sizeof(BMPHEADER));
|
||||||
|
|
||||||
/* create the info header */
|
/* create the info header */
|
||||||
mybmp.bmi.biSize = (ulong)sizeof(BITMAPINFOHEADER);
|
mybmp.bmi.biSize = (uLong)sizeof(BITMAPINFOHEADER);
|
||||||
mybmp.bmi.biWidth = (ulong)pixels;
|
mybmp.bmi.biWidth = (uLong)pixels;
|
||||||
mybmp.bmi.biHeight = (ulong)rasters;
|
mybmp.bmi.biHeight = (uLong)rasters;
|
||||||
mybmp.bmi.biPlanes = 1;
|
mybmp.bmi.biPlanes = 1;
|
||||||
mybmp.bmi.biBitCount = 24;
|
mybmp.bmi.biBitCount = 24;
|
||||||
mybmp.bmi.biCompression = (ulong)BI_RGB;
|
mybmp.bmi.biCompression = (uLong)BI_RGB;
|
||||||
|
|
||||||
/* BMP scanlines are padded to a multiple of 4 bytes (DWORD) */
|
/* BMP scanlines are padded to a multiple of 4 bytes (DWORD) */
|
||||||
outpacket = (ushort)mybmp.bmi.biWidth * 3;
|
outpacket = (ushort)mybmp.bmi.biWidth * 3;
|
||||||
while (outpacket % 4 != 0)
|
while (outpacket % 4 != 0)
|
||||||
outpacket++;
|
outpacket++;
|
||||||
mybmp.bmi.biSizeImage = (ulong)outpacket;
|
mybmp.bmi.biSizeImage = (uLong)outpacket;
|
||||||
mybmp.bmi.biSizeImage *= mybmp.bmi.biHeight;
|
mybmp.bmi.biSizeImage *= mybmp.bmi.biHeight;
|
||||||
|
|
||||||
/* create the file header */
|
/* create the file header */
|
||||||
mybmp.bfi.bfType[0] = 'B';
|
mybmp.bfi.bfType[0] = 'B';
|
||||||
mybmp.bfi.bfType[1] = 'M';
|
mybmp.bfi.bfType[1] = 'M';
|
||||||
mybmp.bfi.bfOffBits = (ulong)sizeof(BMPHEADER);
|
mybmp.bfi.bfOffBits = (uLong)sizeof(BMPHEADER);
|
||||||
mybmp.bfi.bfSize = mybmp.bmi.biSizeImage + mybmp.bfi.bfOffBits;
|
mybmp.bfi.bfSize = mybmp.bmi.biSizeImage + mybmp.bfi.bfOffBits;
|
||||||
|
|
||||||
/* write the header for the output BMP */
|
/* write the header for the output BMP */
|
||||||
@ -4107,7 +4107,7 @@ FILE *ResizeBMP(FILE *fp, sshort resize) {
|
|||||||
FILE *fp2;
|
FILE *fp2;
|
||||||
ushort x, y, packet, outpacket, chunks;
|
ushort x, y, packet, outpacket, chunks;
|
||||||
ushort i, j, r, g, b;
|
ushort i, j, r, g, b;
|
||||||
ulong offset = 0L;
|
uLong offset = 0L;
|
||||||
|
|
||||||
#ifdef TURBOC
|
#ifdef TURBOC
|
||||||
if (resize == 0)
|
if (resize == 0)
|
||||||
@ -4875,7 +4875,7 @@ sshort Convert() {
|
|||||||
ushort x, x1, x2, y, yoff, i, packet, outpacket, width, dwidth, red, green,
|
ushort x, x1, x2, y, yoff, i, packet, outpacket, width, dwidth, red, green,
|
||||||
blue;
|
blue;
|
||||||
uchar r, g, b, drawcolor;
|
uchar r, g, b, drawcolor;
|
||||||
ulong pos, prepos;
|
uLong pos, prepos;
|
||||||
|
|
||||||
/* if using a mask file, open it now */
|
/* if using a mask file, open it now */
|
||||||
/* leave it open throughout the conversion session */
|
/* leave it open throughout the conversion session */
|
||||||
@ -4897,7 +4897,7 @@ sshort Convert() {
|
|||||||
|
|
||||||
printf("sizeof(uchar): %lu\n", sizeof(uchar));
|
printf("sizeof(uchar): %lu\n", sizeof(uchar));
|
||||||
printf("sizeof(ushort): %lu\n", sizeof(ushort));
|
printf("sizeof(ushort): %lu\n", sizeof(ushort));
|
||||||
printf("sizeof(ulong): %lu\n", sizeof(ulong));
|
printf("sizeof(uLong): %lu\n", sizeof(uLong));
|
||||||
printf("sizeof(sshort): %lu\n", sizeof(sshort));
|
printf("sizeof(sshort): %lu\n", sizeof(sshort));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -5043,7 +5043,7 @@ sshort Convert() {
|
|||||||
for (y = 0; y < bmpheight; y++)
|
for (y = 0; y < bmpheight; y++)
|
||||||
fwrite((char *)&dibscanline1[0], 1, outpacket, fpreview);
|
fwrite((char *)&dibscanline1[0], 1, outpacket, fpreview);
|
||||||
/* set the seek distance to scanline 0 in the preview file */
|
/* set the seek distance to scanline 0 in the preview file */
|
||||||
prepos = (ulong)(bmpheight - 1);
|
prepos = (uLong)(bmpheight - 1);
|
||||||
prepos *= outpacket;
|
prepos *= outpacket;
|
||||||
prepos += mybmp.bfi.bfOffBits;
|
prepos += mybmp.bfi.bfOffBits;
|
||||||
}
|
}
|
||||||
@ -5055,7 +5055,7 @@ sshort Convert() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read BMP from top scanline to bottom scanline */
|
/* read BMP from top scanline to bottom scanline */
|
||||||
pos = (ulong)(bmpheight - 1);
|
pos = (uLong)(bmpheight - 1);
|
||||||
pos *= packet;
|
pos *= packet;
|
||||||
pos += bfi.bfOffBits;
|
pos += bfi.bfOffBits;
|
||||||
|
|
||||||
@ -5292,7 +5292,7 @@ sshort ConvertMono() {
|
|||||||
FILE *fp, *fpreview;
|
FILE *fp, *fpreview;
|
||||||
sshort status = INVALID;
|
sshort status = INVALID;
|
||||||
ushort x, y, i, packet, outpacket, red, green, blue, verbatim;
|
ushort x, y, i, packet, outpacket, red, green, blue, verbatim;
|
||||||
ulong pos, prepos;
|
uLong pos, prepos;
|
||||||
|
|
||||||
if ((fp = fopen(bmpfile, "rb")) == NULL) {
|
if ((fp = fopen(bmpfile, "rb")) == NULL) {
|
||||||
printf("Error Opening %s for reading!\n", bmpfile);
|
printf("Error Opening %s for reading!\n", bmpfile);
|
||||||
@ -5381,7 +5381,7 @@ sshort ConvertMono() {
|
|||||||
for (y = 0; y < bmpheight; y++)
|
for (y = 0; y < bmpheight; y++)
|
||||||
fwrite((char *)&dibscanline1[0], 1, outpacket, fpreview);
|
fwrite((char *)&dibscanline1[0], 1, outpacket, fpreview);
|
||||||
/* set the seek distance to scanline 0 in the preview file */
|
/* set the seek distance to scanline 0 in the preview file */
|
||||||
prepos = (ulong)(bmpheight - 1);
|
prepos = (uLong)(bmpheight - 1);
|
||||||
prepos *= outpacket;
|
prepos *= outpacket;
|
||||||
prepos += mybmp.bfi.bfOffBits;
|
prepos += mybmp.bfi.bfOffBits;
|
||||||
}
|
}
|
||||||
@ -5393,7 +5393,7 @@ sshort ConvertMono() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read BMP from top scanline to bottom scanline */
|
/* read BMP from top scanline to bottom scanline */
|
||||||
pos = (ulong)(bmpheight - 1);
|
pos = (uLong)(bmpheight - 1);
|
||||||
pos *= packet;
|
pos *= packet;
|
||||||
pos += bfi.bfOffBits;
|
pos += bfi.bfOffBits;
|
||||||
|
|
||||||
|
27
src/b2d.h
27
src/b2d.h
@ -36,6 +36,9 @@
|
|||||||
/* ***************************************************************** */
|
/* ***************************************************************** */
|
||||||
|
|
||||||
#include "tomthumb.h"
|
#include "tomthumb.h"
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <ctype.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ***************************************************************** */
|
/* ***************************************************************** */
|
||||||
/* ========================== defines ============================== */
|
/* ========================== defines ============================== */
|
||||||
@ -112,7 +115,7 @@
|
|||||||
|
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
||||||
typedef unsigned int ulong;
|
typedef unsigned int uLong;
|
||||||
typedef short sshort;
|
typedef short sshort;
|
||||||
|
|
||||||
/* Bitmap Header structures */
|
/* Bitmap Header structures */
|
||||||
@ -124,17 +127,17 @@ typedef struct tagBITMAPINFOHEADER
|
|||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ulong biSize;
|
uLong biSize;
|
||||||
ulong biWidth;
|
uLong biWidth;
|
||||||
ulong biHeight;
|
uLong biHeight;
|
||||||
ushort biPlanes;
|
ushort biPlanes;
|
||||||
ushort biBitCount;
|
ushort biBitCount;
|
||||||
ulong biCompression;
|
uLong biCompression;
|
||||||
ulong biSizeImage;
|
uLong biSizeImage;
|
||||||
ulong biXPelsPerMeter;
|
uLong biXPelsPerMeter;
|
||||||
ulong biYPelsPerMeter;
|
uLong biYPelsPerMeter;
|
||||||
ulong biClrUsed;
|
uLong biClrUsed;
|
||||||
ulong biClrImportant;
|
uLong biClrImportant;
|
||||||
} BITMAPINFOHEADER;
|
} BITMAPINFOHEADER;
|
||||||
|
|
||||||
#ifdef MINGW
|
#ifdef MINGW
|
||||||
@ -144,10 +147,10 @@ typedef struct tagBITMAPFILEHEADER
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
uchar bfType[2];
|
uchar bfType[2];
|
||||||
ulong bfSize;
|
uLong bfSize;
|
||||||
ushort bfReserved1;
|
ushort bfReserved1;
|
||||||
ushort bfReserved2;
|
ushort bfReserved2;
|
||||||
ulong bfOffBits;
|
uLong bfOffBits;
|
||||||
} BITMAPFILEHEADER;
|
} BITMAPFILEHEADER;
|
||||||
|
|
||||||
#ifdef MINGW
|
#ifdef MINGW
|
||||||
|
Loading…
Reference in New Issue
Block a user