Skip to content

Commit

Permalink
Merge pull request #564 from timholy/teh/rgb24
Browse files Browse the repository at this point in the history
Some fixes to avoid warnings from RGB24/UInt32 convert->reinterpret deprecation
  • Loading branch information
timholy authored Oct 17, 2016
2 parents d20aa18 + d41946b commit 01c7cf0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ immap{T<:Colorant}(mapi::MapNone{T}, img::AbstractImageIndexed{T}) = convert(Ima
immap{C<:Colorant}(mapi::MapNone{C}, img::AbstractImageDirect{C}) = img # ambiguity resolution
immap{T}(mapi::MapNone{T}, img::AbstractArray{T}) = img

immap(::MapNone{UInt32}, val::RGB24) = val.color
immap(::MapNone{UInt32}, val::ARGB32) = val.color
immap(::MapNone{RGB24}, val::UInt32) = reinterpret(RGB24, val)
immap(::MapNone{ARGB32}, val::UInt32) = reinterpret(ARGB32, val)


## BitShift
"""
Expand Down Expand Up @@ -488,8 +493,14 @@ function _map_a!{T,T1,T2,N}(mapi::MapInfo{T1}, out::AbstractArray{T,N}, img::Abs
dimg = data(img)
dout = data(out)
size(dout) == size(dimg) || throw(DimensionMismatch())
for I in eachindex(dout, dimg)
@inbounds dout[I] = immap(mi, dimg[I])
if eltype(dout) == UInt32 && isa(immap(mi, first(dimg)), Union{RGB24,ARGB32})
for I in eachindex(dout, dimg)
@inbounds dout[I] = immap(mi, dimg[I]).color
end
else
for I in eachindex(dout, dimg)
@inbounds dout[I] = immap(mi, dimg[I])
end
end
out
end
Expand Down

0 comments on commit 01c7cf0

Please sign in to comment.