Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Better watermark and demo (centered watermarks)
Browse files Browse the repository at this point in the history
  • Loading branch information
irskep committed Nov 17, 2013
1 parent edccdfe commit 748346c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion coffee/core/core.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ class LC.LiterallyCanvas
@bufferCtx.fillStyle = @colors.background
@bufferCtx.fillRect(0, 0, @buffer.width, @buffer.height)
if @watermarkImage
@bufferCtx.drawImage(@watermarkImage, 0, 0)
@bufferCtx.drawImage(
@watermarkImage,
@canvas.width / 2 - @watermarkImage.width / 2,
@canvas.height / 2 - @watermarkImage.height / 2,
)
@draw @shapes, @bufferCtx
@ctx.clearRect(0, 0, @canvas.width, @canvas.height)
if @canvas.width > 0 and @canvas.height > 0
Expand Down
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
});

var watermarkImageURL = 'https://dl.dropboxusercontent.com/u/360865/Photos/26163_371929756319_650376319_4785977_7286010_n.jpg';
var watermarkImageURL = '/demo/watermark.png';
var watermarkImage = new Image();
watermarkImage.src = watermarkImageURL;

Expand Down
Binary file added demo/watermark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 748346c

Please sign in to comment.