Skip to content

Commit

Permalink
ColorsTypes.jl instead of Colors.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jaakkor2 committed Mar 4, 2024
1 parent c9caff3 commit b92f6d1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name = "JMPReader"
uuid = "d9f7e686-cf87-4d12-8d7a-0e9b8c9fba29"
authors = ["Jaakko Ruohio <jaakkor2@gmail.com>"]
version = "0.1.10-DEV"
version = "0.1.10"

[deps]
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
LibDeflate = "9255714d-24a7-4b30-8ea3-d46a97f7e13b"
Expand All @@ -14,7 +14,7 @@ WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5"

[compat]
CodecZlib = "0.7"
Colors = "0.12"
ColorTypes = "0.11.4"
DataFrames = "1"
Dates = "1.6"
LibDeflate = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion src/JMPReader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export readjmp
using Base.Threads: nthreads, @spawn, threadid
using Base.Iterators: partition
using CodecZlib: transcode, GzipDecompressor
using Colors: RGB, Colorant, FixedPointNumbers.N0f8
using ColorTypes: RGB, FixedPointNumbers.N0f8
using DataFrames: DataFrame, select!, insertcols!
using Dates: unix2datetime, DateTime, Date, Time
using LibDeflate: gzip_decompress!, Decompressor, LibDeflateErrors, LibDeflateErrors.deflate_insufficient_space
Expand Down
11 changes: 5 additions & 6 deletions src/column.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function column_data(io, info, i::Int, deflatebuffer::Vector{UInt8})
columnname = _read_string!(io, 2)
lenname = length(columnname)
dt1, dt2, dt3, dt4, dt5, dt6 = read_reals(io, UInt8, 6)
#@show i, columnname, dt1, dt2, dt3, dt4, dt5, dt6
mark(io)

# compressed
Expand Down Expand Up @@ -117,15 +116,15 @@ function column_data(io, info, i::Int, deflatebuffer::Vector{UInt8})
width = dt5
rs = Rowstate[]
for row in 1:info.nrows
offset = width*(row - 1)
offset = width * (row - 1)
markeridx = bitcat(a[offset + 7], a[offset + 6])
marker = markeridx 0x001f ? rowstatemarkers[markeridx + 1] : Char(markeridx)
if a[offset+4] == 0xff
r, g, b = 255 - a[offset + 3], 255 - a[offset + 2], 256 - a[offset + 1]
color = parse(Colorant, "rgb($r,$g,$b)") # TODO improve
if a[offset + 4] == 0xff
r, g, b = nor(a[offset + 3]), nor(a[offset + 2]), nor(a[offset + 1])
else
color = parse(Colorant, rowstatecolors[a[offset + 1] + 1])
r, g, b = hex2bytes(lstrip(rowstatecolors[a[offset + 1] + 1], '#'))
end
color = RGB(r / 255, g / 255, b / 255)
push!(rs, Rowstate(marker, color))
end
return rs
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using JMPReader
using Dates: Date, DateTime, Second
using Printf: @sprintf
using DataFrames: names
using Colors: RGB, FixedPointNumbers.N0f8
using ColorTypes: RGB, FixedPointNumbers.N0f8

@testset "example1.jmp" begin
df = readjmp(joinpath(@__DIR__, "example1.jmp"))
Expand Down

0 comments on commit b92f6d1

Please sign in to comment.