Anwender95 / go-tour

Automatically exported from code.google.com/p/go-tour
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

pic.Show doesn't work from local tour interface #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Follow the instructions for "Exercise: Slices", creating pic.go
   (see example below).
2. Run the program (go run pic.go)

What is the expected output? What do you see instead?

  I expected to see an image displayed on screen.
  The exercise says:

    When you run the program, it will display
    your picture, interpreting the integers as
    grayscale (well, bluescale) values.

  Instead, the console was filled with what appeared
  to be an ascii encoding of an image:

    IMAGE:iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAI...

  I examined the downloaded code, and sure enough,
  it just emits such text.  Is there no way (yet)
  to at least display an image (if not a full UI)?

What version of the product are you using? On what operating system?

  go 1 (64-bit).
  tour downloaded on 2012/03/31.
  Windows 7, 64-bit.

Please provide any additional information below.
  Here is the code I tested with:

package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
  img := make([][]uint8, dy)
  for y := range img {
    img[y] = make([]uint8, dx)
    for x := range img[y] {
      img[y][x] = uint8(x * y)
    }
  }
  return img
}
func main() {
  pic.Show(Pic)
}

Original issue reported on code.google.com by James.Sy...@gmail.com on 7 Apr 2012 at 2:14

GoogleCodeExporter commented 8 years ago
An alternative to a native UI is to display the image in the browser.  Attached 
are two files implementing that idea:

  exercise_images.go:
    Fills an image using the Pic function above.
  serve_pic.go:
    A modification of go-tour/pic.go.
    Exports functions ToImage and ServeImage, the latter runs
    a http server on port 4000 serving the image as a png.

Original comment by James.Sy...@gmail.com on 8 Apr 2012 at 3:29

Attachments:

GoogleCodeExporter commented 8 years ago
It's designed to be run from the tour interface, which interprets such 
responses correctly and displays the image.

Original comment by a...@golang.org on 4 Sep 2012 at 5:22

GoogleCodeExporter commented 8 years ago
Well, that makes sense.  Perhaps an update to the tour or code to indicate that 
fact?

Original comment by James.Sy...@gmail.com on 4 Sep 2012 at 3:09

GoogleCodeExporter commented 8 years ago
Does not display an image in the tour web interface either. Attached are 
results of running the same code in Chrome and Firefox:

Original comment by sgrif...@gmail.com on 27 Mar 2013 at 11:43

Attachments:

GoogleCodeExporter commented 8 years ago
I'm having the same problem on OSX 

Original comment by div...@gmail.com on 29 Mar 2013 at 11:42

GoogleCodeExporter commented 8 years ago
This does not work in the tour interface in Chrome on OSX, using the latest 
64-bit binaries (go1.0.3 Mac OS X (x86 64-bit)).

Original comment by j.a.e.we...@gmail.com on 31 Mar 2013 at 6:36

GoogleCodeExporter commented 8 years ago
Thanks for the report folks, a fix is in the works:
https://codereview.appspot.com/8286043

Original comment by a...@golang.org on 2 Apr 2013 at 9:32

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 0afa8a2c0850.

Original comment by a...@golang.org on 2 Apr 2013 at 9:59