This commit is contained in:
2025-05-19 14:17:49 -04:00
parent f229424df4
commit 7c4f1574b2
10 changed files with 280 additions and 8 deletions

View File

@ -264,10 +264,10 @@ void amscimglib4_writeimage_bmp(const char *fname, amscimglib4_image *img)
{
for(J=0;J<img->sizex;J++)
{
//amscimglib4_get_pixel_RGBA(img,J,img->sizey-I-1,&R,&G,&B,&A); //go from bottom to top
R = img->data[4*(J + img->sizex*(img->sizey-I-1)) + 0];
G = img->data[4*(J + img->sizex*(img->sizey-I-1)) + 1];
B = img->data[4*(J + img->sizex*(img->sizey-I-1)) + 2];
amscimglib4_get_pixel_RGBA(img,J,img->sizey-I-1,&R,&G,&B,&A); //go from bottom to top
//R = img->data[4*(J + img->sizex*(img->sizey-I-1)) + 0];
//G = img->data[4*(J + img->sizex*(img->sizey-I-1)) + 1];
//B = img->data[4*(J + img->sizex*(img->sizey-I-1)) + 2];
buffer[J*bpp/8+0] = B;
buffer[J*bpp/8+1] = G;

View File

@ -212,6 +212,13 @@ AMSCIMGLIB4_API int amscimglib4_set_pixel_RGBA(amscimglib4_image *img, int x, in
return ret;
}
if(img->data==NULL)
{
ret = amscimglib4_failure;
return ret;
}
if(x<0 || y<0 || x>=img->sizex || y>=img->sizey)
{
ret = amscimglib4_failure;
@ -243,6 +250,17 @@ AMSCIMGLIB4_API int amscimglib4_get_pixel_RGBA(amscimglib4_image *img, int x, in
return ret;
}
if(img->data==NULL)
{
ret = amscimglib4_failure;
if(R!=NULL) *R = 0;
if(G!=NULL) *G = 0;
if(B!=NULL) *B = 0;
if(A!=NULL) *A = 0;
return ret;
}
if(x<0 || y<0 || x>=img->sizex || y>=img->sizey)
{
ret = amscimglib4_failure;