Board index » delphi » pasting multiple TImages into one TImage (FASTEST WAY)

pasting multiple TImages into one TImage (FASTEST WAY)

HI all.
I would like suggestions for the fastest way to paste multiple TImage into
one TImage  using pure delphi (not in ASM)
The TImages are all the same size and are stored in an Array of TImage.

known :

    - All images are the same size and Stretch=fasle must be assumed

    - All start on the same X plane when pasting and appear one under the
other

TIA

Ori
contr...@hotmail.com

 

Re:pasting multiple TImages into one TImage (FASTEST WAY)


Hai,
    TargetImage.Picture.Asssign(SourceImage.Picture) is the best way to copy
TImage. Only the Last Image of the Array of Images will be in the
TargetImage.

Regards.

Quote
"borland" <contr...@hotmail.com> wrote in message

news:3ea0633b$1@newsgroups.borland.com...
Quote
> HI all.
> I would like suggestions for the fastest way to paste multiple TImage into
> one TImage  using pure delphi (not in ASM)
> The TImages are all the same size and are stored in an Array of TImage.

> known :

>     - All images are the same size and Stretch=fasle must be assumed

>     - All start on the same X plane when pasting and appear one under the
> other

> TIA

> Ori
> contr...@hotmail.com

Re:pasting multiple TImages into one TImage (FASTEST WAY)


Hi,

    In case you want to overwrite the previous written image, then u can use
the method Jayasankar suggested. In case you want to tile the smaller images
onto a bigger image, check out the BitBLT function. Simply BitBLT the
smaller images onto the bigger one at the correct co ordinates.

Hope this helps,

Regards,
Ananth B.

Quote
"borland" <contr...@hotmail.com> wrote in message

news:3ea0633b$1@newsgroups.borland.com...
Quote
> HI all.
> I would like suggestions for the fastest way to paste multiple TImage into
> one TImage  using pure delphi (not in ASM) [snip]

Re:pasting multiple TImages into one TImage (FASTEST WAY)


Thanks. but ..

Got a blank TImage a result when I tries the following.

for i = 1 to 4 do
begin
    BitBlt(img[k,5].Picture.Bitmap.Canvas.Handle,0,0,w,h*i-h,
img[k,i].Picture.Bitmap.Canvas.Handle,0,0,cmSrcCopy);
end;
img[k,5].Picture.SaveToFile('c:\'+inttostr(k)+'.jpg');

Where W is the known width, and H is the known eight

I would appreciate any additional help on makoing this work.

TIA

Quote
"Ananth B." <ana...@agnisoft.com> wrote in message

news:3ea0fc37@newsgroups.borland.com...
Quote
> Hi,

>     In case you want to overwrite the previous written image, then u can
use
> the method Jayasankar suggested. In case you want to tile the smaller
images
> onto a bigger image, check out the BitBLT function. Simply BitBLT the
> smaller images onto the bigger one at the correct co ordinates.

> Hope this helps,

> Regards,
> Ananth B.

> "borland" <contr...@hotmail.com> wrote in message
> news:3ea0633b$1@newsgroups.borland.com...
> > HI all.
> > I would like suggestions for the fastest way to paste multiple TImage
into
> > one TImage  using pure delphi (not in ASM) [snip]

Re:pasting multiple TImages into one TImage (FASTEST WAY)


Hi,

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  i: integer;
begin
  for i := 0 to (Image2.Height div Image1.Picture.Bitmap.Height) - 1 do
  begin
    BitBLT(Image2.Canvas.Handle,
           0, i * Image1.Picture.Bitmap.Height, Image1.Picture.Bitmap.Width,
Image1.Picture.Bitmap.Height,
           Image1.Picture.Bitmap.Canvas.Handle, 0, 0, MERGECOPY);
  end;
end;

this code works fine for me, when the destination image height is a multiple
of the source. I used 128x128 source and a 128x512 destination.

Hope this helps,

Regards,
Ananth B.

Quote
"borland" <contr...@hotmail.com> wrote in message

news:3ea14bf1@newsgroups.borland.com...
Quote
> Thanks. but ..

> Got a blank TImage a result when I tries the following.

> for i = 1 to 4 do
> begin
>     BitBlt(img[k,5].Picture.Bitmap.Canvas.Handle,0,0,w,h*i-h, [snip]

Re:pasting multiple TImages into one TImage (FASTEST WAY)


Thanks but still no go...
Is there is a known problem with dynamically created TImages ?
For some reson when I savetofile from the original image I get BLANK!!!
So I assume that maybe something in the image type does'nt give.

The code seems to be fine, and I had the same code as you but DUNNO
!?!?!?!?!

I think I will have to go another route, but thanks anyway!

Ori

Quote
"Ananth B." <ana...@agnisoft.com> wrote in message

news:3ea16df3$4@newsgroups.borland.com...
Quote
> Hi,

> procedure TForm1.BitBtn1Click(Sender: TObject);
> var
>   i: integer;
> begin
>   for i := 0 to (Image2.Height div Image1.Picture.Bitmap.Height) - 1 do
>   begin
>     BitBLT(Image2.Canvas.Handle,
>            0, i * Image1.Picture.Bitmap.Height,

Image1.Picture.Bitmap.Width,
Quote
> Image1.Picture.Bitmap.Height,
>            Image1.Picture.Bitmap.Canvas.Handle, 0, 0, MERGECOPY);
>   end;
> end;

> this code works fine for me, when the destination image height is a
multiple
> of the source. I used 128x128 source and a 128x512 destination.

> Hope this helps,

> Regards,
> Ananth B.

> "borland" <contr...@hotmail.com> wrote in message
> news:3ea14bf1@newsgroups.borland.com...
> > Thanks. but ..

> > Got a blank TImage a result when I tries the following.

> > for i = 1 to 4 do
> > begin
> >     BitBlt(img[k,5].Picture.Bitmap.Canvas.Handle,0,0,w,h*i-h, [snip]

Re:pasting multiple TImages into one TImage (FASTEST WAY)


Quote
> Thanks but still no go...
> Is there is a known problem with dynamically created TImages ?
> For some reson when I savetofile from the original image I get BLANK!!!
> So I assume that maybe something in the image type does'nt give.

Are you setting the Height and Width property of the TImage? If not thats
probably why the image is blank.

DD

Re:pasting multiple TImages into one TImage (FASTEST WAY)


U'r right on !!
Thanks for the tip, works great as long as the image is visible first!

Ori

Quote
"Quivis" <qui...@ask.me.first> wrote in message

news:MPG.190bd34087666f2f9896af@newsgroups.borland.com...
Quote
> In article <3ea14...@newsgroups.borland.com>, contr...@hotmail.com
> says...

> -> img[k,5].Picture.SaveToFile('c:\'+inttostr(k)+'.jpg');

> I assume you're drawing another image onto a JPEG? I seem to recall
> that doesn't work very well. Try converting your JPEG to a bitmap
> before drawing on it.

> HTH

> Q.

Other Threads