-
Notifications
You must be signed in to change notification settings - Fork 8
Will Shiv and Anna #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
de6d887
9f99589
3a85f2f
7577ec7
b531d8b
cb06fa4
8f010ad
d862271
59a292e
3d4758b
642b1cb
a063046
65f91d3
363ceef
a0235b1
3569dc5
94c7a74
83f8663
34df57d
5cede5f
cd2e87f
4119c76
f600bec
1d5c776
64642e3
5dcc235
a3ea6cc
209510d
ec40b88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"rules": { | ||
"no-console": "off", | ||
"indent": [ "error", 2 ], | ||
"quotes": [ "error", "single" ], | ||
"semi": ["error", "always"], | ||
"linebreak-style": [ "error", "unix" ] | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true, | ||
"jasmine": true | ||
}, | ||
"ecmaFeatures": { | ||
"modules": true, | ||
"experimentalObjectRestSpread": true, | ||
"impliedStrict": true | ||
}, | ||
"extends": "eslint:recommended" | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Created by https://www.gitignore.io/api/node,vim,osx,macos,linux | ||
|
||
*node_modules | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
|
||
|
||
### Vim ### | ||
# swap | ||
[._]*.s[a-v][a-z] | ||
[._]*.sw[a-p] | ||
[._]s[a-v][a-z] | ||
[._]sw[a-p] | ||
# session | ||
Session.vim | ||
# temporary | ||
.netrwhist | ||
*~ | ||
# auto-generated tag files | ||
tags | ||
|
||
|
||
### OSX ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
|
||
### macOS ### | ||
# Icon must end with two \r | ||
# Thumbnails | ||
# Files that might appear in the root of a volume | ||
# Directories potentially created on remote AFP share | ||
|
||
|
||
### Linux ### | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
# End of https://www.gitignore.io/api/node,vim,osx,macos,linux | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"rules": { | ||
"no-console": "off", | ||
"indent": [ "error", 2 ], | ||
"quotes": [ "error", "single" ], | ||
"semi": ["error", "always"], | ||
"linebreak-style": [ "error", "unix" ] | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true, | ||
"jasmine": true | ||
}, | ||
"ecmaFeatures": { | ||
"modules": true, | ||
"experimentalObjectRestSpread": true, | ||
"impliedStrict": true | ||
}, | ||
"extends": "eslint:recommended" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul duplicate |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Created by https://www.gitignore.io/api/node,vim,osx,macos,linux | ||
|
||
*node_modules | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
|
||
|
||
### Vim ### | ||
# swap | ||
[._]*.s[a-v][a-z] | ||
[._]*.sw[a-p] | ||
[._]s[a-v][a-z] | ||
[._]sw[a-p] | ||
# session | ||
Session.vim | ||
# temporary | ||
.netrwhist | ||
*~ | ||
# auto-generated tag files | ||
tags | ||
|
||
|
||
### OSX ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
|
||
### macOS ### | ||
# Icon must end with two \r | ||
# Thumbnails | ||
# Files that might appear in the root of a volume | ||
# Directories potentially created on remote AFP share | ||
|
||
|
||
### Linux ### | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
# End of https://www.gitignore.io/api/node,vim,osx,macos,linux | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul same deal here - duplicate |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
 Lab 04: Bitmap Transformer | ||
=== | ||
|
||
## To Submit this Assignment | ||
* have team leader fork this repository | ||
* have team leader add team members as collaborators to the team fork | ||
* team members should clone team fork | ||
* write all of your code in a directory name `bitmap-` + `<team name>` **e.g.** `bitmap-weasels` | ||
* submit a pull request to this repository when done | ||
* each person will submit a link to their own PR in canvas | ||
* each person write a question and observation on canvas | ||
|
||
#### Rubric: | ||
* **tests:** 3pts | ||
* **gulpfile/package.json:** 2pts | ||
* **read bitmap meta data:** 5pts | ||
* **successfully apply transforms:** 5pts | ||
* **project design and organization:** 5pts | ||
|
||
## Description | ||
|
||
For this assignment you will be building a bitmap (`.bmp`) reader and transformer. It will read a bitmap in from disk, run one or more color transforms on the bitmap and then write it out to a new file. This project will require the use of node buffers in order to manipulate binary data. Your project should include tests, as well as a `gulpfile.js`, `package.json`, `.eslintrc`, `README.md`, and a `.gitignore`. Make sure to run all your code through eslint. The process will look something like this: | ||
|
||
1. open the original bitmap file using fs and read it into a buffer | ||
2. convert the buffer header data into a Javascript Object (using constructors) | ||
3. run a transform on the buffer directly | ||
4. write the buffer to a new file | ||
|
||
The wikipedia article found here [Bitmap Specification](https://en.wikipedia.org/wiki/BMP_file_format) describes the byte specification of a "windows bitmap file." We'll be working with the simplest version, meaning no compression. | ||
|
||
* your project should have three ***(or more)*** transforms | ||
* invert the colors (***hint:*** subtract every color value from the max color value which is 255), | ||
* grayscale the colors (***hint:*** multiply each color value by a constant, just make sure your values don't go over 255) | ||
* (red|green|blue)scale the colors (***hint:*** same as above but only multiply one of the colors) | ||
|
||
## Bonus: | ||
|
||
* ability to handle various sized bitmap | ||
* ability to handle LE and BE computers with a single if statement | ||
* utilizes a command line interface (CLI) | ||
* CLI can select the transforms | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul documentation outlined in your |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
const maps = require(`${__dirname}/model/read-write.js`); | ||
const transforms = require(`${__dirname}/lib/transforms.js`); | ||
|
||
maps.readWrite(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul excellent job keeping your |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
|
||
const fileReader = module.exports = function(file, callback) { | ||
fs.readFile(file, function(err, data) { | ||
if (err) return callback(err); | ||
return callback(null, data); | ||
}) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul awesome job creating a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const image = require(`${__dirname}/../index.js`); | ||
|
||
module.exports = exports = {}; | ||
|
||
exports.turnBlack = function(bitmap) { | ||
const blackBuf = new Buffer(bitmap); | ||
return blackBuf.fill('00', 54, 1078); | ||
// console.log(blackBuf); | ||
}; | ||
|
||
exports.invert = function(bitmap) { | ||
const invertBuf = new Buffer(bitmap); | ||
for (var i = 54; i < 1078; i++) { | ||
invertBuf.fill(255-bitmap[i], i, i+1); | ||
}; | ||
// console.log(invertBuf.toString('hex').slice(54,1078)); | ||
return invertBuf; | ||
}; | ||
|
||
exports.redScale = function(bitmap) { | ||
const redBuf = new Buffer(bitmap); | ||
for(var i = 56; i < 1078; i += 4) { | ||
redBuf.fill(255, i, i+1); | ||
}; | ||
// console.log(redBuf.toString('hex').slice(54,1078)); | ||
return redBuf; | ||
}; | ||
|
||
exports.greyScale = function(bitmap) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @William-Skelton @shivprogrammer @annaul the transform methods in this file are really good - that said, they may be better served as prototype methods built on to the constructor - the constructor could hold the raw buffer and the methods could then interact directly with them all that said, this is still really clean and good |
||
const greyBuf = new Buffer(bitmap); | ||
for(var i = 54; i < 1078; i += 4) { | ||
greyBuf.fill(greyBuf[i+1], i, i+1); | ||
greyBuf.fill(greyBuf[i+1], i+1, i+2); | ||
greyBuf.fill(greyBuf[i+1], i+2, i+3); | ||
}; | ||
// console.log(greyBuf.toString('hex').slice(54,1078)); | ||
return greyBuf; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@William-Skelton @shivprogrammer @annaul
.eslintrc
looks good