shapes.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2017 The Ebiten Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package ebitenutil
  15. import (
  16. "image/color"
  17. "github.com/hajimehoshi/ebiten/v2"
  18. "github.com/hajimehoshi/ebiten/v2/vector"
  19. )
  20. // DrawLine draws a line segment on the given destination dst.
  21. //
  22. // DrawLine is intended to be used mainly for debugging or prototyping purpose.
  23. //
  24. // Deprecated: as of v2.5. Use vector.StrokeLine without anti-aliasing instead.
  25. func DrawLine(dst *ebiten.Image, x1, y1, x2, y2 float64, clr color.Color) {
  26. vector.StrokeLine(dst, float32(x1), float32(y1), float32(x2), float32(y2), 1, clr, false)
  27. }
  28. // DrawRect draws a rectangle on the given destination dst.
  29. //
  30. // DrawRect is intended to be used mainly for debugging or prototyping purpose.
  31. //
  32. // Deprecated: as of v2.5. Use vector.DrawFilledRect without anti-aliasing instead.
  33. func DrawRect(dst *ebiten.Image, x, y, width, height float64, clr color.Color) {
  34. vector.DrawFilledRect(dst, float32(x), float32(y), float32(width), float32(height), clr, false)
  35. }
  36. // DrawCircle draws a circle on given destination dst.
  37. //
  38. // DrawCircle is intended to be used mainly for debugging or prototyping purpose.
  39. //
  40. // Deprecated: as of v2.5. Use vector.DrawFilledCircle without anti-aliasing instead.
  41. func DrawCircle(dst *ebiten.Image, cx, cy, r float64, clr color.Color) {
  42. vector.DrawFilledCircle(dst, float32(cx), float32(cy), float32(r), clr, false)
  43. }