Skip to content

[RFC] Return type of scaling for non-parametric colors #169

@kimikage

Description

@kimikage

This is related to issue #56, #148, and JuliaGraphics/ColorTypes.jl#235.

I think the following return types are reasonable and leave little room for debate.

julia> RGB24(1) * 1.0
RGB{Float64}(1.0,1.0,1.0)

julia> RGB24(1) / 1.0
RGB{Float64}(1.0,1.0,1.0)

julia> RGB24(1) / 1
RGB{Float32}(1.0f0,1.0f0,1.0f0)

The following is a bit controversial, but consistent with the decision in FixedPointNumbers (cf. JuliaMath/FixedPointNumbers.jl#207).

julia> RGB24(1) * 1
RGB{Float32}(1.0f0,1.0f0,1.0f0)

However, I think the following should return RGB24 objects.

julia> RGB24(1) * 1N0f8
RGB{N0f8}(1.0,1.0,1.0)

julia> RGB24(1) / 1N0f8
RGB{N0f8}(1.0,1.0,1.0)

julia> RGB24(1) * true
RGB{N0f8}(1.0,1.0,1.0)

I'm going to fix the obviously problematic cases regarding Bool in PR #153 and release it in v0.9.5. For other cases, I am planning to change them in v0.10 with new one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions