Documentation ¶
Overview ¶
Copyright © 2021 Brian Longmore branodev@gmail.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func DrawPixels(c DrawConfig) (string, error)
- func GetFileByPath(filePath string) (io.ReadCloser, error)
- func GetFileByUrl(url string) (io.ReadCloser, error)
- func OutputImage(c OutputConfig) (string, error)
- func ProcessFilePath(filePath string) string
- func ProcessImage(c ProcessConfig) (image.Image, int, int, error)
- func ScaleValue(value, lowerI, upperI, lowerF, upperF float64) (int, error)
- type DrawConfig
- type OutputConfig
- type ProcessConfig
Constants ¶
const ( DefaultMode = "ascii" DefaultPattern = " .,:(/*%&#@" DefaultWidth = 100 )
Variables ¶
This section is empty.
Functions ¶
func DrawPixels ¶
func DrawPixels(c DrawConfig) (string, error)
DrawPixels is the low level method for generating a print. It typically uses inputs that would be returned by ProcessImage and is called by OutputImage.
func GetFileByPath ¶ added in v1.25.0
func GetFileByPath(filePath string) (io.ReadCloser, error)
GetFileByPath returns the file contents from filePath. Make sure you close the file after calling.
func GetFileByUrl ¶ added in v1.25.0
func GetFileByUrl(url string) (io.ReadCloser, error)
GetFileByUrl returns the http response body from url. Make sure you close the body after calling.
func OutputImage ¶
func OutputImage(c OutputConfig) (string, error)
OutputImage is the high level and preferred method for generating a print. It calls both ProcessImage and OutputImage.
func ProcessFilePath ¶ added in v1.25.0
ProcessFilePath returns the path of a unique destination file in the directory of filePath. If filePath does not already exist, it will just return filePath. Otherwise it would return a unique path in the form of "n_fileName" where n is a positive integer.
func ProcessImage ¶
ProcessImage returns the decoded image and its new dimensions. It is called by OutputImage.
func ScaleValue ¶
ScaleValue takes value and transforms(translation and scaling) it according to its new, transformed bounds.