Changeset 196 for trunk/Packages
- Timestamp:
- May 7, 2020, 11:42:52 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r194 r196 38 38 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h: integer); 39 39 procedure ImageOp_BCC(dst, Src: TBitmap; 40 xDst, yDst, xSrc, ySrc, w, h, Color1, Color2: integer);40 xDst, yDst, xSrc, ySrc, Width, Height, Color1, Color2: integer); 41 41 procedure ImageOp_CCC(bmp: TBitmap; x, y, w, h, Color0, Color1, Color2: integer); 42 42 function BitBltCanvas(DestCanvas: TCanvas; X, Y, Width, Height: Integer; … … 615 615 end; 616 616 617 procedure ImageOp_BCC(dst, Src: TBitmap; 618 xDst, yDst, xSrc, ySrc, w, h,Color1, Color2: integer);617 procedure ImageOp_BCC(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height, 618 Color1, Color2: integer); 619 619 // Src is template 620 620 // B channel = background amp (old Dst content), 128=original brightness … … 626 626 begin 627 627 if xDst < 0 then begin 628 w := w+ xDst;628 Width := Width + xDst; 629 629 xSrc := xSrc - xDst; 630 630 xDst := 0; 631 631 end; 632 632 if yDst < 0 then begin 633 h := h+ yDst;633 Height := Height + yDst; 634 634 ySrc := ySrc - yDst; 635 635 yDst := 0; 636 636 end; 637 if xDst + w> dst.Width then638 w:= dst.Width - xDst;639 if yDst + h> dst.Height then640 h:= dst.Height - yDst;641 if ( w < 0) or (h< 0) then637 if xDst + Width > dst.Width then 638 Width := dst.Width - xDst; 639 if yDst + Height > dst.Height then 640 Height := dst.Height - yDst; 641 if (Width < 0) or (Height < 0) then 642 642 exit; 643 643 … … 646 646 SrcPixel.Init(Src, xSrc, ySrc); 647 647 DstPixel.Init(Dst, xDst, yDst); 648 for iy := 0 to h- 1 do begin649 for ix := 0 to w- 1 do begin648 for iy := 0 to Height - 1 do begin 649 for ix := 0 to Width - 1 do begin 650 650 trans := SrcPixel.Pixel^.B * 2; // green channel = transparency 651 651 amp1 := SrcPixel.Pixel^.G * 2; … … 654 654 Value := (DstPixel.Pixel^.B * trans + ((Color2 shr 16) and $FF) * 655 655 amp2 + ((Color1 shr 16) and $FF) * amp1) div $FF; 656 if Value < 256 then 657 DstPixel.Pixel^.B := Value 658 else 659 DstPixel.Pixel^.B := 255; 656 DstPixel.Pixel^.B := Min(Value, 255); 657 660 658 Value := (DstPixel.Pixel^.G * trans + ((Color2 shr 8) and $FF) * 661 659 amp2 + ((Color1 shr 8) and $FF) * amp1) div $FF; 662 if Value < 256 then 663 DstPixel.Pixel^.G := Value 664 else 665 DstPixel.Pixel^.G := 255; 660 DstPixel.Pixel^.G := Min(Value, 255); 661 666 662 Value := (DstPixel.Pixel^.R * trans + (Color2 and $FF) * 667 663 amp2 + (Color1 and $FF) * amp1) div $FF; 668 if Value < 256 then 669 DstPixel.Pixel^.R := Value 670 else 671 DstPixel.Pixel^.R := 255; 664 DstPixel.Pixel^.R := Min(Value, 255); 672 665 end; 666 673 667 SrcPixel.NextPixel; 674 668 DstPixel.NextPixel; … … 733 727 SrcCanvas: TCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean; 734 728 begin 735 {Assert(Rop = SRCCOPY);} 736 if Rop = SRCCOPY then begin 737 DestCanvas.CopyRect(Rect(X, Y, X + Width, Y + Height), SrcCanvas, 738 Rect(XSrc, YSrc, XSrc + Width, YSrc + Height)); 739 Result := True; 740 end else Result := BitBlt(DestCanvas.Handle, X, Y, Width, Height, SrcCanvas.Handle, XSrc, YSrc, Rop); 729 Result := BitBlt(DestCanvas.Handle, X, Y, Width, Height, SrcCanvas.Handle, XSrc, YSrc, Rop); 741 730 end; 742 731 … … 1376 1365 procedure PaintLogo(ca: TCanvas; x, y, clLight, clShade: Integer); 1377 1366 begin 1367 // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it 1368 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height); 1378 1369 BitBltCanvas(LogoBuffer.Canvas, 0, 0, wLogo, hLogo, ca, x, y); 1379 1370 ImageOp_BCC(LogoBuffer, Templates, 0, 0, 1, 1, wLogo, hLogo,
Note:
See TracChangeset
for help on using the changeset viewer.