Recent Posts

Pages: [1] 2 3 4 ... 10
1
Help & Questions / Re: MacOs 64
« Last post by Galfar on 7 August 2019, 01:13:21 »
It's fixed now.
Many changes were needed actually, Delphi macOS and Linux 64bit targets have LongInt/LongWord 64bit in size. It stays 32bit for Win64 and for all FPC targets.
2
Help & Questions / Re: MacOs 64
« Last post by Galfar on 3 August 2019, 23:56:14 »
I've updated my Delphi Community Ed. so I can have a look at this in next few days.
3
Help & Questions / MacOs 64
« Last post by JordiMonty on 1 August 2019, 17:52:13 »
Hello, I'm testing new Delphi 10.3 to build a MacOs64 bit application, and the library only compiles in 32bit mode.

TLongIntArray = array[0..MaxInt div 4 - 1] of LongInt;
[dccosx64 Error] ImagingUtility.pas(47): E2100 Data type too large: exceeds 2 GB

Are there any plans to support it?

Thank you,
Jordi
4
Bugs And Other Insects / Re: Range error when adding images to TMultiImage
« Last post by Galfar on 3 July 2019, 16:31:30 »
Thanks for the fixes, I'll add them to the repository.
TSingleImage and especially TMultiImage are not used and tested that much unfortunately.
5
Bugs And Other Insects / Range error when adding images to TMultiImage
« Last post by Patman on 3 July 2019, 15:03:13 »
Windows 7 x64
Delphi RAD Studio 10.2
Vampyre Imaging latest snapshot
-----

Error occurs when adding mipmaps to MultiImage before exporting to DDS. Like this:

Code: Pascal
  1. var
  2.   LImage: TMultiImage;
  3.   LImageCanvas: TImagingCanvas;
  4.   LImageMipMaps: TDynImageDataArray;
  5. begin
  6.           ...
  7.           LImage.Format := ifDXT5;
  8.           Imaging.GenerateMipMaps(LImage.ImageDataPointer^, 10, LImageMipMaps);
  9.           LImage.AddImages(LImageMipMaps);
  10.           FreeImagesInArray(LImageMipMaps);
  11.           LImage.SaveMultiToFile(ToDir + ToMaterial + '.dds');
  12.           ...
  13. end;

LImage has only 1 image when AddImages is called to add 10 mipmaps.
Getting range error from System.Move operation in ImagingClasses::PrepareInsert:

Code: Pascal
  1. function TMultiImage.PrepareInsert(Index, Count: Integer): Boolean;
  2. var
  3.   I: Integer;
  4. begin
  5.   // Inserting to empty image will add image at index 0
  6.   if GetImageCount = 0 then
  7.     Index := 0;
  8.  
  9.   if (Index >= 0) and (Index <= GetImageCount) and (Count > 0) then
  10.   begin
  11.     SetLength(FDataArray, GetImageCount + Count);
  12.     if Index < GetImageCount - 1 then
  13.     begin
  14.       // Move imges to new position
  15.       System.Move(FDataArray[Index], FDataArray[Index + Count],
  16.         (GetImageCount - Count - Index) * SizeOf(TImageData));
  17.       // Null old images, not free them!
  18.       for I := Index to Index + Count - 1 do
  19.         InitImage(FDataArray[I]);
  20.     end;
  21.     Result := True;
  22.   end
  23.   else
  24.     Result := False;
  25. end;

The System.Move and InitImage loop are for handling insertions via InsertImage(s) procedures, but it is also executed for all AddImage(s) procedures, which always add to the end of the array.
I changed it to the following (not tested for all InsertImage(s) and AddImage(s) operations):

Code: Pascal
  1. function TMultiImage.PrepareInsert(Index, Count: Integer): Boolean;
  2. var
  3.   I, LImageCount: Integer;
  4. begin
  5.   // Inserting to empty image will add image at index 0
  6.   LImageCount := GetImageCount;
  7.   if LImageCount = 0 then
  8.     Index := 0;
  9.  
  10.   if (Index >= 0) and (Index <= LImageCount) and (Count > 0) then
  11.   begin
  12.     SetLength(FDataArray, LImageCount + Count);
  13.     if Index <= LImageCount - 1 then
  14.     begin
  15.       // Move images to new position
  16.       System.Move(FDataArray[Index], FDataArray[Index + Count], (GetImageCount - Count - Index) * SizeOf(TImageData));
  17.       // Null old images; do not free them!
  18.       for I := Index to Index + Count - 1 do
  19.         InitImage(FDataArray[I]);
  20.     end;
  21.     Result := True;
  22.   end
  23.   else
  24.     Result := False;
  25. end;


Secondly, this appears to be a bug:

Code: Pascal
  1. procedure TMultiImage.InsertImages(Index: Integer;
  2.   const Images: TDynImageDataArray);
  3. begin
  4.   DoInsertImages(Index, FDataArray);
  5. end;

Which should be:

Code: Pascal
  1. procedure TMultiImage.InsertImages(Index: Integer;
  2.   const Images: TDynImageDataArray);
  3. begin
  4.   DoInsertImages(Index, Images);
  5. end;
6
Help & Questions / Re: Cropping image possible?
« Last post by pka4916 on 31 May 2019, 19:03:59 »
Thanks.
I figured it out with what you mentioned :)
7
Help & Questions / Re: Cropping image possible?
« Last post by Galfar on 31 May 2019, 15:47:53 »
There's no simple CropImage function but you can
do the two steps that CropImage would do:

1. Create new image with size the same as desired crop rectangle (NewImage)
2. Copy part of the original image to the new one (CopyRect) with proper SrcX and SrcY parameters.
8
Help & Questions / Cropping image possible?
« Last post by pka4916 on 23 May 2019, 01:26:17 »
Is it possible to crop an image?
I have scanned a photo and i want to cut off all the blank parts,   is there a way to  take only a part of an page?

Thank you
9
Help & Questions / [Fixed] Convert dds to png into a stream
« Last post by Shira on 3 May 2019, 19:01:14 »
Hi, I am able to load a .dds file and save it to a .png, but how can do I to onto a stream instead?

This generates an empty file:

Code: [Select]
Var Img: TImageData;
      tm: TMemoryStream;

  tm := TMemoryStream.Create;
  InitImage(Img);
  LoadImageFromFile('Z:\xx.dds', Img);
  SaveImageToStream('.png',tm,Img);
  tm.SaveToFile('z:\xxx.png');
  tm.free;
  FreeImage(Img);

Edit: found the issue, '.png' -> 'png'
10
Help & Questions / Re: Convert png with transparency to a bitmap
« Last post by Galfar on 20 March 2019, 13:38:31 »
You can call ReplaceColor multiple times, once for each color.
Pages: [1] 2 3 4 ... 10