• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang imagick.NewPixelWand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/gographics/imagick/imagick.NewPixelWand函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPixelWand函数的具体用法?Golang NewPixelWand怎么用?Golang NewPixelWand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewPixelWand函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: textEffect4

// Text effect 4 - bevelled font http://www.imagemagick.org/Usage/fonts/#bevel
func textEffect4() {
	imagick.Initialize()
	defer imagick.Terminate()
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	// Create a 320x100 canvas
	pw.SetColor("gray")
	mw.NewImage(320, 100, pw)
	// Set up a 72 point font
	dw.SetFont("Verdana-Bold-Italic")
	dw.SetFontSize(72)
	// Set up a 72 point white font
	pw.SetColor("white")
	dw.SetFillColor(pw)
	// Now draw the text
	dw.Annotation(25, 65, "Magick")
	// Draw the image on to the mw
	mw.DrawImage(dw)
	// the "gray" parameter must be true to get the effect shown on Anthony's page
	mw.ShadeImage(true, 140, 60)
	pw.SetColor("yellow")
	dw.SetFillColor(pw)
	cpw := imagick.NewPixelWand()
	defer cpw.Destroy()
	cpw.SetColor("gold")
	mw.ColorizeImage(pw, cpw)
	// and write it
	mw.WriteImage("text_bevel.png")
}
开发者ID:jabong,项目名称:imagick,代码行数:34,代码来源:main.go


示例2: main

func main() {
	var err error
	imagick.Initialize()
	defer imagick.Terminate()
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	bg := imagick.NewPixelWand()
	defer bg.Destroy()
	fg := imagick.NewPixelWand()
	defer fg.Destroy()

	err = mw.ReadImage("http://www.imagemagick.org/Usage/images/cyclops_sm.gif")
	if err != nil {
		panic(err)
	}

	bg.SetColor("white")
	mw.BorderImage(bg, 1, 1)
	mw.SetImageAlphaChannel(imagick.ALPHA_CHANNEL_SET)

	fg.SetColor("none")
	channel := imagick.CHANNELS_RGB | imagick.CHANNEL_ALPHA

	// Floodfill the "background" colour with the "foreground" colour
	// starting at coordinate 0,0 using a fuzz of 20
	mw.FloodfillPaintImage(channel, fg, 20, bg, 0, 0, false)
	mw.ShaveImage(1, 1)

	mw.DisplayImage(os.Getenv("DISPLAY"))
	if err != nil {
		panic(err)
	}
}
开发者ID:niceeverything,项目名称:imagick,代码行数:33,代码来源:main.go


示例3: Screenshot

func (c Snappshot) Screenshot(res string) revel.Result {
	s := strings.Split(res, "x")
	width, _ := strconv.Atoi(s[0])
	height, _ := strconv.Atoi(s[1])
	imagick.Initialize()
	defer imagick.Terminate()

	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	cw := imagick.NewPixelWand()
	cw2 := imagick.NewPixelWand()

	cw.SetColor("darkgray")
	cw2.SetColor("white")
	mw.NewImage(uint(width), uint(height), cw)

	dw.SetTextAlignment(imagick.ALIGN_CENTER)
	dw.SetFillColor(cw2)
	dw.SetFontSize(150)
	cw2.SetColor("black")
	dw.SetStrokeColor(cw2)
	dw.Annotation(float64(width)/2, float64(height)/2, res)

	mw.DrawImage(dw)
	mw.SetImageFormat("jpg")
	output := mw.GetImageBlob()
	return JPGImage(output)
}
开发者ID:JustinJudd,项目名称:go_snappshot,代码行数:30,代码来源:snappshot.go


示例4: main

func main() {
	imagick.Initialize()
	defer imagick.Terminate()

	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	lw := imagick.NewMagickWand()
	defer lw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()

	// Create the initial 640x480 transparent canvas
	pw.SetColor("none")
	mw.NewImage(640, 480, pw)

	pw.SetColor("white")
	dw.SetFillColor(pw)
	dw.RoundRectangle(15, 15, 624, 464, 15, 15)
	mw.DrawImage(dw)

	lw.ReadImage("logo:")
	// Note that MagickSetImageCompose is usually only used for the MagickMontageImage
	// function and isn't used or needed by MagickCompositeImage
	mw.CompositeImage(lw, imagick.COMPOSITE_OP_SRC_IN, 0, 0)

	/* Write the new image */
	mw.WriteImage("mask_result.png")
}
开发者ID:palaiyacw,项目名称:imagick,代码行数:30,代码来源:main.go


示例5: textEffect7

// Text effect 7 - Polar distortion
func textEffect7() {
	imagick.Initialize()
	defer imagick.Terminate()
	// This one uses d_args[0]
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	// Create a 320x200 transparent canvas
	pw.SetColor("none")
	mw.NewImage(320, 200, pw)
	// Set up a 72 point font
	dw.SetFont("Verdana-Bold-Italic")
	dw.SetFontSize(72)
	// Now draw the text
	dw.Annotation(25, 65, "Magick")
	// Draw the image on to the mw
	mw.DrawImage(dw)
	d_args[0] = 0.0
	// DON'T FORGET to set the correct number of arguments here
	mw.DistortImage(imagick.DISTORTION_POLAR, d_args, true)
	//mw.ResetImagePage("")
	// Trim the image again
	mw.TrimImage(0)
	// Add the border
	pw.SetColor("none")
	mw.BorderImage(pw, 10, 10)
	// and write it
	mw.WriteImage("text_polar.png")
}
开发者ID:jabong,项目名称:imagick,代码行数:33,代码来源:main.go


示例6: textEffect3

// Text effect 3 -  arc font (similar to http://www.imagemagick.org/Usage/fonts/#arc)
func textEffect3() {
	imagick.Initialize()
	defer imagick.Terminate()
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	// Create a 320x100 lightblue canvas
	pw.SetColor("lightblue")
	mw.NewImage(320, 100, pw)
	// Set up a 72 point font
	dw.SetFont("Verdana-Bold-Italic")
	dw.SetFontSize(72)
	// Now draw the text
	dw.Annotation(25, 65, "Magick")
	// Draw the image on to the mw
	mw.DrawImage(dw)
	mw.DistortImage(imagick.DISTORTION_ARC, dargs, false)
	// Trim the image
	mw.TrimImage(0)
	// Add the border
	pw.SetColor("lightblue")
	mw.BorderImage(pw, 10, 10)
	// and write it
	mw.WriteImage("text_arc.png")
}
开发者ID:jabong,项目名称:imagick,代码行数:29,代码来源:main.go


示例7: getTextImage

func getTextImage(text string, size int) []byte {
	imagick.Initialize()
	defer imagick.Terminate()
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	l := len(text)
	w := size * 3 * (l + 6)
	h := size * 2
	pw.SetColor("none")
	mw.NewImage(uint(w), uint(h), pw)
	pw.SetColor("white")
	dw.SetFillColor(pw)
	dw.SetFont("/usr/share/fonts/default/TrueType/msyh.ttf")
	dw.SetFontSize(float64(size))
	dw.Annotation(0, float64(size), "ctrip © "+text)
	mw.DrawImage(dw)
	mw.TrimImage(0)

	mw.ResetImagePage("")
	cw := mw.Clone()
	pw.SetColor("black")
	mw.SetImageBackgroundColor(pw)
	mw.ShadowImage(100, 1, 0, 0)
	mw.CompositeImage(cw, imagick.COMPOSITE_OP_OVER, 1, 1)
	cw.Destroy()

	mw.SetImageFormat("PNG")
	return mw.GetImageBlob()
}
开发者ID:chenbk85,项目名称:nephele,代码行数:33,代码来源:text.go


示例8: draw_setfont

// Set up the drawingwand "dw" for the given font name, font size, and colour.
// If the font or size changes sx get the new width of a space
// (the magickwand is required if it is necessary to query the font metrics)
func draw_setfont(mw *imagick.MagickWand, dw *imagick.DrawingWand, font string, size float64, colour string, sx *float64) {
	sflag := false

	if len(font) > 0 {
		dw.SetFont(font)
		sflag = true
	}

	if len(colour) > 0 {
		pw := imagick.NewPixelWand()
		pw.SetColor(colour)
		dw.SetFillColor(pw)
		pw.Destroy()
		sflag = true
	}

	if size > 0 {
		dw.SetFontSize(size)
	}

	// If either the font or the fontsize (or both) have changed
	// we need to get the size of a space again
	if sflag {
		fm := mw.QueryFontMetrics(dw, " ")
		*sx = fm.TextWidth
	}
}
开发者ID:jabong,项目名称:imagick,代码行数:30,代码来源:main.go


示例9: textEffect2

// Text effect 2 - tiled text using the builtin checkerboard pattern
// Anthony's Tiled Font effect
func textEffect2() {
	imagick.Initialize()
	defer imagick.Terminate()
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	setTilePattern(dw, "#check", "pattern:checkerboard")
	pw.SetColor("lightblue")
	// Create a new transparent image
	mw.NewImage(320, 100, pw)
	// Set up a 72 point font
	dw.SetFont("Verdana-Bold-Italic")
	dw.SetFontSize(72)
	// Now draw the text
	dw.Annotation(28, 68, "Magick")
	// Draw the image on to the mw
	mw.DrawImage(dw)
	// Trim the image
	mw.TrimImage(0)
	// Add a transparent border
	pw.SetColor("lightblue")
	mw.BorderImage(pw, 5, 5)
	// and write it
	mw.WriteImage("text_pattern.png")
}
开发者ID:jabong,项目名称:imagick,代码行数:30,代码来源:main.go


示例10: textEffect5And6

// Text effect 5 and 6 - Plain text and then Barrel distortion
func textEffect5And6() {
	imagick.Initialize()
	defer imagick.Terminate()
	// This one uses d_args
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	// Create a 320x100 transparent canvas
	pw.SetColor("none")
	mw.NewImage(320, 100, pw)
	// Set up a 72 point font
	dw.SetFont("Verdana-Bold-Italic")
	dw.SetFontSize(72)
	// Now draw the text
	dw.Annotation(25, 65, "Magick")
	// Draw the image on to the mw
	mw.DrawImage(dw)
	mw.WriteImage("text_plain.png")
	// Trim the image
	mw.TrimImage(0)
	// Add the border
	pw.SetColor("none")
	mw.BorderImage(pw, 10, 10)
	//mw.SetImageMatte(true)
	//mw.SetImageVirtualPixelMethod(TransparentVirtualPixelMethod)
	// 	d_args[0] = 0.1;d_args[1] = -0.25;d_args[2] = -0.25; [3] += .1
	// The first value should be positive. If it is negative the image is *really* distorted
	d_args[0] = 0.0
	d_args[1] = 0.0
	d_args[2] = 0.5
	// d_args[3] should normally be chosen such the sum of all 4 values is 1
	// so that the result is the same size as the original
	// You can override the sum with a different value
	// If the sum is greater than 1 the resulting image will be smaller than the original
	d_args[3] = 1 - (d_args[0] + d_args[1] + d_args[2])
	// Make the result image smaller so that it isn't as likely
	// to overflow the edges
	// d_args[3] += 0.1
	// 0.0,0.0,0.5,0.5,0.0,0.0,-0.5,1.9
	d_args[3] = 0.5
	d_args[4] = 0.0
	d_args[5] = 0.0
	d_args[6] = -0.5
	d_args[7] = 1.9
	// DON'T FORGET to set the correct number of arguments here
	mw.DistortImage(imagick.DISTORTION_BARREL, d_args, true)
	//mw.ResetImagePage("")
	// Trim the image again
	mw.TrimImage(0)
	// Add the border
	pw.SetColor("none")
	mw.BorderImage(pw, 10, 10)
	// and write it
	mw.WriteImage("text_barrel.png")
}
开发者ID:jabong,项目名称:imagick,代码行数:59,代码来源:main.go


示例11: drawSetfont

func drawSetfont(mw *imagick.MagickWand, dw *imagick.DrawingWand) {
	dw.SetFont(randFont())
	pw := imagick.NewPixelWand()
	pw.SetColor(colors[rand.Intn(len(colors))])
	dw.SetFontWeight(500)
	dw.SetFillColor(pw)
	dw.SetFontSize(33)
	pw.Destroy()
}
开发者ID:npk,项目名称:captcha,代码行数:9,代码来源:image.go


示例12: proceedImages

func proceedImages(i []os.FileInfo) {
	imagick.Initialize()
	defer imagick.Terminate()

	green := imagick.NewPixelWand()
	green.SetColor("#1cd000")
	none := imagick.NewPixelWand()
	none.SetColor("none")
	channel := imagick.CHANNEL_OPACITY
	for _, f := range i {
		importImage := imagick.NewMagickWand()
		importImage.ReadImage("./images/" + f.Name())
		importImage.FloodfillPaintImage(channel, none, 20000, green, 0, 0, false)
		importImage.WriteImage("imagesDone/" + f.Name())
		importImage.Destroy()
	}
	green.Destroy()
	none.Destroy()
}
开发者ID:youaresofunny,项目名称:goalphamaker,代码行数:19,代码来源:imgtests.go


示例13: encodeImageMagick

// Encode image to file (ImageMagick)
func (c *Convertor) encodeImageMagick(i image.Image, filename string) (err error) {
	imagick.Initialize()

	mw := imagick.NewMagickWand()
	defer mw.Destroy()

	err = mw.ReadImageBlob(c.GetImageBytes(i))
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error ReadImageBlob: %v\n", err.Error())
		return
	}

	if c.Opts.Grayscale {
		c := mw.GetImageColors()
		mw.QuantizeImage(c, imagick.COLORSPACE_GRAY, 8, true, true)
	}

	switch filepath.Ext(filename) {
	case ".png":
		mw.SetImageFormat("PNG")
		mw.WriteImage(filename)
	case ".tif":
	case ".tiff":
		mw.SetImageFormat("TIFF")
		mw.WriteImage(filename)
	case ".gif":
		mw.SetImageFormat("GIF")
		mw.WriteImage(filename)
	case ".bmp":
		w := imagick.NewPixelWand()
		w.SetColor("black")
		defer w.Destroy()

		cs := mw.GetImageColorspace()
		if c.Opts.Grayscale {
			cs = imagick.COLORSPACE_GRAY
		}

		mw.SetImageFormat("BMP3")
		mw.SetImageBackgroundColor(w)
		mw.SetImageAlphaChannel(imagick.ALPHA_CHANNEL_REMOVE)
		mw.SetImageAlphaChannel(imagick.ALPHA_CHANNEL_DEACTIVATE)
		mw.SetImageMatte(false)
		mw.SetImageCompression(imagick.COMPRESSION_NO)
		mw.QuantizeImage(16, cs, 8, true, true)
		mw.WriteImage(filename)
	default:
		mw.SetImageFormat("JPEG")
		mw.WriteImage(filename)
	}

	return
}
开发者ID:gen2brain,项目名称:cbconvert,代码行数:54,代码来源:cbconvert.go


示例14: save

func (pxd pixelData) save(dest string) error {

	bg := imagick.NewPixelWand()
	bg.SetColor("#E82A33")
	mw := imagick.NewMagickWand()
	mw.NewImage(uint(pxd.blockSize*pxd.columns), 1080, bg)
	mw.SetImageFormat("png")
	mw.DrawImage(pxd.wands.dw)
	mw.SetAntialias(false)
	err := mw.WriteImage(dest)

	return err
}
开发者ID:rmfarrell,项目名称:pix-vid,代码行数:13,代码来源:main.go


示例15: textEffect1

// Text effect 1 - shadow effect using MagickShadowImage
// NOTE - if an image has a transparent background, adding a border of any colour other
// than "none" will remove all the transparency and replace it with the border's colour
func textEffect1() {
	imagick.Initialize()
	defer imagick.Terminate()
	mw := imagick.NewMagickWand()
	defer mw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	pw.SetColor("none")
	// Create a new transparent image
	mw.NewImage(350, 100, pw)
	// Set up a 72 point white font
	pw.SetColor("white")
	dw.SetFillColor(pw)
	dw.SetFont("Verdana-Bold-Italic")
	dw.SetFontSize(72)
	// Add a black outline to the text
	pw.SetColor("black")
	dw.SetStrokeColor(pw)
	// Turn antialias on - not sure this makes a difference
	dw.SetTextAntialias(true)
	// Now draw the text
	dw.Annotation(25, 65, "Magick")
	// Draw the image on to the mw
	mw.DrawImage(dw)
	// Trim the image down to include only the text
	mw.TrimImage(0)
	// equivalent to the command line +repage
	mw.ResetImagePage("")
	// Make a copy of the text image
	cw := mw.Clone()
	// Set the background colour to blue for the shadow
	pw.SetColor("blue")
	mw.SetImageBackgroundColor(pw)
	// Opacity is a real number indicating (apparently) percentage
	mw.ShadowImage(70, 4, 5, 5)
	// Composite the text on top of the shadow
	mw.CompositeImage(cw, imagick.COMPOSITE_OP_OVER, 5, 5)
	cw.Destroy()
	cw = imagick.NewMagickWand()
	defer cw.Destroy()
	// Create a new image the same size as the text image and put a solid colour
	// as its background
	pw.SetColor("rgb(125,215,255)")
	cw.NewImage(mw.GetImageWidth(), mw.GetImageHeight(), pw)
	// Now composite the shadowed text over the plain background
	cw.CompositeImage(mw, imagick.COMPOSITE_OP_OVER, 0, 0)
	// and write the result
	cw.WriteImage("text_shadow.png")
}
开发者ID:jabong,项目名称:imagick,代码行数:54,代码来源:main.go


示例16: main

func main() {
	imagick.Initialize()
	defer imagick.Terminate()

	var err error

	mw := imagick.NewMagickWand()
	defer mw.Destroy()

	// fillcolor and bordercolor
	fc, bc := imagick.NewPixelWand(), imagick.NewPixelWand()
	defer fc.Destroy()
	defer bc.Destroy()

	fc.SetColor("none")
	bc.SetColor("white")

	err = mw.ReadImage("logo:")
	if err != nil {
		panic(err)
	}

	rgba := imagick.CHANNELS_RGB | imagick.CHANNEL_ALPHA

	// The bordercolor (with fuzz of 20 applied) is replaced by the fill
	// colour starting at the given coordinate - in this case 0, 0.
	// Normally the last argument is false so that the colours are matched
	// but if it is true then it floodfills any pixel that does *not* match
	// the target color
	mw.FloodfillPaintImage(rgba, fc, 20, bc, 0, 0, false)

	mw.DisplayImage(os.Getenv("DYSPLAY"))
	if err != nil {
		panic(err)
	}
}
开发者ID:palaiyacw,项目名称:imgry,代码行数:36,代码来源:main.go


示例17: createMask

func createMask(d uint, r float64) (mask *imagick.MagickWand) {
	mask = imagick.NewMagickWand()

	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	dw := imagick.NewDrawingWand()
	defer dw.Destroy()

	pw.SetColor("none")
	mask.NewImage(d, d, pw)
	pw.SetColor("white")
	dw.SetFillColor(pw)
	dw.Circle(r, r, r-1, r*2-1)
	mask.DrawImage(dw)

	return
}
开发者ID:cema-sp,项目名称:twinkle,代码行数:17,代码来源:splitter.go


示例18: PixelVectorToImage

