Exemplo n.º 1
0
func runPxl(cmd *Command, args []string) {
	i := utils.ReadStdin()

	triangle := pixelate.BOTH
	if pxlLeft {
		triangle = pixelate.LEFT
	}
	if pxlRight {
		triangle = pixelate.RIGHT
	}

	if pxlRows > 0 && pxlCols > 0 {
		pxlSize = utils.SizeForRowsAndCols(i, pxlRows, pxlCols)
	} else if pxlRows > 0 {
		pxlSize = utils.SizeForRows(i, pxlRows)
	} else if pxlCols > 0 {
		pxlSize = utils.SizeForCols(i, pxlCols)
	}

	if pxlAlias {
		i = pixelate.AliasedPxl(i, pxlSize, triangle)
	} else {
		i = pixelate.Pxl(i, pxlSize, triangle)
	}

	utils.WriteStdout(i)
}
Exemplo n.º 2
0
func runVxl(cmd *Command, args []string) {
	i := utils.ReadStdin()

	if vxlRows > 0 {
		vxlHeight = utils.SizeForRows(i, vxlRows).H
	}

	i = pixelate.Vxl(i, vxlHeight, vxlFlip, vxlTop, vxlLeft, vxlRight)
	utils.WriteStdout(i)
}
Exemplo n.º 3
0
func runPixelate(cmd *Command, args []string) {
	i := utils.ReadStdin()

	if pixelateRows > 0 && pixelateCols > 0 {
		pixelateSize = utils.SizeForRowsAndCols(i, pixelateRows, pixelateCols)
	} else if pixelateRows > 0 {
		pixelateSize = utils.SizeForRows(i, pixelateRows)
	} else if pixelateCols > 0 {
		pixelateSize = utils.SizeForCols(i, pixelateCols)
	}

	i = pixelate.Pixelate(i, pixelateSize)
	utils.WriteStdout(i)
}