Skip to content

Commit

Permalink
BFG - Initial commit. Not stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericguzman committed Dec 29, 2013
1 parent 995a1e8 commit 0bb608d
Show file tree
Hide file tree
Showing 794 changed files with 126,727 additions and 3 deletions.
Binary file added .DS_Store
Binary file not shown.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
bfg
===
{{name}}
==============

bigfatgradient.com
This is the Montage app template.

Note: Before working on your app you will need to add montage to it.

```
npm install .
```

Layout
------

The template contains the following files and directories:

* `index.html`
* `package.json` – Describes your app and its dependencies
* `README.markdown` – This readme. Replace the current content with a description of your app
* `ui/` – Directory containing all the UI .reel directories.
* `main.reel` – The main interface component
* `core/` – Directory containing all core code for your app.
* `node_modules/` – Directory containing all npm packages needed, including Montage. Any packages here must be included as `dependencies` in `package.json` for the Montage require to find them.
* `assets/` – Assets such as global styles and images for your app
* `test/` – Directory containing tests for your app.
* `all.js` – Module that point the test runner to all your jasmine specs.
* `run-tests.html` – Page to run jasmine tests manually in your browser

Create the following directories if you need them:

* `locale/` – Directory containing localized content.
* `scripts/` – Directory containing other JS libraries. If a library doesn’t support the CommonJS "exports" object it will need to be loaded through a `<script>` tag.
Binary file added assets/.DS_Store
Binary file not shown.
34 changes: 34 additions & 0 deletions assets/data/page-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var Montage = require("montage").Montage;
var Welcome = require("ui/pages/welcome.reel").Welcome;
var Blog = require("ui/pages/blog.reel").Blog;
var Social = require("ui/pages/social.reel").Social;
var About = require("ui/pages/about.reel").About;

/**
@module "data/page-data.js"
*/


/**
* @class PageData
*/
exports.PageData = {
pages: [
{
'id': 'welcome',
'module': Welcome,
'3': 'about',
'1': 'social',
'2': 'blog'
}, {
'id': 'about',
'module': About
}, {
'id': 'social',
'module': Social
}, {
'id': 'blog',
'module': Blog
}
]
};
123 changes: 123 additions & 0 deletions assets/images/montage-logo-gradients.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/my_image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/style/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 18px;
color: #222;
}

125 changes: 125 additions & 0 deletions blank.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html>
<head>
<title>undefined</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="Ninja">
<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script>
function generateRGBKs( img ) {
var w = img.width;
var h = img.height;
var rgbks = [];

var canvas = document.createElement("canvas");
canvas.width = w;
canvas.height = h;

var ctx = canvas.getContext("2d");
ctx.drawImage( img, 0, 0 );

var pixels = ctx.getImageData( 0, 0, w, h ).data;

// 4 is used to ask for 3 images: red, green, blue and
// black in that order.
for ( var rgbI = 0; rgbI < 4; rgbI++ ) {
var canvas = document.createElement("canvas");
canvas.width = w;
canvas.height = h;

var ctx = canvas.getContext('2d');
ctx.drawImage( img, 0, 0 );
var to = ctx.getImageData( 0, 0, w, h );
var toData = to.data;

for (
var i = 0, len = pixels.length;
i < len;
i += 4
) {
toData[i ] = (rgbI === 0) ? pixels[i ] : 0;
toData[i+1] = (rgbI === 1) ? pixels[i+1] : 0;
toData[i+2] = (rgbI === 2) ? pixels[i+2] : 0;
toData[i+3] = pixels[i+3] ;
}

ctx.putImageData( to, 0, 0 );

// image is _slightly_ faster then canvas for this, so convert
var imgComp = new Image();
imgComp.src = canvas.toDataURL();

rgbks.push( imgComp );
}

return rgbks;
}

// function generateRGBKs(img) {
// var w = img.width;
// var h = img.height;
// var rgbks = [];
//
//
// }

function generateTintImage( img, rgbks, red, green, blue ) {
var buff = document.createElement( "canvas" );
buff.width = img.width;
buff.height = img.height;

var ctx = buff.getContext("2d");

ctx.globalAlpha = 1;
ctx.globalCompositeOperation = 'copy';
ctx.drawImage( rgbks[3], 0, 0 );

ctx.globalCompositeOperation = 'lighter';
if ( red > 0 ) {
ctx.globalAlpha = red / 255.0;
ctx.drawImage( rgbks[0], 0, 0 );
}
if ( green > 0 ) {
ctx.globalAlpha = green / 255.0;
ctx.drawImage( rgbks[1], 0, 0 );
}
if ( blue > 0 ) {
ctx.globalAlpha = blue / 255.0;
ctx.drawImage( rgbks[2], 0, 0 );
}

return buff;
}

window.onload = function() {
var img = new Image();
img.onload = function() {
var rgbks = generateRGBKs( img );
var tintImg = generateTintImage( img, rgbks, 40, 140, 140 );

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");

var w = canvas.width;
var h = canvas.height;

// ctx.fillStyle = "black";
// ctx.fillRect( 0, 0, w, h );

ctx.drawImage( tintImg, 0, 0 );
}
img.src = "assets/images/my_image.jpg";
};

</script>
</head>
<body>
<canvas id="canvas" width="612" height="816">
</body>
</html>
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Big Fat Gradient</title>

<link rel="stylesheet" href="assets/style/style.css" />

<script src="node_modules/montage/montage.js" async></script>
<script type="text/montage-serialization">
{
"owner": {
"prototype": "montage/ui/loader.reel",
"properties": {
"mainModule": "ui/main.reel",
"mainName": "Main"
}
}
}
</script>
</head>
<body>
<span class="loading"></span>
</body>
</html>
3 changes: 3 additions & 0 deletions node_modules/digit/.jshintignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions node_modules/digit/.jshintrc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions node_modules/digit/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions node_modules/digit/CHANGES.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0bb608d

Please sign in to comment.