mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Add comments to At
This commit is contained in:
parent
b60d549924
commit
4d3d407205
@ -46,6 +46,10 @@ type Sprite struct {
|
||||
func (s *Sprite) In(x, y int) bool {
|
||||
// Check the actual color (alpha) value at the specified position
|
||||
// so that the result of In becomes natural to users.
|
||||
//
|
||||
// Note that this is not a good manner to use At for logic
|
||||
// since color from At might include some errors on some machines.
|
||||
// As this is not so important logic, it's ok to use it so far.
|
||||
return s.image.At(x-s.x, y-s.y).(color.RGBA).A > 0
|
||||
}
|
||||
|
||||
|
3
image.go
3
image.go
@ -246,6 +246,9 @@ func (i *Image) ColorModel() color.Model {
|
||||
//
|
||||
// At always returns a transparent color if the image is disposed.
|
||||
//
|
||||
// Note that important logic should not rely on At result since
|
||||
// At might include a very slight error on some machines.
|
||||
//
|
||||
// At can't be called before the main loop (ebiten.Run) starts (as of version 1.4.0-alpha).
|
||||
func (i *Image) At(x, y int) color.Color {
|
||||
if i.isDisposed() {
|
||||
|
Loading…
Reference in New Issue
Block a user