Skip to content
Discussion options

You must be logged in to vote

That is exactly it, and the laziness instinct was sound. You should not write an eating algorithm. You should write a stamp, which is about fifteen lines.

You already keep image next to texture in TextureImage, and you already apply the rotate and the flips before LoadTextureFromImage, so the mask can be built in NewTextureImage from the same pixels the GPU gets:

type TextureImage struct {
    image   *rl.Image
    texture rl.Texture2D
    mask    [][]bool      // new
    width   float32
    height  float32
}

// after the rotate/flip block, before or after LoadTextureFromImage
cols := rl.LoadImageColors(textureImage.image)
w, h := int(textureImage.image.Width), int(textureImage.image.Height

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@geniot
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by geniot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants