Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_gdContributionsCalc() always uses DEFAULT_BOX_RADIUS #331

Closed
cmb69 opened this issue Oct 10, 2016 · 3 comments
Closed

_gdContributionsCalc() always uses DEFAULT_BOX_RADIUS #331

cmb69 opened this issue Oct 10, 2016 · 3 comments
Milestone

Comments

@cmb69
Copy link
Contributor

cmb69 commented Oct 10, 2016

Even though each filter is supposed to have its own radius, _gdContributionsCalc() always uses DEFAULT_BOX_RADIUS. That appears to be a bug.

@cmb69
Copy link
Contributor Author

cmb69 commented Oct 10, 2016

According to filter.c from GGemsIII this is certainly a bug.

Test Program

#include <gd.h>


int main()
{
    gdImagePtr src, dst;
    FILE *fp;

    src = gdImageCreateTrueColor(100, 100);
    gdImageFilledRectangle(src, 0,0, 99,99, gdTrueColorAlpha(255, 255, 255, gdAlphaOpaque));
    gdImageEllipse(src, 49,49, 40, 40, gdTrueColorAlpha(0, 0, 0, gdAlphaOpaque));

    gdImageSetInterpolationMethod(src, GD_CATMULLROM);
    dst = gdImageScale(src, 200, 200);

    fp = fopen("scale.png", "wb");
    gdImagePng(dst, fp);
    fclose(fp);

    gdImageDestroy(src);
    gdImageDestroy(dst);

    return 0;
}

Expected Result

scale-2

Actual Result

scale-1

@cmb69
Copy link
Contributor Author

cmb69 commented Oct 10, 2016

Better reproducer:

Test Program

#include <gd.h>


int main()
{
    gdImagePtr src, dst;
    FILE *fp;

    src = gdImageCreateTrueColor(11, 11);
    gdImageFilledRectangle(src, 0,0, 10,10, gdTrueColorAlpha(255, 255, 255, gdAlphaOpaque));
    gdImageEllipse(src, 5,5, 8, 8, gdTrueColorAlpha(0, 0, 0, gdAlphaOpaque));

    gdImageSetInterpolationMethod(src, GD_CATMULLROM);
    dst = gdImageScale(src, 132, 132);

    fp = fopen("scale-2.png", "wb");
    gdImagePng(dst, fp);
    fclose(fp);

    gdImageDestroy(src);
    gdImageDestroy(dst);

    return 0;
}

Expected Result

scale-2

Actual Result

scale-1

@pierrejoye
Copy link
Contributor

Master fixes this and also does a little cleanup of the gd_interpolation.

@pierrejoye pierrejoye added this to the GD 2.3.3 milestone Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants