-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
167 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exclude: | ||
- /cmd/zplgfa/.* | ||
languages: | ||
- go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
*.zpl | ||
cmd/zplgfa/*.png | ||
cmd/zplgfa/zplgfa | ||
zplgfa.coverprofile | ||
coverage.html | ||
test.zpl.bin* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package main | ||
|
||
import ( | ||
"image" | ||
"image/color" | ||
"math" | ||
) | ||
|
||
type imageSet interface { | ||
Set(x, y int, c color.Color) | ||
} | ||
|
||
func editImageInvert(img image.Image) image.Image { | ||
b := img.Bounds() | ||
|
||
imgSet := img.(imageSet) | ||
for y := b.Min.Y; y < b.Max.Y; y++ { | ||
for x := b.Min.X; x < b.Max.X; x++ { | ||
oldPixel := img.At(x, y) | ||
r, g, b, a := oldPixel.RGBA() | ||
r = 65535 - r | ||
g = 65535 - g | ||
b = 65535 - b | ||
pixel := color.RGBA{uint8(r), uint8(g), uint8(b), uint8(a)} | ||
imgSet.Set(x, y, pixel) | ||
} | ||
} | ||
return img | ||
} | ||
|
||
func editImageMonochrome(img image.Image) image.Image { | ||
b := img.Bounds() | ||
|
||
imgSet := img.(imageSet) | ||
for y := b.Min.Y; y < b.Max.Y; y++ { | ||
for x := b.Min.X; x < b.Max.X; x++ { | ||
oldPixel := img.At(x, y) | ||
r, g, b, a := oldPixel.RGBA() | ||
if r > math.MaxUint16/2 || g > math.MaxUint16/2 || b > math.MaxUint16/2 { | ||
r, g, b = 65535, 65535, 65535 | ||
} else { | ||
r, g, b = 0, 0, 0 | ||
} | ||
pixel := color.RGBA{uint8(r), uint8(g), uint8(b), uint8(a)} | ||
imgSet.Set(x, y, pixel) | ||
} | ||
} | ||
return img | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
) | ||
|
||
func sendDataToZebra(ip, port, str string) error { | ||
tcpAddr, err := net.ResolveTCPAddr("tcp", ip+":"+port) | ||
conn, err := net.DialTCP("tcp4", nil, tcpAddr) | ||
if err == nil { | ||
defer conn.Close() | ||
|
||
payloadBytes := []byte(fmt.Sprintf("%s\r\n\r\n", str)) | ||
_, err = conn.Write(payloadBytes) | ||
return err | ||
} | ||
return err | ||
} | ||
|
||
func sendFeedCmdToZebra(ip, port string) error { | ||
return sendDataToZebra(ip, port, "^xa^aa^fd ^fs^xz") | ||
} | ||
|
||
func sendCalibCmdToZebra(ip, port string) error { | ||
return sendDataToZebra(ip, port, "~jc^xa^jus^xz") | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters