Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alan-view

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alan-view - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

57

dist/alan-view.js

@@ -16,5 +16,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.alanView = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var canvas, colors, context, faces, height, lines, ref, ref1, saliency, scale, scene, src, width;
ref = block.cover, saliency = ref.saliency, colors = ref.colors, faces = ref.faces, src = ref.src, width = ref.width, height = ref.height, scene = ref.scene;
ref = block.cover, saliency = ref.saliency, colors = ref.colors, faces = ref.faces, src = ref.src, width = ref.width, height = ref.height, scene = ref.scene, lines = ref.lines;
ref1 = this.getSizeAndScale(width, height), width = ref1.width, height = ref1.height, scale = ref1.scale;
lines = block.lines;
canvas = this.props.canvas;

@@ -29,12 +28,20 @@ context = canvas.getContext('2d');

if (faces != null) {
this.drawFaces(context, faces, scale);
if (this.props.noFaces == null) {
this.drawFaces(context, faces, scale);
}
}
if (scene != null) {
this.drawScene(context, scene, width, height, scale);
if (this.props.noScene == null) {
this.drawScene(context, scene, width, height, scale);
}
}
if (lines != null) {
this.drawLines(context, lines, scale);
if (this.props.noLines == null) {
this.drawLines(context, lines, scale);
}
}
if (colors != null) {
return this.drawColors(context, colors);
if (this.props.noColors == null) {
return this.drawColors(context, colors);
}
}

@@ -44,13 +51,9 @@ };

AlanView.prototype.drawLines = function(context, lines, scale) {
var bbox, h, j, len, piece, pieces, results, w, x, y;
if (lines.direction === 'vertical') {
pieces = lines.columns;
} else {
pieces = lines.rows;
}
var bbox, h, j, len, results, stripe, stripes, type, w, x, y;
stripes = lines.stripes;
results = [];
for (j = 0, len = pieces.length; j < len; j++) {
piece = pieces[j];
if (piece[0] === 'space') {
bbox = piece[1];
for (j = 0, len = stripes.length; j < len; j++) {
stripe = stripes[j];
type = stripe.type, bbox = stripe.bbox;
if (type === 'space') {
x = bbox.x * scale;

@@ -64,3 +67,3 @@ y = bbox.y * scale;

context.stroke();
context.fillStyle = 'rgba(255, 0, 0, 0.2)';
context.fillStyle = 'rgba(255, 0, 0, 0.3)';
results.push(context.fill());

@@ -76,13 +79,13 @@ } else {

var bbox, h, w, x, y;
if (this.props.noScene == null) {
bbox = scene.bbox;
x = bbox.x * scale;
y = bbox.y * scale;
w = bbox.width * scale;
h = bbox.height * scale;
bbox = scene.bbox;
x = bbox.x * scale;
y = bbox.y * scale;
w = bbox.width * scale;
h = bbox.height * scale;
context.beginPath();
context.rect(x, y, w, h);
context.strokeStyle = 'rgba(0, 255, 0, 0.5)';
context.stroke();
if (this.props.noSceneFading == null) {
context.beginPath();
context.rect(x, y, w, h);
context.strokeStyle = 'rgba(0, 255, 0, 0.5)';
context.stroke();
context.beginPath();
context.rect(0, 0, width, height);

@@ -89,0 +92,0 @@ context.rect(x - 50, y - 50, w + 100, h + 100);

{
"name": "alan-view",
"version": "0.1.0",
"version": "0.1.1",
"description": "Alan's view for a given image",

@@ -5,0 +5,0 @@ "licenses": [

@@ -26,4 +26,4 @@ # (WIP) Alan's View

canvas: document.getElementById 'some-canvas'
maxWidth: 700
maxHeight: 700
maxWidth: 500
maxHeight: 300

@@ -35,3 +35,3 @@ view.draw props

![Result](http://i.imgur.com/nTBkab2.png)
![Result](http://i.imgur.com/dEGIYr4.png)

@@ -43,8 +43,31 @@ It is also possible to hide layers:

canvas: document.getElementById 'some-canvas'
maxWidth: 700
maxHeight: 700
noSaliency: true
maxWidth: 500
maxHeight: 300
noCircle: true
noSceneFading: true
noColors: true
view.draw props
```
Those are the options available:
- `noSaliency`: hides the salient region bounding box
- `noPolygon`: hides the polygon around the salient region
- `noCircle`: hides the circle around the salient region
- `noFaces`: hides faces bounding boxes
- `noScene`: hides scene bounding box
- `noSceneFading`: hides the fading bounding box around scene
- `noLines`: hides rows/columns bounding boxes
- `noColors`: hides the color palette
# Information displayed
![Carl](http://i.imgur.com/CLk0nia.png)
- Color palettes: 5 circles at top-left
- Salient region: white bounding box
- Salient polygon: white shape with no opacity
- Salient circle: white circle
- Scene region: green bounding box
- Lines (columns/rows): red bounding boxes around scene region

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc