<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # package color `import "image/color"` color包實現了基本色彩庫。 ## Index * [Variables](#pkg-variables) * [type Color](#Color) * [type Model](#Model) * [func ModelFunc(f func(Color) Color) Model](#ModelFunc) * [type Alpha](#Alpha) * [func (c Alpha) RGBA() (r, g, b, a uint32)](#Alpha.RGBA) * [type Alpha16](#Alpha16) * [func (c Alpha16) RGBA() (r, g, b, a uint32)](#Alpha16.RGBA) * [type Gray](#Gray) * [func (c Gray) RGBA() (r, g, b, a uint32)](#Gray.RGBA) * [type Gray16](#Gray16) * [func (c Gray16) RGBA() (r, g, b, a uint32)](#Gray16.RGBA) * [type RGBA](#RGBA) * [func (c RGBA) RGBA() (r, g, b, a uint32)](#RGBA.RGBA) * [type RGBA64](#RGBA64) * [func (c RGBA64) RGBA() (r, g, b, a uint32)](#RGBA64.RGBA) * [type NRGBA](#NRGBA) * [func (c NRGBA) RGBA() (r, g, b, a uint32)](#NRGBA.RGBA) * [type NRGBA64](#NRGBA64) * [func (c NRGBA64) RGBA() (r, g, b, a uint32)](#NRGBA64.RGBA) * [type YCbCr](#YCbCr) * [func (c YCbCr) RGBA() (uint32, uint32, uint32, uint32)](#YCbCr.RGBA) * [type Palette](#Palette) * [func (p Palette) Convert(c Color) Color](#Palette.Convert) * [func (p Palette) Index(c Color) int](#Palette.Index) * [func RGBToYCbCr(r, g, b uint8) (uint8, uint8, uint8)](#RGBToYCbCr) * [func YCbCrToRGB(y, cb, cr uint8) (uint8, uint8, uint8)](#YCbCrToRGB) ## Variables ``` var ( Black = Gray16{0} // 黑色 White = Gray16{0xffff} // 白色 Transparent = Alpha16{0} // 完全透明 Opaque = Alpha16{0xffff} // 完全不透明 ) ``` 標準色彩。 ## type [Color](https://github.com/golang/go/blob/master/src/image/color/color.go#L10 "View Source") ``` type Color interface { // 方法返回預乘了alpha的紅、綠、藍色彩值和alpha通道值,范圍都在[0, 0xFFFF]。 // 返回值類型為uint32,這樣當乘以接近0xFFFF的混合參數時,不會溢出。 RGBA() (r, g, b, a uint32) } ``` 實現了Color接口的類型可以將自身轉化為預乘了alpha的16位通道的RGBA,轉換可能會丟失色彩信息。 ## type [Model](https://github.com/golang/go/blob/master/src/image/color/color.go#L133 "View Source") ``` type Model interface { Convert(c Color) Color } ``` Model接口可以將任意Color接口轉換為采用自身色彩模型的Color接口。轉換可能會丟失色彩信息。 ``` var ( RGBAModel Model = ModelFunc(rgbaModel) RGBA64Model Model = ModelFunc(rgba64Model) NRGBAModel Model = ModelFunc(nrgbaModel) NRGBA64Model Model = ModelFunc(nrgba64Model) AlphaModel Model = ModelFunc(alphaModel) Alpha16Model Model = ModelFunc(alpha16Model) GrayModel Model = ModelFunc(grayModel) Gray16Model Model = ModelFunc(gray16Model) ) ``` Models接口返回標準的Color接口類型。 ``` var YCbCrModel Model = ModelFunc(yCbCrModel) ``` 包變量YcbCrModel是Y'cbCr色彩模型的Model接口。 ### func [ModelFunc](https://github.com/golang/go/blob/master/src/image/color/color.go#L138 "View Source") ``` func ModelFunc(f func(Color) Color) Model ``` 函數ModelFunc返回一個調用函數f實現色彩轉換的Model接口。 ## type [Alpha](https://github.com/golang/go/blob/master/src/image/color/color.go#L90 "View Source") ``` type Alpha struct { A uint8 } ``` Alpha類型代表一個8位的alpha通道(alpha通道表示透明度)。 ### func (Alpha) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L94 "View Source") ``` func (c Alpha) RGBA() (r, g, b, a uint32) ``` ## type [Alpha16](https://github.com/golang/go/blob/master/src/image/color/color.go#L101 "View Source") ``` type Alpha16 struct { A uint16 } ``` Alpha16類型代表一個16位的alpha通道。 ### func (Alpha16) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L105 "View Source") ``` func (c Alpha16) RGBA() (r, g, b, a uint32) ``` ## type [Gray](https://github.com/golang/go/blob/master/src/image/color/color.go#L111 "View Source") ``` type Gray struct { Y uint8 } ``` Gray類型代表一個8位的灰度色彩。 ### func (Gray) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L115 "View Source") ``` func (c Gray) RGBA() (r, g, b, a uint32) ``` ## type [Gray16](https://github.com/golang/go/blob/master/src/image/color/color.go#L122 "View Source") ``` type Gray16 struct { Y uint16 } ``` Gray16類型代表一個16位的灰度色彩。 ### func (Gray16) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L126 "View Source") ``` func (c Gray16) RGBA() (r, g, b, a uint32) ``` ## type [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L20 "View Source") ``` type RGBA struct { R, G, B, A uint8 } ``` RGBA類型代表傳統的預乘了alpha通道的32位RGB色彩,Red、Green、Blue、Alpha各8位。 ### func (RGBA) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L24 "View Source") ``` func (c RGBA) RGBA() (r, g, b, a uint32) ``` ## type [RGBA64](https://github.com/golang/go/blob/master/src/image/color/color.go#L38 "View Source") ``` type RGBA64 struct { R, G, B, A uint16 } ``` RGBA64類型代表預乘了alpha通道的64位RGB色彩,Red、Green、Blue、Alpha各16位。 ### func (RGBA64) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L42 "View Source") ``` func (c RGBA64) RGBA() (r, g, b, a uint32) ``` ## type [NRGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L47 "View Source") ``` type NRGBA struct { R, G, B, A uint8 } ``` NRGBA類型代表沒有預乘alpha通道的32位RGB色彩,Red、Green、Blue、Alpha各8位。 ### func (NRGBA) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L51 "View Source") ``` func (c NRGBA) RGBA() (r, g, b, a uint32) ``` ## type [NRGBA64](https://github.com/golang/go/blob/master/src/image/color/color.go#L71 "View Source") ``` type NRGBA64 struct { R, G, B, A uint16 } ``` NRGBA64類型代表沒有預乘alpha通道的64位RGB色彩,Red、Green、Blue、Alpha各16位。 ### func (NRGBA64) [RGBA](https://github.com/golang/go/blob/master/src/image/color/color.go#L75 "View Source") ``` func (c NRGBA64) RGBA() (r, g, b, a uint32) ``` ## type [YCbCr](https://github.com/golang/go/blob/master/src/image/color/ycbcr.go#L80 "View Source") ``` type YCbCr struct { Y, Cb, Cr uint8 } ``` YcbCr代表完全不透明的24位Y'CbCr色彩;每個色彩都有1個亮度成分和2個色度成分,分別用8位字節表示。 JPEG、VP8、MPEG家族和其他編碼方式使用本色彩模型。這些編碼通常將Y'CbCr?和YUV兩個色彩模型等同使用(Y=Y'=黃、U=Cb=青、V=Cr=品紅)。但嚴格來說,YUV模只用于模擬視頻信號,Y'是經過伽瑪校正的Y。RGB和Y'CbCr色彩模型之間的轉換會丟失色彩信息。兩個色彩模型之間的轉換有多個存在細微區別的算法。本包采用JFIF算法,參見[http://www.w3.org/Graphics/JPEG/jfif3.pdf](http://www.w3.org/Graphics/JPEG/jfif3.pdf) ### func (YCbCr) [RGBA](https://github.com/golang/go/blob/master/src/image/color/ycbcr.go#L84 "View Source") ``` func (c YCbCr) RGBA() (uint32, uint32, uint32, uint32) ``` ## type [Palette](https://github.com/golang/go/blob/master/src/image/color/color.go#L254 "View Source") ``` type Palette []Color ``` Palette類型代表一個色彩的調色板。 ### func (Palette) [Convert](https://github.com/golang/go/blob/master/src/image/color/color.go#L257 "View Source") ``` func (p Palette) Convert(c Color) Color ``` 返回調色板中與色彩c在歐幾里德RGB色彩空間最接近的色彩。(實現了Model接口) ### func (Palette) [Index](https://github.com/golang/go/blob/master/src/image/color/color.go#L266 "View Source") ``` func (p Palette) Index(c Color) int ``` 返回調色板中與色彩c在歐幾里德RGB色彩空間最接近的色彩的索引。 ## func [RGBToYCbCr](https://github.com/golang/go/blob/master/src/image/color/ycbcr.go#L8 "View Source") ``` func RGBToYCbCr(r, g, b uint8) (uint8, uint8, uint8) ``` 函數將RGB三原色轉換為Y'CbCr三原色。 ## func [YCbCrToRGB](https://github.com/golang/go/blob/master/src/image/color/ycbcr.go#L39 "View Source") ``` func YCbCrToRGB(y, cb, cr uint8) (uint8, uint8, uint8) ``` 函數將Y'CbCr三原色轉換為RGB三原色。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看