rename WriteTo API to WriteImage
This commit is contained in:
parent
3e4b61d8c9
commit
dbb96819ea
|
@ -65,7 +65,7 @@ type SetOption func(*Options)
|
||||||
|
|
||||||
// Data is the result of captcha generation.
|
// Data is the result of captcha generation.
|
||||||
// It has a `Text` field and a private `img` field that will
|
// It has a `Text` field and a private `img` field that will
|
||||||
// be used in `WriteTo` receiver
|
// be used in `WriteImage` receiver
|
||||||
type Data struct {
|
type Data struct {
|
||||||
// Text is captcha solution
|
// Text is captcha solution
|
||||||
Text string
|
Text string
|
||||||
|
@ -73,9 +73,9 @@ type Data struct {
|
||||||
img *image.NRGBA
|
img *image.NRGBA
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteTo encodes image data and writes to an io.Writer.
|
// WriteImage encodes image data and writes to an io.Writer.
|
||||||
// It returns possible error from PNG encoding
|
// It returns possible error from PNG encoding
|
||||||
func (data *Data) WriteTo(w io.Writer) error {
|
func (data *Data) WriteImage(w io.Writer) error {
|
||||||
return png.Encode(w, data.img)
|
return png.Encode(w, data.img)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ func TestNewCaptcha(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
data.WriteTo(buf)
|
data.WriteImage(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSmallCaptcha(t *testing.T) {
|
func TestSmallCaptcha(t *testing.T) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ func captchaHandle(w http.ResponseWriter, _ *http.Request) {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
img.WriteTo(w)
|
img.WriteImage(w)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mathHandle(w http.ResponseWriter, _ *http.Request) {
|
func mathHandle(w http.ResponseWriter, _ *http.Request) {
|
||||||
|
@ -44,5 +44,5 @@ func mathHandle(w http.ResponseWriter, _ *http.Request) {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
img.WriteTo(w)
|
img.WriteImage(w)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,5 +41,5 @@ func captchaHandle(w http.ResponseWriter, _ *http.Request) {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
img.WriteTo(w)
|
img.WriteImage(w)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
0.12.0 / 2017-10-07
|
||||||
|
===================
|
||||||
|
* Add FontDPI and FontScale options
|
||||||
|
|
||||||
0.11.0 / 2017-09-28
|
0.11.0 / 2017-09-28
|
||||||
===================
|
===================
|
||||||
* Add NewMathExpr API
|
* Add NewMathExpr API
|
||||||
|
|
Reference in New Issue