Skip to content

Adds copying to C4Image #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Adds copying to C4Image #589

wants to merge 5 commits into from

Conversation

traviskirton
Copy link
Collaborator

class ViewController: C4CanvasController {
var img = C4Image("chop")!

override func setup() {
for _ in 0...3 {
guard let i = img.mutableCopy() as? C4Image else {
continue
}
i.center = C4Point(random01() * canvas.width, random01() *
canvas.height)
canvas.add(i)
}
}
}

traviskirton and others added 5 commits January 4, 2016 23:30
```
class ViewController: C4CanvasController {
    var img = C4Image("chop")!

    override func setup() {
        for _ in 0...3 {
            guard let i = img.mutableCopy() as? C4Image else {
                continue
            }
            i.center = C4Point(random01() * canvas.width, random01() *
canvas.height)
            canvas.add(i)
        }
    }
}
```
Repeat functionality added to the C4ViewAnimationSequence
```
class ViewController: C4CanvasController {
    var img = C4Image("chop")!

    override func setup() {
        for _ in 0...3 {
            guard let i = img.mutableCopy() as? C4Image else {
                continue
            }
            i.center = C4Point(random01() * canvas.width, random01() *
canvas.height)
            canvas.add(i)
        }
    }
}
```
@traviskirton
Copy link
Collaborator Author

@Aleph7: added constructor, but i'm not a fan of:

C4Image(c4image: c!)

That's just bad grammar. But, C4Image(_ c4image: c!) conflicts with: C4Image(_ name: String)

@alejandro-isaza
Copy link
Member

I think it should be C4Image(named: String) same as UIImage, but that breaks the API. We could also do let newImage = image.imageByCopying()

@traviskirton
Copy link
Collaborator Author

what about

img.c4image

this is consistent with img.cgimage, img.ciimage, img.uiimage

@alejandro-isaza alejandro-isaza deleted the C4ImageCopy branch January 17, 2016 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants