乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      TColor與RGB分量的關(guān)系及轉(zhuǎn)換函數(shù)(巧用$來把16進制轉(zhuǎn)10進制)

       aaie_ 2012-08-08

      幫助文檔中對Tcolor的說明如下:

      If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green, and red, respectively. The value $00FF0000 (Delphi) or 0x00FF0000 (C++) represents full-intensity, pure blue, $0000FF00 (Delphi) or 0x0000FF00 (C++) is pure green, and $000000FF (Delphi) or 0x000000FF (C++) is pure red. $00000000 (Delphi) or 0x00000000 (C++) is black and $00FFFFFF (Delphi) or 0x00FFFFFF (C++) is white.

      TColor 值是以十六進制進行存儲的,低三位分別表示紅、綠、藍三色,就像例子中所說$000000FF紅,$0000FF00綠,$00FF0000藍。

      知道其結(jié)構(gòu)組成后由Tcolor轉(zhuǎn)到RGB的分量就非常簡單了。

      這里用到字符串處理函數(shù),十六進制轉(zhuǎn)十進制函數(shù)等(這個轉(zhuǎn)化比較巧妙!)……

       

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      function getRGBText(AColor:TColor):string;
      var
      sHexRGBResult:string;//$00FF8080為固定格式
      sR,sG,sB:string;
      begin
        FmtStr(sHexRGBResult, '%s%0.8x', [HexDisplayPrefix, Integer(AColor)]);
       //使用StrToInt函數(shù)可以實現(xiàn)十六進制換十進制,具體代碼是:StrToInt('$' + 'FF');
       //這時值等于255。也就是在'FF'前加上一個'$'
        sR:=IntToStr(StrToInt('$'+RightStr(sHexRGBResult,2)));
        Delete(sHexRGBResult,8,2);//$00FF80變成這樣
        sG:=IntToStr(StrToInt('$'+RightStr(sHexRGBResult,2)));
        Delete(sHexRGBResult,6,2);//$00FF變成這樣
        sB:=IntToStr(StrToInt('$'+RightStr(sHexRGBResult,2)));
        Result:='RGB('+sR+','+sG+','+sB+')';
      end;

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多