• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Martomate / TriPaint / 9421867027

07 Jun 2024 06:59PM UTC coverage: 31.241% (+0.2%) from 31.087%
9421867027

push

github

Martomate
Refactor: Moved lots of files to the core module

11 of 23 new or added lines in 4 files covered. (47.83%)

113 existing lines in 5 files now uncovered.

438 of 1402 relevant lines covered (31.24%)

0.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/src/main/scala/tripaint/view/image/TriImageForPreview.scala
1
package tripaint.view.image
2

3
import tripaint.coords.TriangleCoords
4
import tripaint.grid.GridCell
5
import tripaint.image.ImageStorage
6

7
import scalafx.scene.SnapshotParameters
8
import scalafx.scene.image.Image
9
import scalafx.scene.layout.Pane
10

11
class TriImageForPreview(content: GridCell, previewWidth: Double) extends Pane {
×
12
  private def storage: ImageStorage = content.storage
×
13

14
  private val canvas: TriImageCanvas = new TriImageCanvas(previewWidth, storage.imageSize)
×
15

16
  content.trackChanges(onImageChanged(_))
×
17
  children.add(canvas)
×
18

19
  redraw()
×
20

21
  private def drawTriangle(coords: TriangleCoords): Unit = {
×
22
    canvas.drawTriangle(coords, storage.getColor(coords), storage)
×
23
  }
24

25
  private def redraw(): Unit = {
×
26
    canvas.clearCanvas()
×
27
    for c <- storage.allPixels do {
×
28
      drawTriangle(c)
×
29
    }
30
  }
31

32
  private def onImageChanged(event: GridCell.Event): Unit = {
×
33
    import GridCell.Event.*
34
    event match {
35
      case PixelChanged(coords, _, _) =>
×
36
        drawTriangle(coords)
×
37
      case ImageChangedALot =>
×
38
        redraw()
×
NEW
39
      case _ =>
×
40
    }
41
  }
42

43
  def toImage(params: SnapshotParameters): Image = {
×
44
    canvas.snapshot(params, null)
×
45
  }
46
}
47

48
object TriImageForPreview {
49
  val previewSize = 64
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc