GithubHelp home page GithubHelp logo

blog's People

Contributors

maple-ro avatar robert-ro avatar

Stargazers

 avatar

Watchers

 avatar

blog's Issues

JSBridge通信架构

期望使用方式

有点electron主进程与渲染进程通信的意思

// Web
web.call('event1', {param1}, (res) => {...}) // 触发 native event1 执行
web.on('event2', (res) => {...})
 
// Native 
// 这里用 js 代替,理解大致意思即可
native.call('event2', {param2}, (res) => {...}) // 触发 web event2 执行
native.on('event1', (res) => {...})

调度机制
时序图

reference

图片灰度算法

获取图片像素信息

// use canvas
ctx.getImageData(0, 0, img.width, img.height): ImageData
interface ImageData {
    /**
     * Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
     */
    readonly data: Uint8ClampedArray;
    /**
     * Returns the actual dimensions of the data in the ImageData object, in pixels.
     */
    readonly height: number;
    /**
     * Returns the actual dimensions of the data in the ImageData object, in pixels.
     */
    readonly width: number;
}

Calculate method

for(var Pixel in Image){
  var Red = Image[Pixel].Red
  var Green = Image[Pixel].Green
  var Blue = Image[Pixel].Blue

  var Gray = (Red + Green + Blue) / 3

  Image[Pixel].Red = Gray
  Image[Pixel].Green = Gray
  Image[Pixel].Blue = Gray
}

1. 平均值算法

Gray = (Red + Green + Blue) / 3 

2. 基于人眼认知

Gray = (Red * 0.3 + Green * 0.59 + Blue * 0.11)
Gray = (Red * 0.2126 + Green * 0.7152 + Blue * 0.0722)
Gray = (Red * 0.299 + Green * 0.587 + Blue * 0.114)

3. 去饱和

HLS模型描述颜色,这三个字母分别表示Hue(色调)、Saturation(饱和度)、Lightness(亮度)。色调,取值为:0 - 360,0(或360)表示红色,120表示绿色,240表示蓝色,也可取其他数值来指定颜色。饱和度,取值为:0.0% - 100.0%,它通常指颜色的鲜艳程度。亮度,取值为:0.0% - 100.0%,黑色的亮度为0。

Gray = ( Math.max(Red, Green, Blue) + Math.min(Red, Green, Blue) ) / 2

4. 分解

Gray = Math.max(Red, Green, Blue)
Gray = Math.min(Red, Green, Blue)

5. 单一通道

Gray = Red
Gray = Blue
Gray = Green

6. 自定义灰度阴影

const NumberOfShades  = [2, 256]
ConversionFactor = 255 / (NumberOfShades - 1)
AverageValue = (Red + Green + Blue) / 3
Gray = Math.round((AverageValue / ConversionFactor) + 0.5) * ConversionFactor

Reference

他山 - 成长分享

集别人的成长之路,寻自己成长的方向

一个前端妹子的阿里p7成长之路

前端赋能

  • 基于PSD解析的规范化合图方案(node应用)

含可视化界面供设计师提供配置生成图片

  • 坑位可视化开发工具
  • 升级=>模块可视化研发方案(鲸幂)

作者总结

  • 跳出技术视角

与业务方,上下游多沟通

  • 追求极致

编辑器,除基础功能外,增加快捷键,辅助线,自动吸附等功能,打磨产品体验

  • 结构变化表达

让别人get到你的产出及价值,推荐书籍[金字塔原理]

个人思考

  • 工作内容连续性,迭代升级,完美打磨,极大的提升个人成长

参考链接

use mkcert to ssl localhost

linux

  • On Linux, first install certutil.
sudo apt install libnss3-tools // ubuntu
    -or-
sudo yum install nss-tools // centos
  • wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64
  • sudo cp mkcert-v1.4.3-linux-amd64 /usr/local/bin/mkcert
  • sudo chmod +x /usr/local/bin/mkcert
  • mkcert -install
  • mkcert -CAROOT
  • mkcert <LAN> localhost 127.0.0.1 ::1
  • setup nginx with ip/localhost.pem
  • add root ca to your system and trust the root ca(!important)
  • enjoy https://localhost

reference

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.