• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by mos
 -  4 June 2009, 20:05:23
Yes you have right, now I have seen that in FreePascal the CopyMemory is implemented through a Move! Under Windows I have always used winapi CopyMemory  :(

I must read the FreePascal documentation.

Thanks for your suggestion.
Posted by Galfar
 -  4 June 2009, 18:30:17
Move procedure from RTL takes dereferenced pointers as arguments, so you'll need to use it this way:

Move(FImage.Bits^, gbuff^, s);

Btw why do you use CopyMemory instead of Move in Windows?
Posted by mos
 -  4 June 2009, 11:50:48
I have the necessity to store in a buffer the bits image so I use this code:


  ...
    FBitmap: TImagingBitmap;
    FImage: TSingleImage;
    s: LongInt;
    gbuff: Pointer;
  ...

  FImage := TSingleImage.Create;
  FBitmap := TImagingBitmap.Create;
  Image.Picture.Graphic := FBitmap;
  ...
  FImage.LoadFromFile('test.jpg');
  Image.Picture.Graphic.Assign(FImage);
  s := FImage.Size;
  GetMem(gbuff, s);
  {$ifdef Linux}
  Move(FImage.Bits, gbuff, s);
  {$endif}
  {$ifdef Win32}
  CopyMemory(gbuff, FImage.Bits, s);
  {$endif}


The code work well under Windows but under Linux I get an exception on Move instruction.

I use Lazarus 0.9.26 & fpc 2.2.2, WinXP+SP2, Linux Fedora Core 8.

In the attached file there is the complete source code.


Can you help me?

Thanks & goodbye
SMF spam blocked by CleanTalk