func PixelVectorToImage(imgVector []float64, width, height int) []byte {

	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	pw.SetColor("white")

	mw := imagick.NewMagickWand()
	defer mw.Destroy()

	// Create a 100x100 image with a default of white
	mw.NewImage(uint(width), uint(height), pw)
	mw.SetImageFormat("jpeg")

	// Get a new pixel iterator
	iterator := mw.NewPixelIterator()
	defer iterator.Destroy()
	pixelIndex := 0
	for y := 0; y < int(mw.GetImageHeight()); y++ {
		// Get the next row of the image as an array of PixelWands
		pixels := iterator.GetNextIteratorRow()
		if len(pixels) == 0 {
			break
		}
		// Set the row of wands to a simple gray scale gradient
		for _, pixel := range pixels {
			if !pixel.IsVerified() {
				panic("unverified pixel")
			}
			gray := imgVector[pixelIndex]

			hex := fmt.Sprintf("#%02x%02x%02x", int(gray), int(gray), int(gray))
			if ret := pixel.SetColor(hex); !ret {
				panic("Could not set color in pixel")
			}
			pixelIndex++
		}

		// Sync writes the pixels back to the mw
		if err := iterator.SyncIterator(); err != nil {
			panic(err)
		}
	}
	return mw.GetImageBlob()
}
开发者ID:postfix,项目名称:gofaces,代码行数:44,代码来源:imageHelper.go


示例19: main

func main() {
	imagick.Initialize()
	defer imagick.Terminate()

	pw := imagick.NewPixelWand()
	defer pw.Destroy()
	pw.SetColor("white")

	mw := imagick.NewMagickWand()
	defer mw.Destroy()

	// Create a 100x100 image with a default of white
	mw.NewImage(100, 100, pw)

	// Get a new pixel iterator
	iterator := mw.NewPixelIterator()
	defer iterator.Destroy()

	for y := 0; y < int(mw.GetImageHeight()); y++ {
		// Get the next row of the image as an array of PixelWands
		pixels := iterator.GetNextIteratorRow()
		if len(pixels) == 0 {
			break
		}
		// Set the row of wands to a simple gray scale gradient
		for x, pixel := range pixels {
			if !pixel.IsVerified() {
				panic("unverified pixel")
			}
			gray := x * 255 / 100
			hex := fmt.Sprintf("#%02x%02x%02x", gray, gray, gray)
			if ret := pixel.SetColor(hex); !ret {
				panic("Could not set color in pixel")
			}
		}
		// Sync writes the pixels back to the mw
		if err := iterator.SyncIterator(); err != nil {
			panic(err)
		}
	}

	mw.WriteImage("bits_demo.gif")
}
开发者ID:jabong,项目名称:imagick,代码行数:43,代码来源:main.go


示例20: speedLine

func speedLine(mw *imagick.MagickWand, aw *imagick.MagickWand) error {
	cols, rows := mw.GetImageHeight(), mw.GetImageWidth()

	dw := imagick.NewDrawingWand()
	defer dw.Destroy()
	cw := imagick.NewPixelWand()
	cw.SetColor(*color)
	dw.SetFillColor(cw)

	center := []float64{float64(rows) / 2.0, float64(cols) / 2.0}
	const radiusCenter float64 = 0.75
	const step float64 = 0.02
	const bold float64 = 1.0
	var theeta float64

	for theeta < math.Pi*2 {
		stepNoise := rand.Float64() + 0.5
		theeta += step * stepNoise
		radiusCenterNoise := rand.Float64()*0.3 + 1.0
		boldNoise := rand.Float64() + 0.7 + 0.3

		point0 := imagick.PointInfo{
			X: math.Sin(theeta)*center[0]*radiusCenter*radiusCenterNoise + center[0],
			Y: math.Cos(theeta)*center[1]*radiusCenter*radiusCenterNoise + center[1],
		}
		point1 := imagick.PointInfo{
			X: math.Sin(theeta)*center[0]*2 + center[0],
			Y: math.Cos(theeta)*center[1]*2 + center[1],
		}
		point2 := imagick.PointInfo{
			X: math.Sin(theeta+step*bold*boldNoise)*center[0]*2 + center[0],
			Y: math.Cos(theeta+step*bold*boldNoise)*center[1]*2 + center[1],
		}

		dw.Polygon([]imagick.PointInfo{point0, point1, point2})
	}

	if err := aw.DrawImage(dw); err != nil {
		return err
	}

	return nil
}
开发者ID:ephemeralsnow,项目名称:speedline,代码行数:43,代码来源:speedline.go



注:本文中的github.com/gographics/imagick/imagick.NewPixelWand函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang imagick.Terminate函数代码示例发布时间:2022-05-23
下一篇:
Golang imagick.NewMagickWand函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap