Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/09/22 in all areas

  1. You may remember that I was forced to reduce GExperts support for Delphi 6 a while ago, because the IDE no longer started on my computer. It turns out that it was a GExperts bug after all. The fix was simple once I knew what the problem was. And I only found out because carrchri, one of the few GExperts for Delphi 6 users, debugged it and told me. Thanks a lot! When I was able to use the Delphi 6 IDE again I also fixed incompatibilities in the DFMs that prevented some of the dialogs open in Delphi 6. So here is a new release. Apart from these two Delphi 6 related bug fixes there are some improvements ... read on in the blog post.
  2. Anders Melander

    Parallel Resampling of (VCL-) Bitmaps

    I was surprised that this was necessary at all as I really thought that the compiler already made this optimization. Anyway, basically a "for" loop like this (the loop value isn't used inside the loop): for i := LowValue to HighValue do begin ..stuff here end; is compiled to this pseudo code: var i := LowValue; var test := HighValue - i; if (test = 0) then goto end_loop; :start_loop ..stuff here Inc(i); var test := HighValue - i; if (test <> 0) then goto start_loop; :end_loop while this equivalent while loop: i := HighValue - LowValue; while (i >= 0) do begin ..stuff here Dec(i); end; is compiled to: var i := HighValue - LowValue; if (test = 0) then goto end_loop; :start_loop ..stuff here Dec(i); if (test <> 0) then goto start_loop; :end_loop Exact same code if iterating from zero in case you wondered. Similarly a for loop where the loop variable is used inside the loop is also slightly faster when implemented as a while loop.
  3. v3.3.0 Added HeightMultiplier property to TSkLabel to change the default line height; Added tag properties to TCustomWordsItem of TSkLabel; Added TItemClickedMessage to intercept the OnClick of all TCustomWordsItem of TSkLabel controls; Improvements in the OnClick triggering of TSkLabel items; Fixed many issues in Windows when using Skia4Delphi Canvas (including combobox dropdown); Fixed wrong colors in iOS with services when using Skia4Delphi Canvas: IFMXTakenImageService, IFMXCameraService, IFMXPhotoLibrary and IFMXShareSheetActionsService; Fixed effects and filters issue in Metal when using Skia4Delphi Canvas; Fixed wrong text size when using Skia4Delphi Canvas (fixing problems with TMemo and TTMSFMXHTMLText); Fixed AV in TSkLabel when the text of a TWordsItem starts with a sLineBreak; Fixed case-insensitive of image formats when saving images; Fixed wrong draws with stroke thickness zero when using Skia4Delphi Canvas; Fixed black screen startup on iOS in simple forms with only shapes when using Skia4Delphi Canvas; Fixed specific cases of performance issues in Windows when using Skia4Delphi Canvas; Fixed projects of RAD Studio 11; Fixed popup menu exception in rasterization mode when using Skia4Delphi Canvas; Fixed modulate color problem before RAD Studio 11.1 (which involves TintColor and TintIconColor properties on mobile); Minor improvements and fixes. Github: github.com/skia4delphi/skia4delphi Website: skia4delphi.org
  4. Renate Schaaf

    Parallel Resampling of (VCL-) Bitmaps

    I've managed to translate the alternative computation of weights into Graphics32. It was actually quite easy :). The idea is, to compute the intergral for the convolution with the filter via the midpoint-rule. Before I've used the exact antiderivatives, leading to constant underestimations of peaks and valleys in the bitmap function, and thus to a loss of detail. Now pixels not lying totally within the support of the filter get their weight reduced, leading to less artefacts, but the peaks are better estimated, so contrast and detail is better preserved (the math is for readability): //Precision of weights, //Totals Cb,Cg,Cr,Ca in Resample need to be unscaled by Prec * Prec const Prec = $800; function BuildMappingTableNew(DstLo, DstHi: Integer; ClipLo, ClipHi: Integer; SrcLo, SrcHi: Integer; Kernel: TCustomKernel): TMappingTable; var ... begin ... else if Scale < 1 then begin OldScale := Scale; Scale := 1 / Scale; FilterWidth := FilterWidth * Scale; for I := 0 to ClipW - 1 do begin if FullEdge then Center := SrcLo - 0.5 + (I - DstLo + ClipLo + 0.5) * Scale else Center := SrcLo + (I - DstLo + ClipLo) * Scale; Left := Floor(Center - FilterWidth); Right := Ceil(Center + FilterWidth); Count := -Prec; for J := Left to Right do begin //changed part x0 := J - Center; // old weight: Filter(x0*Oldscale)*Oldscale x1 := max(x0 - 0.5, -FilterWidth); x2 := min(x0 + 0.5, FilterWidth); // intersect symmetric interval of length 1 about x0 with support of scaled filter x3 := 0.5 * (x2 + x1); // new center Weight := Round(Prec * Filter(x3 * OldScale) * OldScale * (x2 - x1)); // intersection with support entered into the weight if Weight <> 0 then begin Inc(Count, Weight); K := Length(Result[I]); SetLength(Result[I], K + 1); Result[I][K].Pos := Constrain(J, SrcLo, SrcHi - 1); Result[I][K].Weight := Weight; end; end; ... At first the results were getting too dark and contrast was increased. By increasing the accuracy of the weights and using my own way of rounding the averaged result into bytes, this seems no longer the case: If RangeCheck then begin C.B := min((max(Cb, 0) + $1FFFFF) shr 22, 255); //unscale and round C.G := min((max(Cg, 0) + $1FFFFF) shr 22, 255); C.R := min((max(Cr, 0) + $1FFFFF) shr 22, 255); C.A := min((max(Ca, 0) + $1FFFFF) shr 22, 255); end else begin C.B := (Cb + $1FFFFF) shr 22; C.G := (Cg + $1FFFFF) shr 22; C.R := (Cr + $1FFFFF) shr 22; C.A := (Ca + $1FFFFF) shr 22; end; // Combine it with the background case CombineOp of dmOpaque: DstLine[I] := C.ARGB; ... The changed file uScalingProcsGR32.pas is attached. If you are interested in a test, here is a short video, zooms and pans have been done with the new Lanczos. The second picture is one of the most notorious in my collection. uScalingProcsGR32.zip
  5. In addition to the support of Delphi 11, the sources of a new demo thought for the mobiles are available. The CartoTrack demo is a tutorial to discover the basics of the component. TECNativeMap is an equivalent of Google Map without any use of a WebBrowser because it is 100% Delphi. It is available in VCL and FMX versions on all platforms supported by Delphi Download the trial version for Delphi 11 Download the trial version for Delphi 10.4.x 
  6. You forgot the "...which in turn import a ton of more libraries all of which may or may not contain some serious security issues" part 😉
×