Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2024-04-29 10:24:38 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4bcfd990a6b92ab85a266ddebec2487e73da78c1
4bcfd990
1 parent
c0ed87b9
remove unused extension function
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
25 deletions
ios/Classes/MobileScannerUtilities.swift
ios/Classes/MobileScannerUtilities.swift
View file @
4bcfd99
...
...
@@ -8,31 +8,6 @@ extension CVBuffer {
let
cgImage
=
CIContext
()
.
createCGImage
(
ciImage
,
from
:
ciImage
.
extent
)
return
UIImage
(
cgImage
:
cgImage
!
)
}
var
image1
:
UIImage
{
// Lock the base address of the pixel buffer
CVPixelBufferLockBaseAddress
(
self
,
CVPixelBufferLockFlags
.
readOnly
)
// Get the number of bytes per row for the pixel buffer
let
baseAddress
=
CVPixelBufferGetBaseAddress
(
self
)
// Get the number of bytes per row for the pixel buffer
let
bytesPerRow
=
CVPixelBufferGetBytesPerRow
(
self
)
// Get the pixel buffer width and height
let
width
=
CVPixelBufferGetWidth
(
self
)
let
height
=
CVPixelBufferGetHeight
(
self
)
// Create a device-dependent RGB color space
let
colorSpace
=
CGColorSpaceCreateDeviceRGB
()
// Create a bitmap graphics context with the sample buffer data
var
bitmapInfo
=
CGBitmapInfo
.
byteOrder32Little
.
rawValue
bitmapInfo
|=
CGImageAlphaInfo
.
premultipliedFirst
.
rawValue
&
CGBitmapInfo
.
alphaInfoMask
.
rawValue
//let bitmapInfo: UInt32 = CGBitmapInfo.alphaInfoMask.rawValue
let
context
=
CGContext
(
data
:
baseAddress
,
width
:
width
,
height
:
height
,
bitsPerComponent
:
8
,
bytesPerRow
:
bytesPerRow
,
space
:
colorSpace
,
bitmapInfo
:
bitmapInfo
)
// Create a Quartz image from the pixel data in the bitmap graphics context
let
quartzImage
=
context
?
.
makeImage
()
// Unlock the pixel buffer
CVPixelBufferUnlockBaseAddress
(
self
,
CVPixelBufferLockFlags
.
readOnly
)
// Create an image object from the Quartz image
return
UIImage
(
cgImage
:
quartzImage
!
)
}
}
extension
UIDeviceOrientation
{
...
...
Please
register
or
login
to post a comment