Пример #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
}
Пример #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]
}
Пример #3
0
func (self *ModelRect) SetRectangle(r image.Rectangle) {
	self.MinX = model.Int(r.Min.X)
	self.MinY = model.Int(r.Min.Y)
	self.MaxX = model.Int(r.Max.X)
	self.MaxY = model.Int(r.Max.Y)
}