亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? ggraphiccolor.pas

?? [原創(chuàng)]這是我寫(xiě)的一個(gè)圖像組件!組件中使用了GraphicEx庫(kù)
?? PAS
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
unit GGraphicColor;

// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
// specific language governing rights and limitations under the License.
//
// The original code is GraphicColor.pas, released November 1, 1999.
//
// The initial developer of the original code is Dipl. Ing. Mike Lischke (Plei遖, Germany, www.delphi-gems.com),
//
// Portions created by Dipl. Ing. Mike Lischke are Copyright
// (C) 1999-2003 Dipl. Ing. Mike Lischke. All Rights Reserved.
//----------------------------------------------------------------------------------------------------------------------
// This file is part of the image library GraphicEx.
//
// GraphicColor contains the implementation of the color conversion manager.
// This class is responsible for converting between these color schemes/formats:
//   - RGB(A)
//   - BGR(A)
//   - CMY(K)
//   - CIE L*a*b*
//   - PhotoYCC, standard YCbCr
//   - indexed
//   - grayscale (with alpha, which is ignored currently)
//
// Additional tasks are:
//   - coversions between bit depths (1, 2, 4, 8, 16 bits)
//   - palette creation
//   - gamma tables creation and application
//   - masked pixel transfer for interlaced images
//   - big endian swap
//   - plane (planar) -> interleaved (interlaced) conversion
//
// Notes:
//   - Throughout the entire unit I used the terms BPS and SPP for "bits per sample" and
//     "samples per pixel", respectively. A sample is one component per pixel. For indexed color schemes
//     there's only 1 sample per pixel, for RGB there are 3 (red, green and blue) and so on.
//   - The bit depth of multi sample formats like RGB must be equal for each color component.
//   - Because of the large amount of possible combinations (color schemes, sample depth, gamma, byte swap)
//     I limited the accepted combinations to pratical ones. This leaves currently out:
//       + gamma correction for 16 bit values
//       + conversion to 16 bit (target) grayscale with alpha
//       + samples sizes less than 8 bits for multi-sample schemes (RGB etc.)
//       + indexed schemes with planes (e.g. 16 colors indexed as 4 planes each with one bit per sample)
//   - For now there is no conversion between indexed and non-indexed formats. Also between grayscale
//     and any other scheme is no conversion possible.
//
//----------------------------------------------------------------------------------------------------------------------

interface

{$I GGraphicConfiguration.inc}

uses
  Windows, Graphics, GGraphicStrings;

const
  // this is the value for average CRT monitors, adjust it if your monitor differs
  DefaultDisplayGamma = 2.2;

