<commit_before>package drawer

import (
	"fmt"
	"image"
	"image/color"
	"image/draw"
)

type RectDrawer struct {
	color     color.Color
	rect      image.Rectangle
	img       draw.Image
	thickness int
	isFilled  bool
}

// Draws rect in color onto img.  rect must be well-formed (see Rectangle.Canon()).
func NewRectDrawer(img draw.Image, rect image.Rectangle, color color.Color) *RectDrawer {
	fmt.Println("Creating new RectDrawer")
	return &RectDrawer{color: color, rect: rect, img: img, thickness: 1, isFilled: false}
}

func (this *RectDrawer) SetImage(img draw.Image) *RectDrawer {
	this.img = img
	return this
}

func (this *RectDrawer) SetRect(rect image.Rectangle) *RectDrawer {
	this.rect = rect
	return this
}

func (this *RectDrawer) SetThickness(thickness int) *RectDrawer {
	this.thickness = thickness
	return this
}

func (this *RectDrawer) SetFilled(isFilled bool) *RectDrawer {
	this.isFilled = isFilled
	return this
}

func (this *RectDrawer) Draw() *RectDrawer {

	thickX := this.thickness

	// Even if the thickness is greater than the size of the rectangle,
	// it should still stay within the rectangle.
	if this.isFilled || thickX > (this.rect.Max.X-this.rect.Min.X)+1 {
		thickX = (this.rect.Max.X-this.rect.Min.X)/2 + 1
	}

	for y := this.rect.Min.Y; y < this.rect.Max.Y; y++ {
		for t := 0; t < thickX; t++ {
			this.img.Set(this.rect.Min.X+t, y, this.color)
			this.img.Set(this.rect.Max.X-1-t, y, this.color)
		}
	}

	if this.isFilled {
		return this
	}<commit_msg>Add setColor to Rect<commit_after>package drawer

import (
	"fmt"
	"image"
	"image/color"
	"image/draw"
)

type RectDrawer struct {
	color     color.Color
	rect      image.Rectangle
	img       draw.Image
	thickness int
	isFilled  bool
}

// Draws rect in color onto img.  rect must be well-formed (see Rectangle.Canon()).
func NewRectDrawer(img draw.Image, rect image.Rectangle, color color.Color) *RectDrawer {
	fmt.Println("Creating new RectDrawer")
	return &RectDrawer{color: color, rect: rect, img: img, thickness: 1, isFilled: false}
}

func (this *RectDrawer) SetImage(img draw.Image) *RectDrawer {
	this.img = img
	return this
}

func (this *RectDrawer) SetRect(rect image.Rectangle) *RectDrawer {
	this.rect = rect
	return this
}

func (this *RectDrawer) SetThickness(thickness int) *RectDrawer {
	this.thickness = thickness
	return this
}

func (this *RectDrawer) SetFilled(isFilled bool) *RectDrawer {
	this.isFilled = isFilled
	return this
}

func (this *RectDrawer) SetColor(color color.Color) *RectDrawer {
	this.color = color
	return this
}

func (this *RectDrawer) Draw() *RectDrawer {

	thickX := this.thickness

	// Even if the thickness is greater than the size of the rectangle,
	// it should still stay within the rectangle.
	if this.isFilled || thickX > (this.rect.Max.X-this.rect.Min.X)+1 {
		thickX = (this.rect.Max.X-this.rect.Min.X)/2 + 1
	}

	for y := this.rect.Min.Y; y < this.rect.Max.Y; y++ {
		for t := 0; t < thickX; t++ {
			this.img.Set(this.rect.Min.X+t, y, this.color)
			this.img.Set(this.rect.Max.X-1-t, y, this.color)
		}
	}

	if this.isFilled {
		return this
	}
{'fraction_non_alphanumeric': 0.12843739890003236, 'fraction_numerical': 0.0038822387576835974, 'mean_word_length': 3.6426426426426426, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1603434', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1157, 'n_words': 311}