Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

use 128 as example alpha value for half-transparent. #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ var image = PNGImage.createImage(100, 300);
console.log(image.getWidth());
console.log(image.getHeight());

// Set a pixel at (20, 30) with red, having an alpha value of 100 (half-transparent)
image.setAt(20, 30, { red:255, green:0, blue:0, alpha:100 });
// Set a pixel at (20, 30) with red, having an alpha value of 128 (half-transparent)
image.setAt(20, 30, { red:255, green:0, blue:0, alpha:128 });

// Get index of coordinate in the image buffer
var index = image.getIndex(20, 30);
Expand All @@ -90,8 +90,8 @@ PNGImage.readImage('path/to/file', function (err, image) {
console.log(image.getWidth());
console.log(image.getHeight());

// Set a pixel at (20, 30) with red, having an alpha value of 100 (half-transparent)
image.setAt(20, 30, { red:255, green:0, blue:0, alpha:100 });
// Set a pixel at (20, 30) with red, having an alpha value of 128 (half-transparent)
image.setAt(20, 30, { red:255, green:0, blue:0, alpha:128 });
});
```

Expand Down