How to show Matrix{RGB} on Cairo surface?

Viewed 44

Cairo provides read_from_png, but returns value of a special type CairoSurfaceBase, which is hard to operate, so I choose Matrix{RGB}(the thing ImageIO returns). Cairo does provide something called set_matrix, but the second argument must be of type CairoMatrix. There aren't any documents on this, so I can't figure out a way to convert between CairoMatrix and Matrix{RGB}. Or, more importantly, I want to show the Matrix{RGB}.

1 Answers
  1. convert the Matrix{RGB} to Matrix{T} T<:Union{ColorTypes.ARGB32, ColorTypes.RGB24}
  2. use CairoImageSurface to convert it to CairoSurface
  3. use set_source_surface to put the surface
Related