github.com/signintech/pdft@v0.5.0/minigopdf/current.go (about) 1 package gopdf 2 3 // Current current state 4 type Current struct { 5 setXCount int //many times we go func SetX() 6 X float64 7 Y float64 8 9 //font 10 IndexOfFontObj int 11 CountOfFont int 12 CountOfL int 13 14 Font_Size int 15 Font_Style int // Regular|Bold|Italic|Underline 16 Font_FontCount int 17 Font_Type int // CURRENT_FONT_TYPE_IFONT or CURRENT_FONT_TYPE_SUBSET 18 19 Font_ISubset *SubsetFontObj // Font_Type == CURRENT_FONT_TYPE_SUBSET 20 21 //page 22 IndexOfPageObj int 23 24 //img 25 CountOfImg int 26 //cache of image in pdf file 27 ImgCaches []ImageCache 28 29 //text color 30 txtColor Rgb 31 32 //text grayscale 33 grayFill float64 34 //draw grayscale 35 grayStroke float64 36 37 lineWidth float64 38 39 //current page size 40 pageSize Rect 41 } 42 43 func (c *Current) setTextColor(rgb Rgb) { 44 c.txtColor = rgb 45 } 46 47 func (c *Current) textColor() Rgb { 48 return c.txtColor 49 } 50 51 type ImageCache struct { 52 Path string //ID or Path 53 Index int 54 Rect *Rect 55 } 56 57 // Rgb rgb color 58 type Rgb struct { 59 r uint8 60 g uint8 61 b uint8 62 } 63 64 // SetR set red 65 func (rgb *Rgb) SetR(r uint8) { 66 rgb.r = r 67 } 68 69 // SetG set green 70 func (rgb *Rgb) SetG(g uint8) { 71 rgb.g = g 72 } 73 74 // SetB set blue 75 func (rgb *Rgb) SetB(b uint8) { 76 rgb.b = b 77 } 78 79 func (rgb Rgb) equal(obj Rgb) bool { 80 if rgb.r == obj.r && rgb.g == obj.g && rgb.b == obj.b { 81 return true 82 } 83 return false 84 }