type
  TColorScheme = (
    csUnknown,   // not (yet) defined color scheme
    csIndexed,   // any palette format
    csG,         // gray scale
    csGA,        // gray scale with alpha channel
    csRGB,       // red, green, blue
    csRGBA,      // RGB with alpha channel
    csBGR,       // RGB in reversed order (used under Windows)
    csBGRA,      // BGR with alpha channel (alpha is always the last component)
    csCMY,       // cyan, magenta, yellow (used mainly for printing processes)
    csCMYK,      // CMY with black
    csCIELab,    // CIE color format using luminance and chromaticities
    csYCbCr,     // another format using luminance and chromaticities
    csPhotoYCC   // a modified YCbCr version used for photo CDs
  );
  
  TConvertOptions = set of (
    coAlpha,          // alpha channel is to be considered (this value is usually automatically set depending on
                      // the color scheme)
    coApplyGamma,     // target only, gamma correction must take place
    coNeedByteSwap,   // endian switch needed
    coLabByteRange,   // CIE L*a*b* only, luminance range is from 0..255 instead 0..100
    coLabChromaOffset // CIE L*a*b* only, chrominance values a and b are given in 0..255 instead -128..127
  );

  // format of the raw data to create a color palette from
  TRawPaletteFormat = (
    pfInterlaced8Triple, // rgb triple with 8 bits per component
    pfInterlaced8Quad,   // rgb quad with 8 bits per component (fourth entry is reserved as in Windows' logical palette)
    pfPlane8Triple,      // 3 separate planes of data with 8 bits per component
    pfPlane8Quad,
    pfInterlaced16Triple,// rgb triple with 16 bits per component
    pfInterlaced16Quad,
    pfPlane16Triple,     // 3 separate planes of data with 16 bits per component
    pfPlane16Quad
  );

  // TConversionMethod describes the general parameter list to which each implemented conversion method conforms.
  // Note: Source is defined as open array parameter to allow plane and interlaced source data.
  TConversionMethod = procedure(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte) of object;
  
  TColorManager = class
  private
    FChanged: Boolean;                 // set if any of the parameters changed
    FSourceBPS,                        // bits per sample of source data (allowed values are 1, 2, 4, 8, 16)
    FTargetBPS,                        // bits per sample of target data (allowed values are 1, 2, 4, 8, 16)
    FSourceSPP,                        // samples per source pixel (allowed values are 1, 3, 4)
    FTargetSPP: Byte;                  // samples per target pixel (allowed values are 1, 3, 4)
    FMainGamma,                        // primary gamma value which is usually read from a file (default is 1)
    FDisplayGamma: Single;             // (constant) gamma value of the current monitor (default is 2.2)
    FGammaTable: array[Byte] of Byte;  // contains precalculated gamma values for each possible component value
                                       // (range is 0..255)
    FYCbCrCoefficients: array[0..2] of Single;
    FHSubsampling,
    FVSubSampling: Byte;               // additional parameters used for YCbCr conversion
    FCrToRedTable,                     // lookup tables used for YCbCr conversion
    FCbToBlueTable,
    FCrToGreenTable,                                       
    FCbToGreenTable: array of Integer;

    FSourceScheme,
    FTargetScheme: TColorScheme;
    FRowConversion: TConversionMethod; // procedure variable for the actual conversion method used
    FSourceOptions,
    FTargetOptions: TConvertOptions;   // options to control conversion
  protected
    // Low level conversion helper used to convert one pixel component.
    function ComponentGammaConvert(Value: Byte): Byte;
    function ComponentNoConvert16(Value: Word): Word;
    function ComponentNoConvert8(Value: Byte): Byte;
    function ComponentScaleConvert(Value: Word): Byte;
    function ComponentScaleGammaConvert(Value: Word): Byte;
    function ComponentSwapScaleGammaConvert(Value: Word): Byte;
    function ComponentSwapScaleConvert(Value: Word): Byte;
    function ComponentSwapConvert(Value: Word): Word;

    // row conversion routines
    procedure RowConvertBGR2BGR(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertBGR2RGB(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertCIELAB2BGR(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertCIELAB2RGB(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertCMYK2BGR(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertCMYK2RGB(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertGray(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertIndexed8(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertIndexedBoth16(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertIndexedSource16(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertIndexedTarget16(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertRGB2BGR(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertRGB2RGB(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertPhotoYCC2BGR(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertPhotoYCC2RGB(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertYCbCr2BGR(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    procedure RowConvertYCbCr2RGB(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);

    // other general routines
    procedure CreateYCbCrLookup;
    function GetPixelFormat(Index: Integer): TPixelFormat;
    procedure PrepareConversion;
    procedure SetSourceBitsPerSample(const Value: Byte);
    procedure SetSourceColorScheme(const Value: TColorScheme);
    procedure SetSourceSamplesPerPixel(const Value: Byte);
    procedure SetTargetBitsPerSample(const Value: Byte);
    procedure SetTargetColorScheme(const Value: TColorScheme);
    procedure SetTargetSamplesPerPixel(const Value: Byte);
  public
    constructor Create;

    procedure ConvertRow(Source: array of Pointer; Target: Pointer; Count: Cardinal; Mask: Byte);
    function CreateColorPalette(Data: array of Pointer; DataFormat: TRawPaletteFormat; ColorCount: Cardinal;
      RGB: Boolean): HPALETTE;
    function CreateGrayscalePalette(MinimumIsWhite: Boolean): HPALETTE;
    procedure Error(const Msg: String);
    procedure SetGamma(MainGamma: Single; DisplayGamma: Single = DefaultDisplayGamma);
    procedure SetYCbCrParameters(Values: array of Single; HSubSampling, VSubSampling: Byte);

    property SourceBitsPerSample: Byte read FSourceBPS write SetSourceBitsPerSample;
    property SourceColorScheme: TColorScheme read FSourceScheme write SetSourceColorScheme;
    property SourceOptions: TConvertOptions read FSourceOptions write FSourceOptions;
    property SourcePixelFormat: TPixelFormat index 0 read GetPixelFormat;
    property SourceSamplesPerPixel: Byte read FSourceSPP write SetSourceSamplesPerPixel;
    property TargetBitsPerSample: Byte read FTargetBPS write SetTargetBitsPerSample;
    property TargetColorScheme: TColorScheme read FTargetScheme write SetTargetColorScheme;
    property TargetOptions: TConvertOptions read FTargetOptions write FTargetOptions;
    property TargetPixelFormat: TPixelFormat index 1 read GetPixelFormat;
    property TargetSamplesPerPixel: Byte read FTargetSPP write SetTargetSamplesPerPixel;
  end;

function ClampByte(Value: Integer): Byte;
function MulDiv16(Number, Numerator, Denominator: Word): Word;
  
//----------------------------------------------------------------------------------------------------------------------

implementation

uses
  Math, SysUtils;

type
  EColorConversionError = class(Exception);

  PCMYK = ^TCMYK;
  TCMYK = packed record
    C, M, Y, K: Byte;
  end;

  PCMYK16 = ^TCMYK16;
  TCMYK16 = packed record
    C, M, Y, K: Word;
  end;

  PCMY = ^TCMY;
  TCMY = packed record
    C, M, Y: Byte;
  end;

  PCMY16 = ^TCMY16;
  TCMY16 = packed record
    C, M, Y: Word;
  end;
  
  PRGB = ^TRGB;
  TRGB = packed record
    R, G, B: Byte;
  end;

  PRGB16 = ^TRGB16;
  TRGB16 = packed record
    R, G, B: Word;
  end;

  PRGBA = ^TRGBA;
  TRGBA = packed record
    R, G, B, A: Byte;
  end;

  PRGBA16 = ^TRGBA16;
  TRGBA16 = packed record
    R, G, B, A: Word;
  end;

  PBGR = ^TBGR;
  TBGR = packed record
    B, G, R: Byte;
  end;

  PBGR16 = ^TBGR16;
  TBGR16 = packed record
    B, G, R: Word;
  end;

  PBGRA = ^TBGRA;
  TBGRA = packed record
    B, G, R, A: Byte;
  end;

  PBGRA16 = ^TBGRA16;
  TBGRA16 = packed record
    B, G, R, A: Word;
  end;

//----------------- helper functions -----------------------------------------------------------------------------------

function ClampByte(Value: Integer): Byte;

// ensures Value is in the range 0..255, values < 0 are clamped to 0 and values > 255 are clamped to 255

asm
         OR EAX, EAX
         JNS @@positive
         XOR EAX, EAX
         RET

@@positive:
         CMP EAX, 255
         JBE @@OK
         MOV EAX, 255
@@OK:
end;

//----------------------------------------------------------------------------------------------------------------------

function MulDiv16(Number, Numerator, Denominator: Word): Word;

// faster equivalent to Windows' MulDiv function
// Number is passed via AX
// Numerator is passed via DX
// Denominator is passed via CX
// Result is passed via AX
// Note: No error checking takes place. Denominator must be > 0!

asm
         MUL DX
         DIV CX
end;

//----------------- TColorManager --------------------------------------------------------------------------------------

constructor TColorManager.Create;

// set some default values

begin
  FSourceBPS := 8;
  FTargetBPS := 8;                             
  FSourceSPP := 3; // 24 bit format
  FTargetSPP := 3; // 24 bit format
  SetGamma(1, DefaultDisplayGamma);
  FSourceScheme := csRGB;
  FTargetScheme := csBGR;

  // defaults are from CCIR Recommendation 601-1
  FYCbCrCoefficients[0] := 0.299;
  FYCbCrCoefficients[1] := 0.587;
  FYCbCrCoefficients[2] := 0.114;

  FHSubSampling := 1;
  FVSubSampling := 1;

  FChanged := True;
end;

//----------------- low level conversion routines ----------------------------------------------------------------------

// These routines are used for conversions from 16 to 8 bit values, either with gamma correction or byte swap (or both).

function TColorManager.ComponentNoConvert8(Value: Byte): Byte;

begin
  Result := Value;
end;

//----------------------------------------------------------------------------------------------------------------------

function TColorManager.ComponentNoConvert16(Value: Word): Word;

begin
  Result := Value;
end;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品视频在线观看| 免费xxxx性欧美18vr| 日韩亚洲欧美综合| 成人黄动漫网站免费app| 午夜激情久久久| 国产精品丝袜91| 欧美一级片在线| 欧美性xxxxxx少妇| 99久免费精品视频在线观看| 极品美女销魂一区二区三区免费| 亚洲视频免费看| 欧美成人精品1314www| 精品视频一区三区九区| 国v精品久久久网| 国产一区二区在线视频| 日韩av不卡在线观看| 一区二区三区免费网站| 国产精品麻豆视频| 久久这里只精品最新地址| 555www色欧美视频| 欧美日韩精品一区二区三区四区 | 石原莉奈在线亚洲二区| 亚洲男人电影天堂| 国产精品久久久久久一区二区三区 | 午夜av电影一区| |精品福利一区二区三区| 国产午夜精品理论片a级大结局| 91麻豆精品国产91久久久久| 欧美性videosxxxxx| 色婷婷av一区二区三区软件 | 中文字幕精品一区二区精品绿巨人| 欧美一区欧美二区| 日韩一级高清毛片| 91精品一区二区三区在线观看| 色噜噜狠狠成人中文综合| 成人aa视频在线观看| 成人禁用看黄a在线| 国产成人在线影院 | 国产精品中文有码| 国模大尺度一区二区三区| 日韩影视精彩在线| 日韩中文字幕av电影| 亚洲成人av电影在线| 亚洲国产综合色| 午夜国产精品影院在线观看| 青娱乐精品在线视频| 日韩精品一二三| 日av在线不卡| 国产又黄又大久久| 国产福利不卡视频| av福利精品导航| 色8久久精品久久久久久蜜| 色婷婷综合激情| 欧美在线免费观看亚洲| 91精品国产黑色紧身裤美女| 日韩精品中文字幕一区二区三区| 精品国产乱码久久久久久久| 26uuu久久天堂性欧美| 国产精品三级视频| 一区二区视频在线| 日韩主播视频在线| 国产美女在线观看一区| 99久久精品国产麻豆演员表| 欧洲精品一区二区三区在线观看| 在线91免费看| 久久伊99综合婷婷久久伊| 综合分类小说区另类春色亚洲小说欧美 | 欧美成人精品高清在线播放| 欧美国产精品久久| 亚洲午夜免费福利视频| 蜜臀av性久久久久蜜臀av麻豆| 国产一区二区三区免费观看| 91天堂素人约啪| 7777精品伊人久久久大香线蕉的 | 一区二区成人在线视频| 视频一区二区中文字幕| 国产成人精品影院| 欧美日韩国产在线观看| 久久久久9999亚洲精品| 亚洲国产精品一区二区www| 激情综合网av| 在线免费av一区| 精品福利av导航| 亚洲免费观看高清| 激情综合网激情| 欧美无人高清视频在线观看| 久久久午夜精品理论片中文字幕| 亚洲另类在线一区| 国产在线观看免费一区| 欧美日精品一区视频| 国产精品妹子av| 久久精品国产精品青草| 在线观看亚洲精品| 久久久久久日产精品| 亚洲成a人片综合在线| 成人国产精品免费| 2019国产精品| 日韩中文字幕麻豆| 在线观看亚洲a| 国产精品每日更新在线播放网址| 蜜桃久久av一区| 在线精品视频一区二区三四| 国产午夜精品在线观看| 日本中文在线一区| 欧美色国产精品| 亚洲乱码国产乱码精品精98午夜| 丁香激情综合国产| 欧美v亚洲v综合ⅴ国产v| 亚洲午夜久久久久久久久电影网| 成人免费视频免费观看| 久久―日本道色综合久久| 亚洲成人免费观看| 91精品福利在线| 国产精品福利一区二区三区| 国产在线播放一区| 91精品国产麻豆| 日韩av电影天堂| 欧美日韩一区高清| 一区二区三区四区不卡视频| 成人一区二区视频| 久久综合色播五月| 国内成人自拍视频| 日韩欧美国产不卡| 青青草国产成人av片免费 | 国产精品女同互慰在线看| 国产精品一区二区久久不卡| 精品日韩一区二区三区免费视频| 天天爽夜夜爽夜夜爽精品视频| 欧美日韩在线电影| 午夜视频在线观看一区| 欧美日韩国产成人在线91 | caoporn国产一区二区| 国产亚洲婷婷免费| 国产成人午夜高潮毛片| 久久亚洲一区二区三区明星换脸 | 亚洲日本va午夜在线影院| 高清av一区二区| 日本一区二区电影| 成人福利电影精品一区二区在线观看 | 欧美久久久久久久久| 日韩精品国产欧美| 在线成人av网站| 日本不卡在线视频| 精品免费视频.| 国产一区二区在线免费观看| 欧美国产亚洲另类动漫| 成人激情开心网| 亚洲免费在线观看| 欧美日韩午夜在线| 久久99久久久欧美国产| 国产欧美一区二区在线| 99久久综合99久久综合网站| 亚洲品质自拍视频网站| 在线观看成人小视频| 日韩和的一区二区| 久久看人人爽人人| 成人av在线播放网址| 亚洲伦在线观看| 欧美老人xxxx18| 国产自产v一区二区三区c| 国产欧美日韩视频一区二区 | 色哟哟国产精品| 午夜电影网一区| 2023国产精华国产精品| 99视频精品全部免费在线| 亚洲一区国产视频| 精品国产免费一区二区三区四区| 成人手机在线视频| 亚洲大片在线观看| 国产欧美视频在线观看| 在线免费亚洲电影| 99r国产精品| 一区二区三区欧美在线观看| 日韩精品一区国产麻豆| 91偷拍与自偷拍精品| 蜜臀久久99精品久久久久久9| 国产精品色婷婷| 91精品国产手机| av不卡在线观看| 久久精品99久久久| 亚洲另类春色国产| 久久亚洲捆绑美女| 欧美亚洲国产一卡| 国产成人综合亚洲网站| 日韩主播视频在线| 亚洲天堂精品在线观看| 欧美大尺度电影在线| 色综合一个色综合| 狠狠狠色丁香婷婷综合久久五月| 一区二区三区日韩欧美| 久久久精品天堂| 欧美理论片在线| 99v久久综合狠狠综合久久| 激情国产一区二区 | 国产·精品毛片| 免费日本视频一区| 亚洲尤物在线视频观看| 欧美国产视频在线| 日韩欧美久久一区| 欧美中文一区二区三区|