Beispiel #1
0
func newImageVersion(filename, contentType string, sourceRect image.Rectangle, width, height int, grayscale bool) ImageVersion {
	version := ImageVersion{
		Filename:    model.String(filename),
		ContentType: model.String(contentType),
		Width:       model.Int(width),
		Height:      model.Int(height),
		Grayscale:   model.Bool(grayscale),
	}
	version.SourceRect.SetRectangle(sourceRect)
	return version
}
Beispiel #2
0
func (self *Image) addVersion(filename, contentType string, sourceRect image.Rectangle, width, height int, grayscale bool) *ImageVersion {
	version := ImageVersion{
		image:       self,
		Filename:    model.String(filename),
		ContentType: model.String(contentType),
		Width:       model.Int(width),
		Height:      model.Int(height),
		Grayscale:   model.Bool(grayscale),
	}
	version.SourceRect.SetRectangle(sourceRect)
	self.Versions = append(self.Versions, version)
	return &self.Versions[len(self.Versions)-1]
}