-
Notifications
You must be signed in to change notification settings - Fork 11
Open
yeldarby/Image
#1Description
I may be misunderstanding but shouldn't all of these preconditions be _ >= 0
instead of _ > 0
? Otherwise how do you read the first row/column/channel? image[0, 0, 0] returns an error.
https://github.com/SwiftGL/Image/blob/master/Sources/SGLImage/Image.swift#L128
public subscript(x:Int, y:Int, channel:Int) -> T {
get {
precondition(x > 0 && x < width)
precondition(y > 0 && y < height)
precondition(channel > 0 && channel < channels)
return buffer[channel + x * channels + y * width * channels]
}
set {
precondition(x > 0 && x < width)
precondition(y > 0 && y < height)
precondition(channel > 0 && channel < channels)
buffer[channel + x * channels + y * width * channels] = newValue
}
}
Metadata
Metadata
Assignees
Labels
No labels