You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zspencer opened this issue
Aug 24, 2020
· 0 comments
Assignees
Labels
codeHone your programming skills!epicWork that can't be completed in a single sessionrefactorHone your refactoring and architecture skillstestImprovements or additions to test coverage
Feature: Unique Photos
In order to know my photography is one-of-a-kind
I want to be able to re-apply a unique set of lenses to a photo
@built@steps-unimplementedScenario: Taking a Photo applies a unique resultGiven I have opened the Camera
When I take a Photo
Then the Photo has a new unique filter applied
@built@steps-unimplementedScenario: Choosing a Photo applies a unique resultGiven I have opened the Photo Picker
When I select a Photo
Then the Photo has a new unique filter applied
@built@steps-unimplementedScenario: Tapping a Photo re-applies a new unique resultGiven a Photo has had a unique filter applied
When I tap the Photo
Then the Photo has a new unique filter applied
Architecture / Example Code
Q&A:
How do I generate the same fingerprint over and over? If we make the fingerprint a seeded random number generator we'll be able to save that seed and it will create the same stack of lenses with the same filters and filter parameters.
How do the pieces fit together? Below is an example potential design, sketched in Ruby; so it may not translate directly to Swift.
# We generate a new fingerprint every time someone taps on a photofingerprint=Fingerprint.new# The fingerprint is used to pick the filters, and then shuffle them around to build a LensStack.# Keep in mind, with seeded random number generators, they generate the _same answers in sequence_ not _the same answer every time_; so order of operations (i.e. `random` then `sample` then `shuffle`) generates different results than `shuffle` then `random` then `sample`)lens_stack=fingerprint.shuffle(fingerprint.sample(Filter.all,fingerprint.random(4..6))).mapdo |filter|
Lens.new(filter.new,fingerprint)end# Once we have the lens_stack, we can squeeze a photo through it, and apply each lens to the photoresult=lens_stack.reduce(photo)do |in_process_photo,lens|
lens.apply(in_process_photo)endclassFilterdefset_parameters(fingerprint)raiseNotImplementedError('Implement me in child classes')enddeftransform(photo)raiseNotImplementedError('Implement me in child classes')endendclassGaussianBlur < Filterattr_accessor:intensitydefset_parameters(fingerprint)this.intensity=fingerprint.rand(0..100)enddeftransform(photo)wiggle(photo,intensity)endendclassSepia < Filterend# Random Number Seed GeneratorclassFingerprintdefinitialize(seed: SecureRandom.uuid)self.seed=seedenddefrand(range)endendclassLensattr_accessor:fingerprint,:photodefapply(photo)filter.set_parameters(fingerprint)filter.transform(photo)endend
The text was updated successfully, but these errors were encountered:
zspencer
added
code
Hone your programming skills!
test
Improvements or additions to test coverage
refactor
Hone your refactoring and architecture skills
labels
Aug 24, 2020
See: #4
As we learn how to Swift; we're stepping away from the SwiftUI/etc.
system and focusing more on building a library for doing the filtering.
We'll start with downloading a file from the Internet, saving it, then
running it through a LensStack, and saving a copy at each stage.
This way, we can start to diagnose if/how the filters are working
without futzing about with SwiftUI; which adds a confounding factor when
trying to figure things out.
codeHone your programming skills!epicWork that can't be completed in a single sessionrefactorHone your refactoring and architecture skillstestImprovements or additions to test coverage
TODO
Feature Definition
Architecture / Example Code
Q&A:
How do I generate the same fingerprint over and over? If we make the fingerprint a seeded random number generator we'll be able to save that seed and it will create the same stack of lenses with the same filters and filter parameters.
How do the pieces fit together? Below is an example potential design, sketched in Ruby; so it may not translate directly to Swift.
The text was updated successfully, but these errors were encountered: