summaryrefslogtreecommitdiff
path: root/js/blit.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/blit.js')
-rw-r--r--js/blit.js98
1 files changed, 49 insertions, 49 deletions
diff --git a/js/blit.js b/js/blit.js
index 8683f22..05fdcb8 100644
--- a/js/blit.js
+++ b/js/blit.js
@@ -1,51 +1,51 @@
var blit = (function(){
- var blit = {}
- blit.and = blit.atop = function(A, B, x, y){
- x = x || 0 ; y = y || 0
- B.forEach(function(lex, u, v){
- var cell = A.getCell(u+x, v+y)
- if (cell && lex.opacity > 0) {
- cell.clone(lex)
- }
- })
- }
- blit.or = blit.under = function(A, B, x, y){
- x = x || 0 ; y = y || 0
- B.forEach(function(lex, u, v){
- var cell = A.getCell(u+x, v+y)
- if (cell && cell.opacity == 0) {
- cell.clone(lex)
- }
- })
- }
- // copy the region of A beginning at x,y into B
- blit.copy_from = function(A, B, x, y){
- x = x || 0 ; y = y || 0
- B.forEach(function(lex, u, v){
- var cell = A.getCell(u+x, v+y)
- if (cell) {
- lex.clone(cell)
- }
- })
- }
- blit.copy_to = function(A, B, x, y){
- x = x || 0 ; y = y || 0
- B.forEach(function(lex, u, v){
- var cell = A.getCell(u+x, v+y)
- if (cell) {
- cell.clone(lex)
- }
- })
- }
- blit.invert = function(A, B, x, y){
- x = x || 0 ; y = y || 0
- B.forEach(function(lex, u, v){
- var cell = A.getCell(u+x, v+y)
- if (cell && lex.opacity > 0) {
- cell.fg = get_inverse(cell.fg)
- cell.bg = get_inverse(cell.bg)
- }
- })
- }
- return blit
+ var blit = {}
+ blit.and = blit.atop = function(A, B, x, y){
+ x = x || 0 ; y = y || 0
+ B.forEach(function(lex, u, v){
+ var cell = A.getCell(u+x, v+y)
+ if (cell && lex.opacity > 0) {
+ cell.clone(lex)
+ }
+ })
+ }
+ blit.or = blit.under = function(A, B, x, y){
+ x = x || 0 ; y = y || 0
+ B.forEach(function(lex, u, v){
+ var cell = A.getCell(u+x, v+y)
+ if (cell && cell.opacity == 0) {
+ cell.clone(lex)
+ }
+ })
+ }
+ // copy the region of A beginning at x,y into B
+ blit.copy_from = function(A, B, x, y){
+ x = x || 0 ; y = y || 0
+ B.forEach(function(lex, u, v){
+ var cell = A.getCell(u+x, v+y)
+ if (cell) {
+ lex.clone(cell)
+ }
+ })
+ }
+ blit.copy_to = function(A, B, x, y){
+ x = x || 0 ; y = y || 0
+ B.forEach(function(lex, u, v){
+ var cell = A.getCell(u+x, v+y)
+ if (cell) {
+ cell.clone(lex)
+ }
+ })
+ }
+ blit.invert = function(A, B, x, y){
+ x = x || 0 ; y = y || 0
+ B.forEach(function(lex, u, v){
+ var cell = A.getCell(u+x, v+y)
+ if (cell && lex.opacity > 0) {
+ cell.fg = get_inverse(cell.fg)
+ cell.bg = get_inverse(cell.bg)
+ }
+ })
+ }
+ return blit
})()