Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gdImageRotateInterpolated() converts the source image to truecolor #320

@cmb69

Description

@cmb69

If a palette image is passed to gdImageRotateInterpolated() it is converted to truecolor. That is at the very least unexpected, because gdImageRotateInterpolated() is supposed to return a modified result, but not to change the source image.

Test Program

#include <stdio.h>
#include <assert.h>
#include <gd.h>


int main()
{
    gdImagePtr src, dst;
    int black;

    src = gdImageCreate(10, 10);
    black = gdImageColorAllocate(src, 0, 0, 0);

    printf("src is truecolor: %d\n", gdImageTrueColor(src));

    dst = gdImageRotateInterpolated(src, 30.0, black);
    assert(dst != NULL);

    printf("src is truecolor: %d\n", gdImageTrueColor(src));
}

Expected Output

src is truecolor: 0
src is truecolor: 0

Actual Output

src is truecolor: 0
src is truecolor: 1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions