Giter Club home page Giter Club logo

roundimage's Introduction

RoundImage

##自定义圆形图片控件 ##原理: 这次用的方法主要是通过BitmapShader来实现,Shader是颜色填充器,比如画了个圆,如果设置了Shader,且设置Shader颜色为蓝色,则画出的圆内部就会被蓝色填充。而BitmapShader则是用图片来作为填充物,因此,我们将需要处理的图片放入BitmapShader中,然后画一个圆,然后就会用之前的图像填充圆内部,然后就实现了圆形图片。同理也可以实现圆角矩形图片等效果。

##控件功能:

  • 1.根据画布大小,缩放处理的图片

  • 2.提供两种模式:

    • AUTO模式,将画布大小作为圆形半径

    • MANUAL模式,手动设置圆形半径,截取图片居中部分,不影响画布大小

##控件效果: doodles

具体步骤和之前自定义控件的差不多,源码里进行了注释,直接看源码就行。

roundimage's People

Contributors

lqcice avatar

Watchers

James Cloos avatar  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.