From 1b1380bf285bf5d17745fb894ad7836bf7140079 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Mon, 5 Dec 2022 02:52:53 -0800 Subject: [PATCH 01/23] Edit --- addition | 1 + 1 file changed, 1 insertion(+) create mode 100644 addition diff --git a/addition b/addition new file mode 100644 index 0000000..89ef3fc --- /dev/null +++ b/addition @@ -0,0 +1 @@ +System.out.println("Hello World!"); From 0f757c71ea491c69ba82e64ba6d6701d8e325145 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Mon, 5 Dec 2022 12:52:02 -0800 Subject: [PATCH 02/23] Sum calculator I revisited the addition file and changed it to a for loop that finds the sum of the first 5 positive integers. This code can help with finding sums and averages. This is very basic code, so it can be adjusted later to allow input for how many or which integers are added. --- addition | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addition b/addition index 89ef3fc..3f790c7 100644 --- a/addition +++ b/addition @@ -1 +1,9 @@ -System.out.println("Hello World!"); +public class Main { + public static void main(String[] args) { + int sum = 0; + for (int i = 1; i <= 5; i++) { + sum = sum + i; + } + System.out.println(sum); + } +} From 24168fec7bd5d53dc4759754acbc9e7ff2e9381b Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 01:55:29 -0800 Subject: [PATCH 03/23] Update FCircle.swift --- Shared/FCircle.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Shared/FCircle.swift b/Shared/FCircle.swift index de2b5d7..f781378 100644 --- a/Shared/FCircle.swift +++ b/Shared/FCircle.swift @@ -9,18 +9,20 @@ import SwiftUI struct FCircle: View{ var isPreview = false + var color = 1.0 var numShapes: Int - init(isPreview: Bool) { + init(isPreview: Bool, color: Double) { self.isPreview = isPreview self.numShapes = Constant.num / (isPreview ? 3 : 1) + self.color = color } var body: some View{ ZStack(alignment: .center){ ForEach(Array(stride(from: 0, to: numShapes, by: 4)), id: \.self) { i in Circle() - .stroke(Color.white, lineWidth: Constant.borderWidth) + .stroke(Color(white: color), lineWidth: Constant.borderWidth) .frame( width: Constant.minSizeShape + (CGFloat(i) * 4), height: Constant.minSizeShape + (CGFloat(i) * 4), From 16e791e5fb6cad519c15cf552b812cfdfbc49860 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 01:56:32 -0800 Subject: [PATCH 04/23] Update FLines.swift --- Shared/FLines.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Shared/FLines.swift b/Shared/FLines.swift index ca0776a..138a92e 100644 --- a/Shared/FLines.swift +++ b/Shared/FLines.swift @@ -9,19 +9,19 @@ import SwiftUI struct FLines: View{ var isPreview = false + var color = 0.0 var scale: Int - - init(isPreview: Bool) { + init(isPreview: Bool, color: Double) { self.isPreview = isPreview self.scale = isPreview ? 3 : 5 + self.color = color } - var body: some View{ GeometryReader { geometry in HStack{ - ForEach(0.. Date: Sun, 8 Jan 2023 02:06:28 -0800 Subject: [PATCH 05/23] Update FReactangle.swift --- Shared/FReactangle.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Shared/FReactangle.swift b/Shared/FReactangle.swift index 7e4f8b2..b4bf1b0 100644 --- a/Shared/FReactangle.swift +++ b/Shared/FReactangle.swift @@ -9,18 +9,20 @@ import SwiftUI struct FReactngle: View{ var isPreview = false + var color = 0.0 var numShapes: Int - init(isPreview: Bool) { + init(isPreview: Bool, color: Double) { self.isPreview = isPreview self.numShapes = Constant.num / (isPreview ? 3 : 1) + self.color = color } var body: some View{ ZStack { ForEach(Array(stride(from: 0, to: numShapes, by: 4)), id: \.self) { i in Rectangle() - .stroke(Color.white, lineWidth: Constant.borderWidth) + .stroke(Color(white: color), lineWidth: Constant.borderWidth) .frame( width: Constant.minSizeShape + (CGFloat(i) * 4), height: Constant.minSizeShape + (CGFloat(i) * 4), From bd72d132d471faacac01e75aca85e8ed3b610a7e Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:07:23 -0800 Subject: [PATCH 06/23] Update FStar.swift --- Shared/FStar.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Shared/FStar.swift b/Shared/FStar.swift index a8c7751..9758451 100644 --- a/Shared/FStar.swift +++ b/Shared/FStar.swift @@ -9,18 +9,20 @@ import SwiftUI struct FStart: View{ var isPreview = false + var color = 1.0 var scale: Int - init(isPreview: Bool) { + init(isPreview: Bool, color: Double) { self.isPreview = isPreview self.scale = Constant.num + self.color = color } var body: some View{ ZStack{ - ForEach(0.. Date: Sun, 8 Jan 2023 02:08:26 -0800 Subject: [PATCH 07/23] Update Filter.swift --- Shared/Filter.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Shared/Filter.swift b/Shared/Filter.swift index 4d96af7..0416ed7 100644 --- a/Shared/Filter.swift +++ b/Shared/Filter.swift @@ -3,6 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. +// Edited by Astra on 1/8/22. // import SwiftUI @@ -26,13 +27,13 @@ struct Filter: View { } label: { switch data.filter { case .circle: - FCircle(isPreview: data.isPreview) + FCircle(isPreview: data.isPreview, color: data.color) case .rectangle: - FReactngle(isPreview: data.isPreview) + FReactngle(isPreview: data.isPreview, color: data.color) case .lines: - FLines(isPreview: data.isPreview) + FLines(isPreview: data.isPreview, color: data.color) case .start: - FStart(isPreview: data.isPreview) + FStart(isPreview: data.isPreview, color: data.color) } }.frame(width: geometry.size.width, height: geometry.size.height, alignment: .center) } From 097de059db93e718e9625bb97a2f018327b14365 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:08:40 -0800 Subject: [PATCH 08/23] Update FReactangle.swift --- Shared/FReactangle.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Shared/FReactangle.swift b/Shared/FReactangle.swift index b4bf1b0..96cae48 100644 --- a/Shared/FReactangle.swift +++ b/Shared/FReactangle.swift @@ -3,6 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. +// Edited by Astra on 1/8/22. // import SwiftUI From 275ac7fee8c04c2de8f411f0a4a1816f3930f89e Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:08:54 -0800 Subject: [PATCH 09/23] Update FStar.swift --- Shared/FStar.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Shared/FStar.swift b/Shared/FStar.swift index 9758451..a0fd255 100644 --- a/Shared/FStar.swift +++ b/Shared/FStar.swift @@ -3,6 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. +// Edited by Astra on 1/8/22. // import SwiftUI From 70105fcdedd02c95ad325c0198fceb89243c016c Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:09:09 -0800 Subject: [PATCH 10/23] Update FLines.swift --- Shared/FLines.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Shared/FLines.swift b/Shared/FLines.swift index 138a92e..976f774 100644 --- a/Shared/FLines.swift +++ b/Shared/FLines.swift @@ -3,6 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. +// Edited by Astra on 1/8/22. // import SwiftUI From 8c76e5773a1764788d03dbe0215b10ea928674e5 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:09:25 -0800 Subject: [PATCH 11/23] Update FCircle.swift --- Shared/FCircle.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Shared/FCircle.swift b/Shared/FCircle.swift index f781378..ad496e8 100644 --- a/Shared/FCircle.swift +++ b/Shared/FCircle.swift @@ -3,6 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. +// Edited by Astra on 1/8/22. // import SwiftUI From ec529603b8388ec13eab996b3f0b369e5d718b8e Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:10:15 -0800 Subject: [PATCH 12/23] Update FCircle.swift --- Shared/FCircle.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/FCircle.swift b/Shared/FCircle.swift index ad496e8..ea1dabc 100644 --- a/Shared/FCircle.swift +++ b/Shared/FCircle.swift @@ -3,7 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. -// Edited by Astra on 1/8/22. +// Edited by Astra on 1/8/23. // import SwiftUI From 52265ff652e0fcb38da02bc3db41c3d25d5df926 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:11:19 -0800 Subject: [PATCH 13/23] Update ContentView.swift --- Shared/ContentView.swift | 45 +++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/Shared/ContentView.swift b/Shared/ContentView.swift index 8953792..88830db 100644 --- a/Shared/ContentView.swift +++ b/Shared/ContentView.swift @@ -3,11 +3,15 @@ // Shared // // Created by Delta on 24/5/22. +// Edited by Astra on 1/8/23. // import AVFoundation import SwiftUI +var swipePreview = true; +var chosenColor = 1.0; + struct ContentView: View { var body: some View { CameraView() @@ -22,21 +26,25 @@ struct ContentView_Previews: PreviewProvider { struct CameraView: View{ @State private var filtersPreview = [ - FilterModel(filter: .circle, isPreview: true), - FilterModel(filter: .rectangle, isPreview: true), - FilterModel(filter: .lines, isPreview: true), - FilterModel(filter: .start, isPreview: true) + FilterModel(filter: .circle, isPreview: true, color: chosenColor), + FilterModel(filter: .rectangle, isPreview: true, color: abs(chosenColor - 1.0)), + FilterModel(filter: .lines, isPreview: true, color: abs(chosenColor - 1.0)), + FilterModel(filter: .start, isPreview: true, color: chosenColor) ] @StateObject var camera = CameraModel() @StateObject var viewModel = ViewModel() var body: some View{ + let _ = print("test") GeometryReader { geometry in VStack{ ZStack(alignment: .center){ CameraPreview(camera: camera).ignoresSafeArea(.all, edges: .all ).frame(width: geometry.size.width, alignment: .center) - Filter(data: FilterModel(filter: viewModel.indexFilter, isPreview: false)) - .clipped() + // this code adds the filter + if (swipePreview) { + Filter(data: FilterModel(filter: viewModel.indexFilter, isPreview: false, color: chosenColor)) + .clipped() + } }.onAppear { camera.Check() }.frame(width: geometry.size.width, height: geometry.size.height / 1.4, alignment: .center).clipped() @@ -50,6 +58,28 @@ struct CameraView: View{ } }.frame(height: Constant.sizeWidthPreview) .background(Color.gray) + HStack(alignment: .center) { + Button(action: { + if chosenColor == 1.0 { + chosenColor = 0.0 + } else { + chosenColor = 1.0 + } + }) { + Text("Color Toggle") + .padding(10) + .foregroundColor(.white) + .background(Color.pink) + } + Button(action: { + swipePreview.toggle() + }) { + Text("Show/Hide Toggle") + .padding(10) + .foregroundColor(.white) + .background(Color.pink) + } + } } } } @@ -62,6 +92,7 @@ struct TakePictureButton: View { HStack{ if isTaken { Button(action: {}, label: { + //todo }) }else{ @@ -169,5 +200,3 @@ struct CameraPreview: UIViewRepresentable { } } - - From 835dc5cea012df9f0605d75a845e982e387bc58d Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:11:36 -0800 Subject: [PATCH 14/23] Update Filter.swift --- Shared/Filter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/Filter.swift b/Shared/Filter.swift index 0416ed7..ba89813 100644 --- a/Shared/Filter.swift +++ b/Shared/Filter.swift @@ -3,7 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. -// Edited by Astra on 1/8/22. +// Edited by Astra on 1/8/23. // import SwiftUI From 8a55362c8d60c95eef72da7bd08d4e7244663932 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:12:05 -0800 Subject: [PATCH 15/23] Update Model.swift --- Shared/Model.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Shared/Model.swift b/Shared/Model.swift index 7e3f07e..48aba96 100644 --- a/Shared/Model.swift +++ b/Shared/Model.swift @@ -3,6 +3,7 @@ // MoireLens // // Created by Delta on 13/6/22. +// Edited by Astra on 1/8/23. // import Foundation @@ -10,4 +11,5 @@ import Foundation struct FilterModel { var filter: FILTERS var isPreview: Bool + var color: Double } From 4401b88a435b054b3350f11af5e9da8e3747319a Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:14:39 -0800 Subject: [PATCH 16/23] Added color and view toggles The buttons in lines 61-80 were added to change the filters' colors(black/white) and visibility. --- Shared/ContentView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shared/ContentView.swift b/Shared/ContentView.swift index 88830db..2eddc5f 100644 --- a/Shared/ContentView.swift +++ b/Shared/ContentView.swift @@ -9,8 +9,8 @@ import AVFoundation import SwiftUI -var swipePreview = true; -var chosenColor = 1.0; +var swipePreview = true +var chosenColor = 1.0 struct ContentView: View { var body: some View { From 6736ed95fe05fe3d8671e313a3c6af8851c27478 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:15:56 -0800 Subject: [PATCH 17/23] Added color parameter --- Shared/FCircle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shared/FCircle.swift b/Shared/FCircle.swift index ea1dabc..d489446 100644 --- a/Shared/FCircle.swift +++ b/Shared/FCircle.swift @@ -2,8 +2,8 @@ // FCircle.swift // MoireLens (iOS) // -// Created by Delta on 11/7/22. -// Edited by Astra on 1/8/23. +// Created by Delta on 11/7/22 +// Edited by Astra on 1/8/23 // import SwiftUI From 021fce994e3d90e9bb2cde37aaf9544011c13f10 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:16:44 -0800 Subject: [PATCH 18/23] Added color variable --- Shared/FLines.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/FLines.swift b/Shared/FLines.swift index 976f774..4d3b1cf 100644 --- a/Shared/FLines.swift +++ b/Shared/FLines.swift @@ -3,7 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. -// Edited by Astra on 1/8/22. +// Edited by Astra on 1/8/23. // import SwiftUI From b0c9321f616d7428e6140a7a6ab5a374efdf1285 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:17:10 -0800 Subject: [PATCH 19/23] Added color variable --- Shared/FCircle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shared/FCircle.swift b/Shared/FCircle.swift index d489446..ea1dabc 100644 --- a/Shared/FCircle.swift +++ b/Shared/FCircle.swift @@ -2,8 +2,8 @@ // FCircle.swift // MoireLens (iOS) // -// Created by Delta on 11/7/22 -// Edited by Astra on 1/8/23 +// Created by Delta on 11/7/22. +// Edited by Astra on 1/8/23. // import SwiftUI From b8e39807a7a0a2f99183aa37479e9ae38e751311 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:17:25 -0800 Subject: [PATCH 20/23] Added color variable --- Shared/FReactangle.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/FReactangle.swift b/Shared/FReactangle.swift index 96cae48..24caf23 100644 --- a/Shared/FReactangle.swift +++ b/Shared/FReactangle.swift @@ -3,7 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. -// Edited by Astra on 1/8/22. +// Edited by Astra on 1/8/23. // import SwiftUI From c603e6b200da2faa8456817927ae4f3fdda00501 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:17:42 -0800 Subject: [PATCH 21/23] Added color variable --- Shared/FStar.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/FStar.swift b/Shared/FStar.swift index a0fd255..29a85d9 100644 --- a/Shared/FStar.swift +++ b/Shared/FStar.swift @@ -3,7 +3,7 @@ // MoireLens (iOS) // // Created by Delta on 11/7/22. -// Edited by Astra on 1/8/22. +// Edited by Astra on 1/8/23. // import SwiftUI From c9c12ebd66f594879f9c7eab858429113607cbd0 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:18:03 -0800 Subject: [PATCH 22/23] Added color parameter --- Shared/Filter.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shared/Filter.swift b/Shared/Filter.swift index ba89813..c6c081d 100644 --- a/Shared/Filter.swift +++ b/Shared/Filter.swift @@ -2,8 +2,8 @@ // Filter.swift // MoireLens (iOS) // -// Created by Delta on 11/7/22. -// Edited by Astra on 1/8/23. +// Created by Delta on 11/7/22 +// Edited by Astra on 1/8/23 // import SwiftUI From 13eb28264dbbaa9f429d32887f012700e09d8b36 Mon Sep 17 00:00:00 2001 From: Ernest Ibarolle <63222761+AdAstraCA@users.noreply.github.com> Date: Sun, 8 Jan 2023 02:18:27 -0800 Subject: [PATCH 23/23] Added color parameter --- Shared/Model.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shared/Model.swift b/Shared/Model.swift index 48aba96..236f28d 100644 --- a/Shared/Model.swift +++ b/Shared/Model.swift @@ -2,8 +2,8 @@ // Model.swift // MoireLens // -// Created by Delta on 13/6/22. -// Edited by Astra on 1/8/23. +// Created by Delta on 13/6/22 +// Edited by Astra on 1/8/23 // import Foundation