Skip to content

support ones(::Type{<:AbstractGray}, sz) #137

Closed
@johnnychen94

Description

Since one(Gray) is deprecated, it would be convenient that the following kind of usage isn't affected:

julia> ones(Gray{N0f8}, 4, 4)
┌ Warning: one(Gray{Normed{UInt8,8}}) will soon switch to returning 1; you might need to switch to `oneunit`
│   caller = ones at array.jl:462 [inlined]
└ @ Core .\array.jl:462
4×4 Array{Gray{N0f8},2} with eltype Gray{Normed{UInt8,8}}:
...

It is "easier" to read than Gray.(ones(N0f8, 4, 4)).

P.S., this has the same issue in JuliaGraphics/Colors.jl#369 if we don't specify the concrete storage type.

julia> ones(Gray, 4, 4)
4×4 Array{Gray{Any},2} with eltype Gray:

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions