Hi there,
please help me with this:

I'm working on small app. that displays a richtext,
smoothly scrolling.
For this first I created a metafile from the richtext using emformatrange.
No problem so far.

But then they asked to show the text mirrored, and inverse (white letters on
black),
so there's no need for an other mirror.

So lets see the code and the problem:

I have a picture of the richtext in Emf:

      Image1.Picture.Metafile.Assign(Emf);
// just to make sure I get the correct size
      Mirror.Width:=0;
      Mirror.Height:=0;
      Origin.Width:=0;
      Origin.Height:=0;

//Mirror and Origin are TBitmaps, declared in the main forms private
section, and created
//by the forms oncreate event.
//I set up them to zero size, to be sure, they don't contain any image
anymore.

      Mirror.Width:=Image1.Picture .Width;
      Origin.Width :=Mirror.Width;
// both of them should get the same size.
// the width is somwhat smaller than screen.width, about 32 pixels...

// the height depends on the richtext, actually when loaded onresizerequest
// gives the height for the given width.

      Mirror.Height := Image1.Picture.Height;
// the height can get extremely high, even more than 32000 pixel.

      Origin.Height:=Mirror.Height;

// when I try to set up the second bitmap height, I get
// out of system resources exception, when the text exceeds
// a certain size.

      Origin.Canvas.Draw(0,0,EMF);

// draw the emf on bitmap.

      StretchBlt(Mirror.Canvas.Handle,
       0,0,Mirror.Width+1,Mirror.Height+1,
       Origin.Canvas.Handle,Mirror.Width,
       0,-Mirror.Width,Mirror.Height,srcinvert);

// do the mirror and inverse.

--------
The above code works like a charm, when the richtext is not too large.
(I mean large in pixels).

Do you have an idea why I get out of system resources exception?
(Sure I could make some optimizations, but before, basicly it should work)
The last I tryed with a sample richtext the height gets 11084 pixels.
This causes the exception, but with another sample wich gives 6954 pixels
height, just stretchblt fails without exception,
however absolutely no problem with a 2155 pixels height sample.

What does limit me in stretchblt, and why could limit system resource?
Looking at taskmanager, the project is far-far within the systems resources.

Thank you very much in advance for any help or idea.

By(t)e

Laca
www.kovacslt.fw.hu
mailto:[EMAIL PROTECTED]

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to