The hole texture thing (excluding the blending) in Julia boils down to
function texture_img(G::GMTgrid; detail=1.0, contrast=2.0, uint16=false)
texture = deepcopy(G.z)
terrain_filter(texture, detail, size(G,1), size(G,2), G.inc[1], G.inc[2], 0)
(startswith(G.proj4, "+proj=merc")) && fix_mercator(texture, detail, size(G,1), size(G,2), G.range[3], G.range[4])
terrain_image_data(texture, contrast, size(G,1), size(G,2), 0.0, (uint16) ? 65535.0 : 255.0)
mat = (uint16) ? round.(UInt16, texture) : round.(UInt8, texture)
Go = mat2img(mat, hdr=grid2pix(G), proj4=G.proj4, wkt=G.wkt, noconv=true, layout=G.layout*"a")
Go.range[5:6] .= extrema(Go.image)
Go
end
with these two wrapper functions to talk directly with the lib.
This is why I think Julia brings another dimension to GMT expansion
terrain_filter(data, detail, nrows, ncols, xinc, yinc, coord_type, center_lat=0.0, progress=C_NULL) =
ccall((:terrain_filter, thelib), Cint, (Ptr{Cfloat}, Cdouble, Cint, Cint, Cdouble, Cdouble, Cint, Cdouble, Ptr{Cvoid}), data, detail, nrows, ncols, xinc, yinc, coord_type, center_lat, progress)
terrain_image_data(data, contrast, nrows, ncols, image_min=0., image_max=65535.0) =
ccall((:terrain_image_data, thelib), Cint, (Ptr{Cfloat}, Cint, Cint, Cdouble, Cdouble, Cdouble), data, nrows, ncols, contrast, image_min, image_max)