- Timestamp:
- Jan 3, 2024, 3:05:32 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/MessgEx.pas
r509 r514 45 45 private 46 46 MovieCancelled: Boolean; 47 procedure PaintBook( ca: TCanvas; X, Y, clPage, clCover: Integer);47 procedure PaintBook(Canvas: TCanvas; X, Y, clPage, clCover: Integer); 48 48 procedure PaintMyArmy; 49 49 procedure PaintEnemyArmy; … … 221 221 end; 222 222 223 procedure TMessgExDlg.PaintBook( ca: TCanvas; X, Y, clPage, clCover: Integer);223 procedure TMessgExDlg.PaintBook(Canvas: TCanvas; X, Y, clPage, clCover: Integer); 224 224 const 225 225 xScrewed = 77; … … 238 238 Height: Integer; 239 239 begin 240 Width := 56;241 Height := 40;240 Width := xSizeBig; 241 Height := ySizeBig; 242 242 if IconIndex >= 0 then begin 243 243 xIcon := IconIndex mod 7 * xSizeBig; … … 292 292 293 293 // paint 294 UnshareBitmap(LogoBuffer); 295 BitBltCanvas(LogoBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, ca, X, Y); 294 UnshareBitmap(DrawBuffer); 295 DrawBufferEnsureSize(BookRect.Width, BookRect.Height); 296 BitBltCanvas(DrawBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, Canvas, X, Y); 296 297 297 298 if IconIndex >= 0 then … … 299 300 for ix := 0 to wScrewed - 1 do 300 301 if Screwed[ix, iy, 3] > 0.01 then 301 LogoBuffer.Canvas.Pixels[xScrewed + ix, yScrewed + iy] :=302 DrawBuffer.Canvas.Pixels[xScrewed + ix, yScrewed + iy] := 302 303 Trunc(Screwed[ix, iy, 2] / Screwed[ix, iy, 3]) + 303 304 Trunc(Screwed[ix, iy, 1] / Screwed[ix, iy, 3]) shl 8 + 304 305 Trunc(Screwed[ix, iy, 0] / Screwed[ix, iy, 3]) shl 16; 305 306 306 ImageOp_BCC( LogoBuffer, Templates.Data, Point(0, 0), BookRect, clCover, clPage);307 308 BitBltCanvas( ca, X, Y, BookRect.Width, BookRect.Height, LogoBuffer.Canvas, 0, 0);307 ImageOp_BCC(DrawBuffer, Templates.Data, Point(0, 0), BookRect, clCover, clPage); 308 309 BitBltCanvas(Canvas, X, Y, BookRect.Width, BookRect.Height, DrawBuffer.Canvas, 0, 0); 309 310 end; 310 311 -
trunk/Packages/CevoComponents/ScreenTools.pas
r512 r514 97 97 T: TTexture); 98 98 procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer); 99 procedure DrawBufferEnsureSize(Width, Height: Integer); 99 100 procedure LoadPhrases; 100 101 procedure Texturize(Dest, Texture: TBitmap; TransparentColor: Cardinal); … … 190 191 Paper: TBitmap; 191 192 BigImp: TBitmap; 192 LogoBuffer: TBitmap;193 DrawBuffer: TBitmap; 193 194 FullScreen: Boolean; 194 195 GenerateNames: Boolean; … … 1567 1568 procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer); 1568 1569 begin 1569 if not Assigned(LogoBuffer) then Exit; 1570 UnshareBitmap(LogoBuffer); 1571 BitBltCanvas(LogoBuffer.Canvas, 0, 0, Logo.Width, Logo.Height, Canvas, X, Y); 1572 ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), Logo.BoundsRect, 1570 if not Assigned(DrawBuffer) then Exit; 1571 DrawBufferEnsureSize(Logo.Width, Logo.Height); 1572 UnshareBitmap(DrawBuffer); 1573 BitBltCanvas(DrawBuffer.Canvas, 0, 0, Logo.Width, Logo.Height, Canvas, X, Y); 1574 ImageOp_BCC(DrawBuffer, Templates.Data, Point(0, 0), Logo.BoundsRect, 1573 1575 LightColor, ShadeColor); 1574 BitBltCanvas(Canvas, X, Y, Logo.Width, Logo.Height, LogoBuffer.Canvas, 0, 0); 1576 BitBltCanvas(Canvas, X, Y, Logo.Width, Logo.Height, DrawBuffer.Canvas, 0, 0); 1577 end; 1578 1579 procedure DrawBufferEnsureSize(Width, Height: Integer); 1580 begin 1581 if (DrawBuffer.Width >= Width) and (DrawBuffer.Height >= Height) then Exit; 1582 if (DrawBuffer.Width < Width) and (DrawBuffer.Height < Height) then 1583 DrawBuffer.SetSize(Width, Height) 1584 else if DrawBuffer.Width < Width then DrawBuffer.Width := Width 1585 else if DrawBuffer.Height < Height then DrawBuffer.Height := Height; 1586 DrawBuffer.Canvas.FillRect(0, 0, DrawBuffer.Width, DrawBuffer.Height); 1575 1587 end; 1576 1588 … … 1813 1825 end; 1814 1826 1815 if not Assigned(LogoBuffer) then begin1816 LogoBuffer := TBitmap.Create;1817 LogoBuffer.PixelFormat := TPixelFormat.pf24bit;1818 LogoBuffer.SetSize(BigBook.Width, BigBook.Height);1819 end;1820 1821 1827 LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png'); 1822 1828 LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg'); … … 1838 1844 for Section := Low(TFontType) to High(TFontType) do 1839 1845 UniFont[Section] := TFont.Create; 1846 1847 DrawBuffer := TBitmap.Create; 1848 DrawBuffer.PixelFormat := TPixelFormat.pf24bit; 1840 1849 1841 1850 GrExt := TGraphicSets.Create; … … 1877 1886 FreeAndNil(Phrases); 1878 1887 FreeAndNil(Phrases2); 1879 if Assigned(LogoBuffer) then FreeAndNil(LogoBuffer);1888 FreeAndNil(DrawBuffer); 1880 1889 FreeAndNil(BigImp); 1881 1890 FreeAndNil(Paper); -
trunk/Packages/DpiControls/Dpi.Common.pas
r476 r514 5 5 uses 6 6 {$IFDEF WINDOWS}Windows,{$ENDIF} 7 Classes, SysUtils, LCLType, Types, LCLIntf, Graphics, Dpi.Graphics;7 Classes, SysUtils, LCLType, Types, Math, LCLIntf, Graphics, Dpi.Graphics; 8 8 9 9 const … … 100 100 function ScaleToNative(Value: Integer): Integer; 101 101 begin 102 Result := Round(Value * ScreenInfo.Dpi / 96);102 Result := Ceil(Value * ScreenInfo.Dpi / 96); 103 103 end; 104 104 … … 110 110 function ScaleFromNative(Value: Integer): Integer; 111 111 begin 112 Result := Round(Value * 96 / ScreenInfo.Dpi);112 Result := Floor(Value * 96 / ScreenInfo.Dpi); 113 113 end; 114 114 … … 185 185 DstWidth, DstHeight: Integer; 186 186 SrcWidth, SrcHeight: Integer; 187 ReduceWidth, ReduceHeight: Integer; 187 188 begin 188 189 {$IFDEF WINDOWS} … … 193 194 {$ELSE} 194 195 195 196 196 DstWidth := ScaleToNativeDist(X, Width); 197 197 DstHeight := ScaleToNativeDist(Y, Height); 198 198 SrcWidth := ScaleToNativeDist(XSrc, Width); 199 199 SrcHeight := ScaleToNativeDist(YSrc, Height); 200 if (Frac(ScaleFloatToNative(XSrc)) > 0) or 201 (Frac(ScaleFloatToNative(X)) > 0) then ReduceWidth := 1 202 else ReduceWidth := 0; 203 if (Frac(ScaleFloatToNative(YSrc)) > 0) or 204 (Frac(ScaleFloatToNative(Y)) > 0) then ReduceHeight := 1 205 else ReduceHeight := 0; 200 206 if (DstWidth = SrcWidth) and (DstHeight = SrcHeight) then begin 201 207 Result := LCLIntf.BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), … … 204 210 end else begin 205 211 Result := LCLIntf.BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), 206 DstWidth , DstHeight, SrcDC,212 DstWidth - ReduceWidth, DstHeight - ReduceHeight, SrcDC, 207 213 ScaleToNative(XSrc), ScaleToNative(YSrc), Rop); 208 { Result := LCLIntfStretchBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), 214 215 // Instead calling StretchBlt for entire region try to draw missing part with BitBlt 216 if DstWidth > SrcWidth then begin 217 LCLIntf.BitBlt(DestDC, ScaleToNative(X) + SrcWidth, ScaleToNative(Y), 218 DstWidth - SrcWidth, DstHeight, SrcDC, 219 ScaleToNative(XSrc) + SrcWidth - (DstWidth - SrcWidth), ScaleToNative(YSrc), Rop); 220 end; 221 if DstHeight > SrcHeight then begin 222 LCLIntf.BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y) + SrcHeight, 223 DstWidth, DstHeight - SrcHeight, SrcDC, 224 ScaleToNative(XSrc), ScaleToNative(YSrc) + SrcHeight - (DstHeight - SrcHeight), Rop); 225 end; 226 227 { Result := LCLIntf.StretchBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), 209 228 DstWidth, DstHeight, SrcDC, 210 229 ScaleToNative(XSrc), ScaleToNative(YSrc), 211 SrcWidth, SrcHeight, Rop); 212 }end;230 SrcWidth, SrcHeight, Rop);} 231 end; 213 232 214 233 { Result := LCLIntf.BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), -
trunk/Start.pas
r511 r514 114 114 FormerGames: TStringList; 115 115 Maps: TStringList; 116 LogoBuffer: TBitmap;117 116 // BookDate: string; 118 117 PlayerSlots: TPlayerSlots; … … 181 180 ActionSideBorder = 24; 182 181 ActionBottomBorder = 10; 183 wBuffer = 91;184 182 x0Mini = 437; 185 183 y0Mini = 178; … … 308 306 EmptyPicture.SetSize(64, 64); 309 307 EmptyPicture.Canvas.FillRect(0, 0, EmptyPicture.Width, EmptyPicture.Height); 310 LogoBuffer := TBitmap.Create;311 LogoBuffer.PixelFormat := TPixelFormat.pf24bit;312 LogoBuffer.SetSize(wBuffer, 56);313 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);314 308 315 309 MiniMap := TMiniMap.Create; … … 336 330 FreeAndNil(Maps); 337 331 FreeAndNil(EmptyPicture); 338 FreeAndNil(LogoBuffer);339 332 FreeAndNil(PlayerSlots); 340 333 FreeAndNil(MiniMap); … … 537 530 $000000, xAction, Y + 21, Phrases2.Lookup(TextItem)); 538 531 539 UnshareBitmap(LogoBuffer); 540 BitBltCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas, 532 UnshareBitmap(DrawBuffer); 533 DrawBufferEnsureSize(50, 50); 534 BitBltCanvas(DrawBuffer.Canvas, 0, 0, 50, 50, Canvas, 541 535 xActionIcon - 2, Y - 2); 542 GlowFrame( LogoBuffer, 8, 8, 34, 34, $202020);536 GlowFrame(DrawBuffer, 8, 8, 34, 34, $202020); 543 537 BitBltCanvas(Canvas, xActionIcon - 2, Y - 2, 50, 50, 544 LogoBuffer.Canvas, 0, 0);538 DrawBuffer.Canvas, 0, 0); 545 539 BitBltCanvas(Canvas, xActionIcon, Y, 40, 40, BigImp.Canvas, 546 540 (IconIndex mod 7) * xSizeBig + 8, (IconIndex div 7) * ySizeBig); … … 637 631 638 632 // Paint menu logo 639 UnshareBitmap(LogoBuffer); 640 BitBltCanvas(LogoBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6, 633 UnshareBitmap(DrawBuffer); 634 DrawBufferEnsureSize(MenuLogo.Width, MenuLogo.Height); 635 BitBltCanvas(DrawBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6, 641 636 3 + 2 * Integer(Tab <> tbMain)); 642 637 643 ImageOp_BCC( LogoBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top,638 ImageOp_BCC(DrawBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top, 644 639 MenuLogo.Width, MenuLogo.Height - 9, $BFBF20, $4040DF); // logo part 1 645 ImageOp_BCC( LogoBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10,640 ImageOp_BCC(DrawBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10, 646 641 MenuLogo.Top + 27, MenuLogo.Width - 10, 9, $BFBF20, $4040DF); // logo part 2 647 642 BitBltCanvas(Canvas, 6, 3 + 2 * Integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height, 648 LogoBuffer.Canvas, 0, 0);643 DrawBuffer.Canvas, 0, 0); 649 644 650 645 if Page = pgMain then begin 651 if SelectedAction <> maNone then // mark selected action 652 for I := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do 653 begin 654 W := ClientWidth - 2 * ActionSideBorder - I * wBuffer; 655 if W > wBuffer then 656 W := wBuffer; 657 H := ActionPitch; 658 if yAction + Integer(SelectedAction) * ActionPitch - 8 + H > ClientHeight - ActionBottomBorder 659 then 660 H := ClientHeight - ActionBottomBorder - 661 (yAction + Integer(SelectedAction) * ActionPitch - 8); 662 663 UnshareBitmap(LogoBuffer); 664 BitBltCanvas(LogoBuffer.Canvas, 0, 0, W, H, Canvas, 665 ActionSideBorder + I * wBuffer, yAction + Integer(SelectedAction) * ActionPitch 666 - 8); 667 MakeBlue(LogoBuffer, 0, 0, W, H); 668 BitBltCanvas(Canvas, ActionSideBorder + I * wBuffer, 669 yAction + Integer(SelectedAction) * ActionPitch - 8, W, H, 670 LogoBuffer.Canvas, 0, 0); 671 end; 646 if SelectedAction <> maNone then begin 647 // Mark selected action 648 W := ClientWidth - 2 * ActionSideBorder; 649 H := ActionPitch; 650 if yAction + Integer(SelectedAction) * ActionPitch - 8 + H > ClientHeight - ActionBottomBorder 651 then 652 H := ClientHeight - ActionBottomBorder - 653 (yAction + Integer(SelectedAction) * ActionPitch - 8); 654 655 UnshareBitmap(DrawBuffer); 656 DrawBufferEnsureSize(W, H); 657 BitBltCanvas(DrawBuffer.Canvas, 0, 0, W, H, Canvas, 658 ActionSideBorder, yAction + Integer(SelectedAction) * ActionPitch - 8); 659 MakeBlue(DrawBuffer, 0, 0, W, H); 660 BitBltCanvas(Canvas, ActionSideBorder, yAction + Integer(SelectedAction) * 661 ActionPitch - 8, W, H, DrawBuffer.Canvas, 0, 0); 662 end; 672 663 Y := yAction; 673 664 for MainAction := Low(TMainActionSet) to High(TMainActionSet) do … … 687 678 Canvas.Font.Assign(UniFont[ftNormal]); 688 679 689 UnshareBitmap(LogoBuffer); 690 BitBltCanvas(LogoBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas, 680 UnshareBitmap(DrawBuffer); 681 DrawBufferEnsureSize(LinkArrows.Width, LinkArrows.Height); 682 BitBltCanvas(DrawBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas, 691 683 xActionIcon, Y + 2); 692 ImageOp_BCC( LogoBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0,684 ImageOp_BCC(DrawBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0, 693 685 Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]); 694 686 BitBltCanvas(Canvas, xActionIcon, Y + 2, LinkArrows.Width, LinkArrows.Height, 695 LogoBuffer.Canvas, 0, 0);687 DrawBuffer.Canvas, 0, 0); 696 688 end; 697 689 end;
Note:
See TracChangeset
for help on using the changeset viewer.