Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Use cgImage.bytesPerRow instead of width #81

Merged
merged 4 commits into from
May 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UIImageColors.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "UIImageColors"
spec.version = "2.2.0"
spec.version = "2.3.0"
spec.license = "MIT"
spec.summary = "iTunes style color fetcher for UIImage and NSImage."
spec.homepage = "https://github.com/jathu/UIImageColors"
Expand Down
2 changes: 1 addition & 1 deletion UIImageColors/Sources/UIImageColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ extension UIImage {
let imageColors = NSCountedSet(capacity: width*height)
for x in 0..<width {
jathu marked this conversation as resolved.
Show resolved Hide resolved
for y in 0..<height {
let pixel: Int = ((width * y) + x) * 4
let pixel: Int = (y * cgImage.bytesPerRow) + (x * 4)
if 127 <= data[pixel+3] {
imageColors.add((Double(data[pixel+2])*1000000)+(Double(data[pixel+1])*1000)+(Double(data[pixel])))
}
Expand Down
2 changes: 1 addition & 1 deletion UIImageColors/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<string>2.3.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down