Ignore:
Timestamp:
Apr 9, 2015, 9:58:36 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: Use csOpaque control style also to Image, PaintBox and OpenGLControl.
  • Modified: Change size of test frame with SpinEdits as delayed using timer.
  • Updated: BRGABitmap package to version 8.1.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/bgrabitmap/bgrablend.pas

    r452 r472  
    2626
    2727{ Draw a series of pixels with alpha blending }
     28procedure PutPixels(pdest: PBGRAPixel; psource: PBGRAPixel; copycount: integer; mode: TDrawMode; AOpacity:byte);
    2829procedure DrawPixelsInline(dest: PBGRAPixel; c: TBGRAPixel; Count: integer); inline; overload;
    2930procedure DrawExpandedPixelsInline(dest: PBGRAPixel; ec: TExpandedPixel; Count: integer); inline; overload;
     
    238239end;
    239240
     241procedure PutPixels(pdest: PBGRAPixel; psource: PBGRAPixel; copycount: integer;
     242  mode: TDrawMode; AOpacity: byte);
     243var i: integer; tempPixel: TBGRAPixel;
     244begin
     245  case mode of
     246    dmSet:
     247    begin
     248      if AOpacity <> 255 then
     249          CopyPixelsWithOpacity(pdest, psource, AOpacity, copycount)
     250      else
     251      begin
     252        copycount *= sizeof(TBGRAPixel);
     253        move(psource^, pdest^, copycount);
     254      end;
     255    end;
     256    dmSetExceptTransparent:
     257    begin
     258        if AOpacity <> 255 then
     259        begin
     260          for i := copycount - 1 downto 0 do
     261          begin
     262            if psource^.alpha = 255 then
     263            begin
     264              tempPixel := psource^;
     265              tempPixel.alpha := ApplyOpacity(tempPixel.alpha,AOpacity);
     266              FastBlendPixelInline(pdest,tempPixel);
     267            end;
     268            Inc(pdest);
     269            Inc(psource);
     270          end;
     271        end else
     272          for i := copycount - 1 downto 0 do
     273          begin
     274            if psource^.alpha = 255 then
     275              pdest^ := psource^;
     276            Inc(pdest);
     277            Inc(psource);
     278          end;
     279    end;
     280    dmDrawWithTransparency:
     281    begin
     282        if AOpacity <> 255 then
     283        begin
     284          for i := copycount - 1 downto 0 do
     285          begin
     286            DrawPixelInlineWithAlphaCheck(pdest, psource^, AOpacity);
     287            Inc(pdest);
     288            Inc(psource);
     289          end;
     290        end
     291        else
     292          for i := copycount - 1 downto 0 do
     293          begin
     294            DrawPixelInlineWithAlphaCheck(pdest, psource^);
     295            Inc(pdest);
     296            Inc(psource);
     297          end;
     298    end;
     299    dmFastBlend:
     300    begin
     301        if AOpacity <> 255 then
     302        begin
     303          for i := copycount - 1 downto 0 do
     304          begin
     305            FastBlendPixelInline(pdest, psource^, AOpacity);
     306            Inc(pdest);
     307            Inc(psource);
     308          end;
     309        end else
     310          for i := copycount - 1 downto 0 do
     311          begin
     312            FastBlendPixelInline(pdest, psource^);
     313            Inc(pdest);
     314            Inc(psource);
     315          end;
     316    end;
     317    dmXor:
     318    begin
     319      if AOpacity <> 255 then
     320      begin
     321          for i := copycount - 1 downto 0 do
     322          begin
     323            FastBlendPixelInline(pdest, TBGRAPixel(PDWord(pdest)^ xor PDword(psource)^), AOpacity);
     324            Inc(pdest);
     325            Inc(psource);
     326          end;
     327      end else
     328          XorPixels(pdest, psource, copycount);
     329    end;
     330  end;
     331end;
     332
    240333procedure DrawPixelsInline(dest: PBGRAPixel; c: TBGRAPixel; Count: integer);
    241334var
     
    385478  a1f, a2f, a12, a12m: cardinal;
    386479begin
     480  {$HINTS OFF}
    387481  a12  := 65025 - (not dest^.alpha) * (not c.alpha);
     482  {$HINTS ON}
    388483  a12m := a12 shr 1;
    389484
     
    412507  a1f, a2f, a12, a12m: cardinal;
    413508begin
     509  {$HINTS OFF}
    414510  a12  := 65025 - (not dest^.alpha) * (not calpha);
     511  {$HINTS ON}
    415512  a12m := a12 shr 1;
    416513
     
    446543  end;
    447544
     545  {$HINTS OFF}
    448546  a12  := 65025 - (not dest^.alpha) * (not c.alpha);
     547  {$HINTS ON}
    449548  a12m := a12 shr 1;
    450549
Note: See TracChangeset for help on using the changeset viewer.