nim book v2, Chapter 3. Rendering Textmore than a single pixel. putPixels accomplishes that: proc putPixels(points: seq[Point]; col: Color) = ① for p in items(points): ② pixels.putPixel p.x, p.y, col ③ putPixels(@[Point(x: 2, y: 3), Point(x: Point(x: 5, y: 10)], Gold) ④ ① putPixels takes a list of Points. ② The items iterator allows us to iterate over the points parameter. ③ Every pixel we draw uses the same color col. We call the putPixel declared in. Sometimes this can improve the readability of your code. ④ We call our newly introduced putPixels proc with the seq @[Point(x: 2, y: 3), Point(x: 5, y: 10)]. You can construct a sequence via @[⋯]0 码力 | 6 页 | 74.05 KB | 1 年前3
共 1 条
- 1













