Erik N
asked on
Inverting and decreasing colors in bitmap...
I use the following to get a screen-capture. However, I want to decrease the colordepth, invert the colors and maybe decrease the resolution. Is this possible ?
Thanx !
/Erik N
procedure TForm3.BitBtn3Click(Sender : TObject);
var
DC:HDC;
Bmp:TBitmap ;
begin
Application.minimize;
sleep(Delay);
DC:=getDC(GetDeskTopWindow );
Bmp:=TBitmap.Create;
Bmp.Width:=Screen.Width;
Bmp.Height:=Screen.Height;
BitBlt(Bmp.Canvas.Handle,0 ,0,Screen. Width,Scre en.Height, DC,0,0,SRC COPY);
Image1.Picture.Bitmap:=Bmp ;
ReleaseDC(DC,DC);
Bmp.Free;
Application.restore;
end;
Thanx !
/Erik N
procedure TForm3.BitBtn3Click(Sender
var
DC:HDC;
Bmp:TBitmap ;
begin
Application.minimize;
sleep(Delay);
DC:=getDC(GetDeskTopWindow
Bmp:=TBitmap.Create;
Bmp.Width:=Screen.Width;
Bmp.Height:=Screen.Height;
BitBlt(Bmp.Canvas.Handle,0
Image1.Picture.Bitmap:=Bmp
ReleaseDC(DC,DC);
Bmp.Free;
Application.restore;
end;
You can also use StretchBlt instead of BitBlt...
I never tried it but maybe InvertRect can be used to invert the colors.
BitBlt( Bmp.Canvas.Handle, 0, 0, Screen.Width, Screen.Height, 0, 0, 0, DSTINVERT ) ;
Will invert the colors...
As Epsylon said, StretchBlt will reduce the resoloution, and as for reducing colors, you might have to create another bitmap, set its pixelformat to whatever (as Epsylon said again), and then BitBlt the bitmap across...
If that doesn't work, then you are into some hefty color reduction algorythms (boo) ;O)
Good Luck,
Tim.
Will invert the colors...
As Epsylon said, StretchBlt will reduce the resoloution, and as for reducing colors, you might have to create another bitmap, set its pixelformat to whatever (as Epsylon said again), and then BitBlt the bitmap across...
If that doesn't work, then you are into some hefty color reduction algorythms (boo) ;O)
Good Luck,
Tim.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, I forgot to strip-out the line
BitBlt(Bmp.Canvas.Handle,0 ,0,Screen. Width,Scre en.Height, DC,0,0,SRC COPY);
BitBlt(Bmp.Canvas.Handle,0
ASKER
Nice !
Image1.Picture.Bitmap.Pixe
To resize set Image1.Stretch to true and change Image1.Width and Image1.Height