Skip to content

Commit

Permalink
✨ Feat: 카메라 뷰 레이어 계층 변경(window->uiview)
Browse files Browse the repository at this point in the history
feat: 카메라 뷰 레이어 계층 변경(window->uiview)
  • Loading branch information
seochan99 committed Mar 21, 2024
1 parent cd855f0 commit bcc3dfd
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CameraViewModel: ObservableObject {

captureCount = 0
capturedImages.removeAll()
remainingTime = 1
remainingTime = 3
timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in
self?.updateTimer()
}
Expand All @@ -36,7 +36,7 @@ class CameraViewModel: ObservableObject {
} else {
if captureCount < 4 {
captureAction?()
remainingTime = 1
remainingTime = 3
} else {
// 타이머 종료 및 이미지 병합 로직
timer?.invalidate()
Expand Down Expand Up @@ -65,6 +65,9 @@ class CameraViewModel: ObservableObject {
print("Captured images count does not match expected. Found: \(capturedImages.count)")
return nil
}


let flippedImages = capturedImages.map { $0.withHorizontallyFlippedOrientation() ?? $0 }

// 이미지 크기를 1/2로 줄입니다.
let resizeWidth = capturedImages[0].size.width / 2
Expand Down Expand Up @@ -97,6 +100,7 @@ class CameraViewModel: ObservableObject {
}

}

extension UIImage {
func resized(toWidth width: CGFloat) -> UIImage? {
let canvasSize = CGSize(width: width, height: CGFloat(ceil(width/size.width * size.height)))
Expand All @@ -105,4 +109,5 @@ extension UIImage {
draw(in: CGRect(origin: .zero, size: canvasSize))
return UIGraphicsGetImageFromCurrentImageContext()
}

}
2 changes: 2 additions & 0 deletions UNIV-4cut/Code/Features/TakePhoto/Views/TakePhotoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ struct TakePhotoView: View {
.padding()
}
}
.foregroundColor(.white)

}
.onAppear {
cameraViewModel.startCapturing()
Expand Down
13 changes: 2 additions & 11 deletions UNIV-4cut/Resources/Assets.xcassets/logo.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "goormthon_univ_logo.png",
"idiom" : "universal",
"scale" : "3x"
"filename" : "프로필용.svg",
"idiom" : "universal"
}
],
"info" : {
Expand Down
Binary file not shown.
24 changes: 24 additions & 0 deletions UNIV-4cut/Resources/Assets.xcassets/logo.imageset/프로필용.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bcc3dfd

Please sign in to comment.