Esempio n. 1
0
func (this *ProcChainBuilder) getRotateProcessor(channel string, params map[string]string) (proc.ImageProcessor, error) {
	rotate, ok := params[":6"]
	if !ok {
		return nil, nil
	}

	rotateStr, err := data.GetRotates(channel)
	if err != nil {
		return nil, err
	}

	var checkstr = JoinString(",", rotate, ",")
	if !strings.Contains(rotateStr, checkstr) {
		opacitiesStr, err := data.GetDissolves(Hotel)
		if err != nil {
			return nil, err
		}
		if strings.Contains(opacitiesStr, checkstr) {
			return nil, nil
		} else {
			return nil, errors.New(JoinString("channel: ", channel, ", reason: not support rotate degree ", rotate))
		}
	}
	degress, err := strconv.ParseFloat(rotate, 64)
	if err != nil {
		return nil, err
	}
	return &proc.RotateProcessor{degress, this.Cat}, nil
}
Esempio n. 2
0
func (this *ProcChainBuilder) getLogoDissolve(channel string, params map[string]string) int {
	rotate, ok := params[":6"]
	if ok {
		dissolves, _ := data.GetDissolves(channel)
		if !strings.Contains(dissolves, JoinString(",", rotate, ",")) {
			return data.GetDissolve(channel)
		}
		dissolve, _ := strconv.Atoi(rotate)
		return dissolve
	} else {
		return data.GetDissolve(channel)
	}
}
Esempio n. 3
0
func (this *hotelrotatefeature) Process() (proc.ImageProcessor, bool, error) {
	rotateStr, err := data.GetRotates(Hotel)
	if err != nil {
		return nil, true, err
	}

	var checkstr = JoinString(",", strconv.FormatFloat(this.rotate, 'f', -1, 64), ",")
	if strings.Contains(rotateStr, checkstr) {
		return nil, true, nil
	}
	opacitiesStr, err := data.GetDissolves(Hotel)
	if err != nil {
		return nil, true, err
	}
	if strings.Contains(opacitiesStr, checkstr) {
		return nil, false, nil
	}
	return nil, false, errors.New(JoinString("channel: hotel, reason: not support rotate degree", strconv.FormatFloat(this.rotate, 'f', -1, 64)))
}