Defining primitive types
In Julia, you are able to define your own composite types, as explained in the previous recipe. However, you can also define your own raw-bytes type, like Float64
or UInt32
.
Getting ready
ARGB (see https://en.wikipedia.org/wiki/RGBA_color_space#ARGB_(word-order)) is a method of encoding the color of a pixel, where A () stands for pixel opacity, and R (red), G (green), and B (blue) are the components of its color. Each component takes eight bits, making 32 bits in total. In this recipe, we will create a custom primitive type that facilitates working with ARGB-encoded data.
Note
In the GitHub repository for this recipe, you will find the commands.txt
file that contains the presented sequence of shell and Julia commands. Additionally, in the argb.jl
file you can find the definitions of the ARGB
type and related methods used in this recipe.
Now open your favorite terminal to execute the commands.
How to do it...
Start by inspecting the contents of the argb.jl
file. First, we...