AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Mobile: Wie können dem ImageViewer1 verschiedene .jpgs zugewiesen werden?
Thema durchsuchen
Ansicht
Themen-Optionen

Mobile: Wie können dem ImageViewer1 verschiedene .jpgs zugewiesen werden?

Ein Thema von Sel2012 · begonnen am 1. Nov 2015 · letzter Beitrag vom 3. Nov 2015
 
mensch72

Registriert seit: 6. Feb 2008
838 Beiträge
 
#15

AW: Mobile: Wie können dem ImageViewer1 verschiedene .jpgs zugewiesen werden?

  Alt 2. Nov 2015, 16:50
google: "fmx load jpg"

-> http://stackoverflow.com/questions/2...ling-in-delphi
In FireMonkey, graphics are handled using specialized classes derived from FMX.Graphics.TCustomBitmapCodec that are registered with the FMX.Graphics.TBitmapCodecManager class. You use the general-purpose FMX.Graphics.TBitmap class for handling all graphics. When loading a graphic, it uses the appropriate registered codec (if it can find one), but when saving you have to specify the codec you want to use.

FireMonkey uses different codec implementations for each platform, thus there is no single class that you can subclass, like there is in VCL. So, in order to customize JPEG handling in FireMonkey, you will have to create your own TCustomBitmapCodec-derived codec and register it with TBitmapCodecManager (unregistering the existing classes for the .jpg and .jpeg file extensions). Here are the codec classes that FireMonkey currently implements:

Windows: TBitmapCodecWIC in FMX.Canvas.D2D.pas
OSX: TBitmapCodecQuartz in FMX.Canvas.Mac.pas
iOS: TBitmapCodecQuartz in FMX.Canvas.iOS.pas
Android: TBitmapCodecAndroid in FMX.Canvas.Android.pas
Using {$IFDEF} statements, you might be able to utilize those existing classes inside of your custom codec as needed.

-> http://codeverge.com/embarcadero.del...a-jpeg/1085948
But I looked into some FMX sources and searched for "JPEG" and found a code snippet that works. Here it is:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  Filter: TBitmapCodec;
  TempBitmap: TBitmap;
begin
  if OpenDialog1.Execute then begin
    TempBitmap := TBitmap.Create(0, 0);
    Filter := DefaultBitmapCodecClass.Create;
    Filter.LoadFromFile(OpenDialog1.FileName, 0, TempBitmap);
    ImageControl1.Bitmap.Assign(TempBitmap);
    Filter.Free;
    TempBitmap.Free;
  end;
end;
And the JPEG appears! - See more at: http://codeverge.com/embarcadero.del....3YuJ46k0.dpuf
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:38 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz