Skip to content

Commit

Permalink
fix: Fix alpha premultiplied black edge issue
Browse files Browse the repository at this point in the history
changed `blit` with `composite`
  • Loading branch information
soimy committed Dec 4, 2019
1 parent b7cde89 commit a0db046
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
18 changes: 0 additions & 18 deletions patches/jimp+0.6.4.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/atlasify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class Atlasify {
const debugFrame = new Jimp(sheet.frame.width, sheet.frame.height, this._debugColor);
image.blit(debugFrame, sheet.frame.x, sheet.frame.y);
}
image.blit(buffer, sheet.x, sheet.y);
image.composite(buffer, sheet.x, sheet.y);

// share rects iteration to add serialized sheets
serializedSheet.push(rect.serialize());
Expand Down
10 changes: 5 additions & 5 deletions src/geom/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,29 +242,29 @@ export class Sheet extends Rectangle {
this.height += border * 2;
const extrudedImage = new Jimp(this.width, this.height);
// centered original image
extrudedImage.blit(this.data, border, border);
extrudedImage.composite(this.data, border, border);
this.data = extrudedImage;

// top extruded border
const topExtrude = this.data.clone()
.crop(border, border, this.frame.width, 1)
.resize(this.frame.width, border);
this.data.blit(topExtrude, border, 0);
this.data.composite(topExtrude, border, 0);
// bottom extruded border
const bottomExtrude = this.data.clone()
.crop(border, border + this.frame.height - 1, this.frame.width, 1)
.resize(this.frame.width, border);
this.data.blit(bottomExtrude, border, border + this.frame.height);
this.data.composite(bottomExtrude, border, border + this.frame.height);
// left extruded border
const leftExtrude = this.data.clone()
.crop(border, border, 1, this.frame.height)
.resize(border, this.frame.height);
this.data.blit(leftExtrude, 0, border);
this.data.composite(leftExtrude, 0, border);
// right extruded border
const rightExtrude = this.data.clone()
.crop(border + this.frame.width - 1, border, 1, this.frame.height)
.resize(border, this.frame.height);
this.data.blit(rightExtrude, border + this.frame.width, border);
this.data.composite(rightExtrude, border + this.frame.width, border);
this._imageDirty ++;
}

Expand Down

0 comments on commit a0db046

Please sign in to comment.