- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for NewGray (0.12 sec)
-
src/image/draw/example_test.go
package draw_test import ( "fmt" "image" "image/color" "image/draw" "math" ) func ExampleDrawer_floydSteinberg() { const width = 130 const height = 50 im := image.NewGray(image.Rectangle{Max: image.Point{X: width, Y: height}}) for x := 0; x < width; x++ { for y := 0; y < height; y++ { dist := math.Sqrt(math.Pow(float64(x-width/2), 2)/3+math.Pow(float64(y-height/2), 2)) / (height / 1.5) * 255
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jul 20 18:07:05 UTC 2023 - 1.1K bytes - Viewed (0) -
src/image/png/writer_test.go
if err != nil { t.Fatal(err) } err = diff(convertToNRGBA(m0), m1) if err != nil { t.Error(err) } }) } } func BenchmarkEncodeGray(b *testing.B) { img := image.NewGray(image.Rect(0, 0, 640, 480)) b.SetBytes(640 * 480 * 1) b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { Encode(io.Discard, img) } } type pool struct { b *EncoderBuffer }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Oct 14 08:14:05 UTC 2022 - 8.9K bytes - Viewed (0) -
src/image/draw/bench_test.go
uint8(13 * x % 0x100), uint8(11 * y % 0x100), uint8((11*x + 13*y) % 0x100), uint8((31*x + 37*y) % 0x100), }) } } src = src1 case color.GrayModel: src1 := image.NewGray(image.Rect(0, 0, srcw, srch)) for y := 0; y < srch; y++ { for x := 0; x < srcw; x++ { src1.SetGray(x, y, color.Gray{ uint8((11*x + 13*y) % 0x100), }) } } src = src1
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jul 20 18:07:05 UTC 2023 - 6.6K bytes - Viewed (0) -
src/image/jpeg/writer_test.go
continue } } } // TestWriteGrayscale tests that a grayscale images survives a round-trip // through encode/decode cycle. func TestWriteGrayscale(t *testing.T) { m0 := image.NewGray(image.Rect(0, 0, 32, 32)) for i := range m0.Pix { m0.Pix[i] = uint8(i) } var buf bytes.Buffer if err := Encode(&buf, m0, nil); err != nil { t.Fatal(err) } m1, err := Decode(&buf)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 06 15:49:30 UTC 2022 - 7.2K bytes - Viewed (0)