github.com/Kintar/etxt@v0.0.0-20221224033739-2fc69f000137/ecache/ebiten_no.go (about)

     1  //go:build gtxt
     2  
     3  package ecache
     4  
     5  import "image"
     6  
     7  // Same as etxt.GlyphMask.
     8  type GlyphMask = *image.Alpha
     9  
    10  const constMaskSizeFactor = 56
    11  
    12  func GlyphMaskByteSize(mask GlyphMask) uint32 {
    13  	if mask == nil {
    14  		return constMaskSizeFactor
    15  	}
    16  	w, h := mask.Rect.Dx(), mask.Rect.Dy()
    17  	return maskDimsByteSize(w, h)
    18  }
    19  
    20  func maskDimsByteSize(width, height int) uint32 {
    21  	return uint32(width*height) + constMaskSizeFactor
    22  }