Display part of image lazarus / 39-Graphics ---------------------------------------------------------------------- gyts · 2011-03-20 16:31 Is it possible to load bigger (f.e. 300x300) picture into smaller (f.e. 200x200) TImage and to order which part of picture should be loaded into. Maybe it's possible with other TObjects? ---------------------------------------------------------------------- Marc · 2011-03-21 10:01 You can load to picture ina TBitmap (or other graphic type) ad use a TPaintBox to draw the part of the picture yourself in an OnPaint event PS. I split and moved your post, please don't hijack other thread to post unrelated messages ---------------------------------------------------------------------- gyts · 2011-03-25 17:53 Can you give me an example? ---------------------------------------------------------------------- typo · 2011-03-25 18:27 Code: [Select]procedure TForm1.PaintBox1Paint(Sender: TObject);  var    r :TRect;  begin    r.Top := 0;    r.Left := 0;    r.Right := PaintBox1.Width;    r.Bottom := PaintBox1.Height;    PaintBox1.Canvas.CopyRect(r, Image1.Picture.Bitmap.Canvas, r);  end; ---------------------------------------------------------------------- gyts · 2011-03-25 18:46 Is it possible to rotate picture? ---------------------------------------------------------------------- typo · 2011-03-25 18:55 There are some algorithms. http://www.delphi-central.com/tutorials/RotateBitmapBitBlt.aspx http://delphi.about.com/cs/adptips2001/a/bltip1201_4.htm ---------------------------------------------------------------------- gyts · 2011-03-26 11:55 Quote from: typo on March 25, 2011, 07:55:32 pmhttp://delphi.about.com/cs/adptips2001/a/bltip1201_4.htm Identifier not found "TRGBTriple". What unit i should include? ---------------------------------------------------------------------- marcov · 2011-03-26 12:13 Quote from: typo on March 25, 2011, 07:55:32 pmThere are some algorithms. http://www.delphi-central.com/tutorials/RotateBitmapBitBlt.aspx http://delphi.about.com/cs/adptips2001/a/bltip1201_4.htm If you only need 90 or 270 degrees: (lot faster, think 1-4ms/MByte on modern hardware) http://stackoverflow.com/questions/848025/rotating-bitmaps-in-code ---------------------------------------------------------------------- gyts · 2011-03-28 10:04 http://www.delphiarea.com/products/delphi-components/rotateimage/. Is it possible to add it in Lazarus? ---------------------------------------------------------------------- marcov · 2011-03-28 15:33 Quote from: gyts on March 28, 2011, 12:04:05 pmhttp://www.delphiarea.com/products/delphi-components/rotateimage/. Is it possible to add it in Lazarus? That code looks very windowsspecific, but worse, it doesn't seem to have a compatible license. ---------------------------------------------------------------------- VTwin · 2011-03-28 20:52 I just posted rotate 90 code here: http://lazarus.firmos.at/index.php/topic,8282.0.html Cheers, Frederick ---------------------------------------------------------------------- VTwin · 2011-03-28 21:04 This works: Code: [Select]var   fPicture: TPicture;   fImage: TImage; procedure CopyRect(imgX, imgY, imgWidth, imgHeight,                               picX, picY, picWidth, picHeight: integer); {   Copies a retangular portion of fPicture to fImage. } var   bmp: TBitmap; begin   bmp := TBitmap.Create;   bmp.Width := picWidth;   bmp.Height := picHeight;   // get the portion of source (fPicture) to be displayed   bmp.Canvas.CopyRect(Rect(0, 0, picWidth, picHeight),     fPicture.Bitmap.Canvas, Rect(picX, picY, picX+picWidth, picY+picHeight));   // set destination to visible area of fImage   fImage.Picture.Bitmap.SetSize(fImage.Width, fImage.Height);   // do the copy   fImage.Picture.Bitmap.Canvas.StretchDraw(     Rect(imgX, imgY, imgX+imgWidth, imgY+imgHeight), bmp);   bmp.Free; end;      Cheers, Frederick