Giter Site home page Giter Site logo

zuopanyao / imagecg Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 1004 KB

iOS CoreGraphics: UIImage's zoom and clip, linear Gradient, radial gradient, pdf to UIImage, UIImage to pdf...

Home Page: https://www.yaozuopan.top

License: MIT License

Swift 56.44% Ruby 37.06% Objective-C 2.52% Shell 3.98%
ios swift coregraphics iphone ipad cocoapods pdftoimage imagetopdf lineargradient radialgradient

imagecg's Introduction

ImageCG

iOS CoreGraphics: UIImage's zoom and clip, linear Gradient, radial gradient, pdf to UIImage, UIImage to pdf...

iOS 绘图: 图片缩放、叠加、裁剪,线性渐变,径向渐变,PDF 转图片,图片转 PDF ...

Platform Cocoapods Compatible

Requirements / 使用条件

  • iOS 11.0+
  • Xcode 12.2+
  • Swift 5.0+

Installation / 安装

CocoaPods

pod 'ImageCG'

Manually / 手动安装

If you prefer not to use either of the aforementioned dependency managers, you can integrate ImageCG into your project manually.

如果您不喜欢以上管理依赖库的方式,则可以手动将 ImageCG 集成到项目中。

Usage / 使用

UIColor to UIImage

let image = UIColor.red.icg.image(CGSize(width: 200, height: 100))

UIImage to UIColor

let color = myImage.icg.color

UIImage zoom

let newImage = myImage.icg.zoom(to: CGSize(width: 200, height: 100))

UIImage clip

let newImage = myImage.icg.clip(in: CGRect(origin: .init(x: 10, y: 30), size: .init(width: 200, height: 300)))

PDF to UIImage

let pdfPath: String = "read/to/path/my.pdf"
let images = UIImage.icg.readPDF(from: pdfPath, isJoin: false)

UIImage to PDF

let myImage: UIImage = UIImage()
myImage.icg.savedPDF(to: NSHomeDirectory() + "saved/to/path/my.pdf")

UIImage add UIImage 在图片上添加图片

let baseImage = UIImage(named: "BaseImageName")!
let logoImage = UIImage(named: "LogoImageName")!
let image = baseImage.icg.add(logoImage)

Linear Gradient 线性渐变

let colors = [UIColor.blue, UIColor.red, UIColor.yellow, ...]
let image = colors.icg.linearGradient(CGSize(width: 200, height: 100), 
direction: .diagonally)

Radial Gradient 径向渐变

let colors = [UIColor.blue, UIColor.red, UIColor.yellow, ...]
let image = colors.icg.radialGradient(CGSize(width: 200, height: 100), 
direction: .diagonally)

License / 许可证

ImageCG is released under the MIT license. See LICENSE for details.

ImageCG 是在 MIT 许可下发布的,有关详情请查看该许可证。

imagecg's People

Contributors

zuopanyao avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

imagecg's Issues

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.