Skip to content
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

[RFC] widen type bound for YCbCr #11

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ immutable YIQ{T<:FloatingPoint} <: Color{T,3}
end

@doc "`YCbCr` is the Y'CbCr color encoding often used in digital photography or video" ->
immutable YCbCr{T<:FloatingPoint} <: Color{T,3}
immutable YCbCr{T<:Fractional} <: Color{T,3}
y::T
cb::T
cr::T
Expand Down Expand Up @@ -445,6 +445,7 @@ end

eltype_default{C<:AbstractRGB }(::Type{C}) = U8
eltype_default{C<:AbstractGray }(::Type{C}) = U8
eltype_default{C<:YCbCr }(::Type{C}) = U8
eltype_default{C<:Color }(::Type{C}) = Float32
eltype_default{P<:Colorant }(::Type{P}) = eltype_default(color_type(P))

Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end
# Constructors
for C in ColorTypes.parametric3
@test eltype(C{Float32}) == Float32
et = (C <: AbstractRGB) ? U8 : Float32
et = (C <: AbstractRGB || C <: YCbCr) ? U8 : Float32
@test eltype(C(1,0,0)) == et
@test color_type(C(1,0,0)) == C{et}
@test color_type(C) == C
Expand Down