Board index » delphi » Rotating Bitmaps Under NT Please Help

Rotating Bitmaps Under NT Please Help

 I have been able to plgblt a rectangle to another rectangle at 90 degrees
or a rectangle to a skewed parallelogram. I  have had no Luck in doing the
reverse have been told by Microsoft that it can be done However they didn't
have a solution have attached a GIF file with a red parallelogram and a
blue rectangle If anyone has an idea of how to plgblt the contents of  the
red parallelogram to the blue rectangle I would greatly appreciate it I
have been going nut trying to do it
        Thank you
        Adam

 

Re:Rotating Bitmaps Under NT Please Help


Adam Roslon <ros...@iconn.net> wrote in article
<01bce546$e7827810$a380abcf@rc-1>...

Quote
>  I have been able to plgblt a rectangle to another rectangle at 90
degrees
> or a rectangle to a skewed parallelogram. I  have had no Luck in doing
the
> reverse have been told by Microsoft that it can be done However they
didn't
> have a solution have attached a GIF file with a red parallelogram and a
> blue rectangle If anyone has an idea of how to plgblt the contents of
the
> red parallelogram to the blue rectangle I would greatly appreciate it I
> have been going nut trying to do it
>    Thank you
>    Adam

begin 600 plgblt.gif
<encoded_portion_removed>
end

Re:Rotating Bitmaps Under NT Please Help


Quote
Adam Roslon wrote:

> Adam Roslon <ros...@iconn.net> wrote in article
> <01bce546$e7827810$a380abcf@rc-1>...
> >  I have been able to plgblt a rectangle to another rectangle at 90
> degrees
> > or a rectangle to a skewed parallelogram. I  have had no Luck in doing
> the
> > reverse have been told by Microsoft that it can be done However they
> didn't
> > have a solution have attached a GIF file with a red parallelogram and a
> > blue rectangle If anyone has an idea of how to plgblt the contents of
> the
> > red parallelogram to the blue rectangle I would greatly appreciate it I
> > have been going nut trying to do it
> >       Thank you
> >       Adam

        So _that's_ what a paralleogram is! Thanks for including the gif.
(Um, actually that red object is something known in mathematical circles
as a "rectangle" - of course rectangles are parallelograms...)

        Doing your transformation "by hand" is much nicer than it used
to be because of TBitmap.ScanLine. Of course it won't be quite as fast
as plgblt, but it will be faster than you expect. I don't have NT so I
can't experiment with PlgBLT, but I can give you a hint: If you transform
the rectangle ABCD in Figure 1 to A'B'C'D' that should take the black
parallelogram to the black rectangle. More or less - I just made up the
numbers to give a general idea:

procedure TForm1.Figure1(Sender: TObject);
begin
with Canvas do
begin
  Brush.Style:= bsClear;
  Rectangle(30, 30, 330, 230);
  TextOut(10, 10,'A');
  TextOut(10, 250, 'B');
  TextOut(340, 250, 'C');
  TextOut(340, 10, 'D');
  Polygon([Point(400,30),Point(400,230),Point(700,280),Point(700,80)]);
  TextOut(380,10,'A''');
  TextOut(380, 250, 'B''');
  TextOut(720, 300, 'C''');
  TextOut(720, 60, 'D''');
  Brush.Style:= bsSolid;
  Brush.Color:= clBlack;
  Polygon([Point(50,100),Point(50,200),Point(310,150),Point(310,50)]);
  Rectangle(420,100,680,200);
end;
end;

--
David Ullrich

sig.txt not found

Re:Rotating Bitmaps Under NT Please Help


David, Thanks for the reply
I guess I'm still confused I thought scanline only returns horizontal
lines. I'm trying to take the contents of the canvas of a skewed region
turn it  so it is Horizontal and enlarge it  In the example you gave me If
I could copy the contents of the Left polygon to the Right Polygon it would
do it.
 kind of like CopyRect
Thanks Adam

Re:Rotating Bitmaps Under NT Please Help


Quote
Adam Roslon wrote:

> David, Thanks for the reply
> I guess I'm still confused I thought scanline only returns horizontal
> lines. I'm trying to take the contents of the canvas of a skewed region
> turn it  so it is Horizontal and enlarge it  In the example you gave me If
> I could copy the contents of the Left polygon to the Right Polygon it would
> do it.
>  kind of like CopyRect

        Well, the picture was supposed to be a hint regarding how to do
it with PlgBLT. I can't give you any more than a hint because I can't try
it.

        Yes, Scanline gives you one line at a time. So? You can use it
to get and set the value of whatever pixels you wish, hence to do whatever
transformation you wish. Depending on what you're doing you might want
to make a copy of a line or all the lines, or you could go through
and make your modifications one pixel at a time. (Or you could use
GetDIBits).

--
David Ullrich

sig.txt not found

Other Threads