Jump to content
LordJashin

BitmapsMerge function

Recommended Posts

This will merge an array of bitmaps either Horizontally or vertically (puts them together) based on what you put for Vertical boolean.

 

Maybe a better name for this? I don't think merge is the right word?

Any suggestions on how to make this better? Some good TIA functions could slim this down.

 

[scar]

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function BitmapsMerge(BmpArr: array of TSCARBitmap; Vertical: Boolean): TSCARBitmap;

Contributors: LordJashin

Description: Merges an array of bitmaps (puts side by side) either horizontally or vertically depending on Vertical boolean

There must be 2 or more bitmaps for this to do anything

Date Created: November 19th, 2012. By LordJashin.

Last Modified: November 19th, 2012. By LordJashin.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function BitmapsMerge(BmpArr: array of TSCARBitmap; Vertical: Boolean): TSCARBitmap;

var

i, j, w, h, x, y: Integer;

b, bw, bh: TIntArray;

begin

Result := TSCARBitmap.Create('');

h := high(BmpArr);

if (h < 1) then Exit;

for i := 0 to h do

if BitmapExists(BmpArr) then

begin

SetLength(b, j + 1);

SetLength(bw, j + 1);

SetLength(bh, j + 1);

b[j] := i;

bw[j] := BmpArr.Width;

bh[j] := BmpArr.Height;

Inc(j);

end;

if ((j - 1) < 1) then Exit;

if not Vertical then

begin

h := TIAMax(bh);

w := TIASum(bw);

end

else

begin

h := TIASum(bh);

w := TIAMax(bw);

end;

Result.SetSize(w, h);

for i := 0 to (j - 1) do

if not Vertical then

begin

BmpArr[b].DrawTo(Result, x, y);

x := x + BmpArr[b].Width;

end

else

begin

BmpArr[b].DrawTo(Result, x, y);

y := y + BmpArr[b].Height;

end;

end;

[/scar]

 

Next I'm going to make a bitmap debugging function with TSCARBitmapClient used inside of DebugATPA.

Edited by LordJashin
Link to comment
Share on other sites

I think I'll do TileBitmaps. Or maybe BitmapLine?

 

EDIT: Thing is...with tiling I think of this: http://images2.fanpop.com/images/photos/4000000/Obama-tiled-small-barack-obama-4063341-2200-1700.jpg

 

I think I'll go with Jani's approach with all the "Line" functions. So I'll call it BitmapLine...

Edited by LordJashin
Link to comment
Share on other sites

I updated OSI with the new changes. You can now use Debug functions on Bitmaps very easily:

 

[scar]

{$DEFINE OSIDebug}

{$I OSI/OSI.scar}

 

var

Bmp: TSCARBitmap;

 

begin

Bmp := TSCARBitmap.Create('deNrtncuZ6ygQRj2TlRNSHM7AO4UwK629dxLedAg3CI/1guJRCGRdt5HO+XrhRjICmaIA1S/+/ee/0xMAAAAAAAAAAAAAAA7Pz/18vv/kpwPsj+bS3CLJN5v+aE6Xk/1rr/K8azund00jDpn0HFO6dSfnEt1ttUXnXzSor181OA45jkD++2qx5rOXblqROKdvXc3jLa+0lXdbNgSs4KgsOIKwXf25nue+Oqe9vc5ZZwVjx950xhM5RbLuo71e2/P1z1I+D/stpy6zA2oewgpEuur72vMZqznSTEGmvJqBbNWiVVzf7GCj1zWN3/c7whJPl5QV+Jb4aISfMl90RkTSrPr853TN98H+nEM4UzDj7cSQW7YW2aNmOoKy1ptsfrn52Azn0o7ZSkfgu6HBWGK+CXa/ZGQT+5my9us75hN20dVYQab/et0KfMFhHIHXrvrmPY1G5IjCmS+sGy1kW4EzQw8n4KkR3dDPixGRrawyu3+6kwJR35cVdHiDozgCu1Jqh83jZzk8ONmePxhRLA6KoiulZhjWf30ug5yeBPl75RGDFluk8/Xe2HzkInDXNF4dg3yiibA7R1A2hgEAAAAAAAAAAAAAgL3y59q2PDaAI+E1+EdzuZymPxMgIBP7v/lh7f3spo+Hfu6tk9g9ZuPyTz7fU/lo3LpoJn5WTdeJQyY9Vt/uQTsA2cDm5vdqHl6YTNRH3M+iCb3a/xzHb5tx32itIbQiZLl1Wmksnwxv9Sqn+eylGwMR5zy6k1+vsKZw8LFQoj0krMA/JK1AHJ0/PDq3A1fzySmJMJmcr4d1TNcajkffVV5ObVRDoFhBbKThWo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Bmp);

DebugTBA([box(0, 0, 50, 50), Box(50, 50, 100, 100)]);

wait(3000);

HideDebugImgWindow;

Bmp.Free;

end.

[/scar]

Link to comment
Share on other sites

crypto nwo virus 10000 bitcoin pizza guy 1099 misc crypto blast2l.com scam buy bitcoin or wait when is the kar98k coming back how do you make money with cryptocurrency $fet crypto kilt crypto buying petrol oil with bitcoin us economy implodes shardbound crypto youtuber mediacoin how long does bitcoin transfer take link coin price

how to build cryptocurrency 3ull buy bitcoin no cap can i buy products at newegg with bitcoin how to buy bitcoin with litecoin on coinbase how do i use paypal money to buy bitcoins ethereurm price is it right tome to buy into bitcoin aave crypto loan utopia labs

400 million bitcoin purchase 0.00936974 bitcoin cash value crypto airdrop taxable event selling csgo skins for crypto do crypto airdrops work why airdrop crypto 50 cent album bitcoin bitcoin in 2012 sui tokens bonk news crypto

are crypto.com fees high capital of soma headway crunchbase bitcoin etf decision date internet computer crypto acura of valley stream bitcoin render price prediction 2025 how do i buy bitcoin on td ameritrade cheapest place to buy bitcoin with debit card how to make a cryptocurrency coin

plonky2 best crypto academy silta crypto dapps parker lewis bitcoin
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...