Jump to content

XylemFlow

Members
  • Content Count

    75
  • Joined

  • Last visited

Community Reputation

8 Neutral

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. XylemFlow

    Delphi Documentation website issues

    Thanks for the update. Do you have a link to an official comment or something?
  2. XylemFlow

    3D render engine that works with Delphi

    FMX has built in 3D capability. Just add a new multi device form and select 3D form and go from there. Or is that not functional enough for your needs? http://docwiki.embarcadero.com/RADStudio/Athens/en/FireMonkey_3D
  3. Is anyone else experiencing issue getting the documentation (help files) to load online? The pages take ages to load and will often say gateway timed out. https://docwiki.embarcadero.com/Libraries/Athens/en/Main_Page
  4. XylemFlow

    Loading and Saving PNG into TBitmap changes the image

    For my application it's very unlikely that image data would not need to be displayed so I wouldn't save much by doing it on demand. At least I would only need to do it for images containing an alpha channel though. It's true that the stream data is compressed. However, the original image in this case was bit depth 64, which FMX converts to bit depth 32 when loaded. I didn't share that version because it was over 1.2MB, whereas the 32bit version was only 100KB. So if I save it as a stream when it first gets loaded it would still be quite large. I may therefore save it to a stream after it gets loaded into the TBitmap, which would mean that it would still suffer from one level of degradation, but at least it wouldn't continue to lose quality each time the binary was loaded and saved, and would use less memory.
  5. XylemFlow

    Loading and Saving PNG into TBitmap changes the image

    Thank you. The problem is that storing as TMemoryStream requires reading into a TBitmap each time it needs displaying. That would require too much delay for real time graphics. I could keep a copy of each image as a stream and a bitmap but that would double up the memory requirements. That may be the only option though.
  6. XylemFlow

    Loading and Saving PNG into TBitmap changes the image

    Attached is a WebP animation showing the first 25 load / save cycles. Untitled.webp
  7. XylemFlow

    Loading and Saving PNG into TBitmap changes the image

    Thanks for the idea. I will look into it. The worst thing is that the issue also happens with TBitmap.LoadFromStream and TBitmap.SaveToStream. This is not surprising since that's what the file load and save functions are using. Note that TBitmap.SaveToStream by default saves as PNG data. Below is code that demonstrates this. I have also attached the resulting first few images, and the last one after 40 load/save cycles showing the issue very clearly. procedure TForm1.Button2Click(Sender: TObject); var bmp : TBitmap; i : Integer; name : String; strm : TMemoryStream; begin bmp := TBitmap.Create; name := 'whiteglower_8bit'; bmp.LoadFromFile(name + '1.png'); strm := TMemoryStream.Create; for i := 1 to 40 do begin strm.Seek(0, 0); bmp.SaveToStream(strm); strm.Seek(0, 0); bmp.LoadFromStream(strm); bmp.SaveToFile(name + IntToStr(i+1) + '_stream.png'); end; bmp.Free; strm.Free; end; This is closer to my use case. My application allows users to save their project in a binary file, which can contain image data like this as well as other data. LoadFromStream and SaveToStream are used to load and save the image data. Each time the user loads a project to work on it and saves it, the quality of the image deteriorates (when alpha channels are used as they often are). This is true whether or not the user modified the image data. This is very bad and I need to find a fix soon if possible. I had assumed incorrectly that saving and loading image data would not change the image data.
  8. XylemFlow

    Loading and Saving PNG into TBitmap changes the image

    No, as I said I'm using Delphi 11.2.
  9. I have some code that loads a png image into a TBitmap and saves it again. However, the output is not the same. The quality of the image seems to deteriorate every time the previous image is loaded and then saved again. I have attached the PNG image, which contains an alpha channel. The original image has a smooth gradient, but the last one clearly doesn't with clear banding. Does anyone know why this may be? I can perhaps understand why the 2nd image may be different since some aspects of the original PNG may not be supported, but I can't understand why subsequent images would vary to the 2nd image. This would indicate that Delphi FMX cannot correctly load an image that it saved. I'm running on Windows 32 bit and using Delphi 11.2 with default project settings. I'm comparing the images by viewing in Gimp and also by comparing in WinMerge. Even the file sizes vary. procedure TForm1.Button1Click(Sender: TObject); var bmp : TBitmap; i : Integer; name : String; begin bmp := TBitmap.Create; name := 'whiteglower_8bit'; for i := 1 to 4 do begin bmp.LoadFromFile(name + IntToStr(i) + '.png'); bmp.SaveToFile(name + IntToStr(i+1) + '.png'); end; bmp.Free; end;
  10. XylemFlow

    Group a collection of drawn objects to have a single opacity

    Unfortunately I need to draw everything directly on a single TCanvas. I cannot do it by layering controls on top of each other. One reason is because I need to export the resulting image. By sharing the same opacity I mean that they should be semi transparent and so show previously drawn objects underneath
  11. I need to be able to draw several objects to a form or TImage TCanvas, including lines, circles, polygons, text, etc and have them drawn as a group with a single opacity. If I draw them separately then it won't look correct where they overlap. I currently do this by drawing the objects to an offscreen TBitmap canvas with full opacity and then drawing the TBitmap to my form or TImage TCanvas with the opacity I want. However, this is slower and uses more memory. I'd also like to use Skia in future, but I understand that drawing to offscreen bitmaps is slower since it doesn't use the GPU. Is there a method to group objects in this way in default FMX or Skia without using an offscreen bitmap?
  12. If you want to change the style of the whole window then it's easier to download a theme style. You can download FMX styles or a VCL style and convert it to a VCL style using Bitmap Style Designer. You can then modify the style if needed. The critical part of the style for the window is windowborderstyle.
  13. XylemFlow

    Issue with TNumberBox

    It seems that this isn't only an issue with TNumberBox. TSpinBox does it too. I think anything descended from TCustomEdit. My best guess is that the control is validated when deleting selected text because there is no caret shown.
  14. XylemFlow

    Issue with TNumberBox

    Thanks Mike. Setting VertIncrement to 0 solves the first issue. I have also set HorzIncrement to 0 so that dragging selects the text without changing the value. Unfortunately that means that the arrow keys and mouse wheel no longer increment the value, but I was able to implement that myself using the KeyDown and MouseWheel events. So yes, it is a bit of a mess, but otherwise it works ok. One advantage is that it automatically prevents non numeric characters and supports copy and paste. Ctrl+A does work for me.
  15. XylemFlow

    Issue with TNumberBox

    I've not tried VCL, only FMX. Interesting that it's not happening in VCL though. Also, I'm using 11.2. I have some boxes ranging from -360 to 360, some from -180 to 180 and some from 0 to 100. They all behave the same way.
×