Git Product home page Git Product logo

mfspringview's Introduction

MFSpringView

基于 OpenGL ES 实现图片局部拉伸功能的控件,可以用来实现长腿功能。

效果展示

原理

将图片分割为 6 个三角形,如下图所示,然后对中间矩形(V2~V5)进行拉伸或压缩处理。

渲染到纹理

当单次图片编辑结束之后,需要重新生成纹理,即读取当前屏幕呈现的结果。

出于对结果分辨率的考虑,我们不会直接读取当前屏幕渲染结果对应的帧缓存,而是采取「渲染到纹理」的方式,重新生成一个宽度与原图一致的纹理。

为什么使用 OpenGL ES

实现图片局部拉伸功能的逻辑并不复杂,理论上也可以通过 CoreGraphics 的绘图功能来实现。

但是由于 CoreGraphics 的绘图功能依赖于 CPU ,不断地重绘图像会引起卡顿。

因此,从性能的角度考虑,使用 OpenGL ES 更佳。

更多介绍

使用 iOS OpenGL ES 实现长腿功能

mfspringview's People

Contributors

lmf12 avatar

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.