Changeset 208
- Timestamp:
- May 8, 2020, 6:51:18 PM (5 years ago)
- Location:
- trunk/Packages/CevoComponents
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/EOTButton.pas
r188 r208 47 47 begin 48 48 RegisterComponents('C-evo', [TEOTButton]); 49 end;50 51 procedure ImageOp_CBC(Dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h, Color0,52 Color2: integer);53 // Src is template54 // B channel = Color0 amp55 // G channel = background amp (old Dst content), 128=original brightness56 // R channel = Color2 amp57 type58 TPixel = array [0 .. 2] of Byte;59 var60 ix, iy, amp0, amp1, trans, Value: integer;61 SrcLine, DstLine: ^TPixel;62 begin63 Src.BeginUpdate;64 Dst.BeginUpdate;65 for iy := 0 to h - 1 do66 begin67 SrcLine := Src.ScanLine[ySrc + iy] + xSrc * (Src.RawImage.Description.BitsPerPixel shr 3);68 DstLine := Dst.ScanLine[yDst + iy] + xDst * (Dst.RawImage.Description.BitsPerPixel shr 3);69 for ix := 0 to w - 1 do70 begin71 trans := SrcLine[0] * 2; // green channel = transparency72 amp0 := SrcLine[1] * 2;73 amp1 := SrcLine[2] * 2;74 if trans <> $FF then75 begin76 Value := (DstLine[0] * trans + (Color2 shr 16 and $FF) * amp177 + (Color0 shr 16 and $FF) * amp0) div $FF;78 if Value < 256 then79 DstLine[0] := Value80 else81 DstLine[0] := 255;82 Value := (DstLine[1] * trans + (Color2 shr 8 and $FF) * amp183 + (Color0 shr 8 and $FF) * amp0) div $FF;84 if Value < 256 then85 DstLine[1] := Value86 else87 DstLine[1] := 255;88 Value := (DstLine[2] * trans + (Color2 and $FF) * amp1 +89 (Color0 and $FF) * amp0) div $FF;90 if Value < 256 then91 DstLine[2] := Value92 else93 DstLine[2] := 255;94 end;95 SrcLine := Pointer(SrcLine) + (Src.RawImage.Description.BitsPerPixel shr 3);96 DstLine := Pointer(DstLine) + (Dst.RawImage.Description.BitsPerPixel shr 3);97 end;98 end;99 Src.EndUpdate;100 Dst.EndUpdate;101 49 end; 102 50 -
trunk/Packages/CevoComponents/ScreenTools.pas
r206 r208 36 36 overload; 37 37 procedure MakeBlue(dst: TBitmap; x, y, Width, Height: Integer); 38 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h: integer);38 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height: Integer); 39 39 procedure ImageOp_BCC(dst, Src: TBitmap; 40 xDst, yDst, xSrc, ySrc, Width, Height, Color1, Color2: integer); 41 procedure ImageOp_CCC(bmp: TBitmap; x, y, w, h, Color0, Color1, Color2: integer); 40 xDst, yDst, xSrc, ySrc, Width, Height, Color1, Color2: Integer); 41 procedure ImageOp_CBC(Dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height, 42 Color0, Color2: Integer); 43 procedure ImageOp_CCC(bmp: TBitmap; x, y, w, h, Color0, Color1, Color2: Integer); 42 44 function BitBltCanvas(DestCanvas: TCanvas; X, Y, Width, Height: Integer; 43 45 SrcCanvas: TCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean; overload; … … 555 557 end; 556 558 557 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h: Integer);559 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height: Integer); 558 560 // Src is template 559 561 // X channel = background amp (old Dst content), 128=original brightness … … 567 569 Assert(dst.PixelFormat = pf24bit); 568 570 if xDst < 0 then begin 569 w := w+ xDst;571 Width := Width + xDst; 570 572 xSrc := xSrc - xDst; 571 573 xDst := 0; 572 574 end; 573 575 if yDst < 0 then begin 574 h := h+ yDst;576 Height := Height + yDst; 575 577 ySrc := ySrc - yDst; 576 578 yDst := 0; 577 579 end; 578 if xDst + w> dst.Width then579 w:= dst.Width - xDst;580 if yDst + h> dst.Height then581 h:= dst.Height - yDst;582 if ( w < 0) or (h< 0) then580 if xDst + Width > dst.Width then 581 Width := dst.Width - xDst; 582 if yDst + Height > dst.Height then 583 Height := dst.Height - yDst; 584 if (Width < 0) or (Height < 0) then 583 585 exit; 584 586 … … 587 589 PixelDst := PixelPointer(Dst, xDst, yDst); 588 590 PixelSrc := PixelPointer(Src, xSrc, ySrc); 589 for Y := 0 to h- 1 do begin590 for X := 0 to w- 1 do begin591 for Y := 0 to Height - 1 do begin 592 for X := 0 to Width - 1 do begin 591 593 Brightness := PixelSrc.Pixel^.B; // One byte for 8-bit color 592 594 test := (PixelDst.Pixel^.R * Brightness) shr 7; … … 616 618 617 619 procedure ImageOp_BCC(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height, 618 Color1, Color2: integer);620 Color1, Color2: Integer); 619 621 // Src is template 620 622 // B channel = background amp (old Dst content), 128=original brightness … … 622 624 // R channel = Color2 amp, 128=original brightness 623 625 var 624 ix, iy, amp1, amp2, trans, Value: integer; 625 SrcPixel, DstPixel: TPixelPointer; 626 ix, iy, amp1, amp2, trans, Value: Integer; 627 SrcPixel: TPixelPointer; 628 DstPixel: TPixelPointer; 626 629 begin 627 630 if xDst < 0 then begin … … 673 676 Src.EndUpdate; 674 677 dst.EndUpdate; 678 end; 679 680 procedure ImageOp_CBC(Dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height, 681 Color0, Color2: Integer); 682 // Src is template 683 // B channel = Color0 amp 684 // G channel = background amp (old Dst content), 128=original brightness 685 // R channel = Color2 amp 686 var 687 ix, iy, amp0, amp1, trans, Value: integer; 688 SrcPixel: TPixelPointer; 689 DstPixel: TPixelPointer; 690 begin 691 Src.BeginUpdate; 692 Dst.BeginUpdate; 693 SrcPixel := PixelPointer(Src, xSrc, ySrc); 694 DstPixel := PixelPointer(Dst, xDst, yDst); 695 for iy := 0 to Height - 1 do begin 696 for ix := 0 to Width - 1 do begin 697 trans := SrcPixel.Pixel^.B * 2; // green channel = transparency 698 amp0 := SrcPixel.Pixel^.G * 2; 699 amp1 := SrcPixel.Pixel^.R * 2; 700 if trans <> $FF then begin 701 Value := (DstPixel.Pixel^.B * trans + (Color2 shr 16 and $FF) * amp1 + 702 (Color0 shr 16 and $FF) * amp0) div $FF; 703 DstPixel.Pixel^.B := Min(Value, 255); 704 705 Value := (DstPixel.Pixel^.G * trans + (Color2 shr 8 and $FF) * amp1 + 706 (Color0 shr 8 and $FF) * amp0) div $FF; 707 DstPixel.Pixel^.G := Min(Value, 255); 708 709 Value := (DstPixel.Pixel^.R * trans + (Color2 and $FF) * amp1 + 710 (Color0 and $FF) * amp0) div $FF; 711 DstPixel.Pixel^.R := Min(Value, 255); 712 end; 713 SrcPixel.NextPixel; 714 DstPixel.NextPixel; 715 end; 716 SrcPixel.NextLine; 717 DstPixel.NextLine; 718 end; 719 Src.EndUpdate; 720 Dst.EndUpdate; 675 721 end; 676 722
Note:
See TracChangeset
for help on using the changeset viewer.