Create a semi-transparent cursor from an image

后端 未结 4 2232
深忆病人
深忆病人 2021-02-14 23:12

Is it possible to create a cursor from an image and have it be semi-transparent?

I\'m currently taking a custom image and overylaying the mouse cursor image. It would b

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-14 23:59

    On the top of my head (I would try that first):

    1. create new bitmap with same size as original, but with ARGB structure
    2. drawimage: existing bitmap to the new bitmap
    3. access raw bitmap data, and replace A bytes with 128

    You should have nice semitransparent bitmap there.

    If performance allows, you can scan for fully transparent pixels and set A to zero for them!

提交回复
热议问题