AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Firemonkey FillEllipse Problem
Thema durchsuchen
Ansicht
Themen-Optionen

Firemonkey FillEllipse Problem

Ein Thema von CHackbart · begonnen am 9. Apr 2014 · letzter Beitrag vom 10. Apr 2014
 
CHackbart

Registriert seit: 22. Okt 2012
265 Beiträge
 
#1

Firemonkey FillEllipse Problem

  Alt 9. Apr 2014, 10:00
Hi,

hat jemand eventuell eine Idee warum unter Android und iOS eine Ellipse aus so wenigen Polygonen besteht?
Anbei mal ein Beispiel einer Control die lediglich einen Aufnahmeknopf zeichnet. Was unter Windows ausschaut wie es soll, wirkt auf den Mobilgeräten nicht wirklich attraktiv:

Delphi-Quellcode:
unit URecordButton;

interface

uses System.SysUtils, System.Classes, System.Types, System.UITypes,
  FMX.Graphics, FMX.Types, FMX.Controls, FMX.Objects;

type
  TRecordButton = class(TShape)
  protected
    FRecording: Boolean;
    FDiameter: single;

    procedure Paint; override;
    procedure SetDiameter(const Value: single);
  public
    constructor Create(AOwner: TComponent); override;
  published
    property Diameter: single read FDiameter write SetDiameter;
    property Recording: Boolean read FRecording write FRecording;
    property Align;
    property Anchors;
    property ClipChildren default false;
    property ClipParent default false;
    property DesignVisible default True;
    property Enabled default True;
    property Locked default false;
    property Height;
    property HitTest default True;
    property Padding;
    property Opacity;
    property Margins;
    property PopupMenu;
    property position;
    property RotationAngle;
    property RotationCenter;
    property Scale;
    property Visible default True;
    property Width;

    { Mouse events }
    property OnClick;
    property OnDblClick;

    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnMouseWheel;
    property OnMouseEnter;
    property OnMouseLeave;

    property OnPainting;
    property OnPaint;
    property OnResize;
  end;

implementation

constructor TRecordButton.Create(AOwner: TComponent);
begin
  inherited;

  Fill.color := $FFFF0000;
  Stroke.color := $FFFFFFFF;
  Stroke.Kind := TBrushKind.bkSolid;
  Diameter := 32;
end;

procedure TRecordButton.SetDiameter(const Value: single);
begin
  FDiameter := Value;
  Stroke.Thickness := FDiameter / 20;
end;

procedure TRecordButton.Paint;
var
  perc, w: single;
  xp, yp: single;
  color: TAlphaColor;
begin
  if FRecording then
    perc := 0.4
  else
    perc := 0.85;

  w := perc * FDiameter;
  xp := (Width - w) / 2;
  yp := (FDiameter - w) / 2;

  if FRecording then
    canvas.FillRect(RectF(xp, yp, xp + w, yp + w), 0.2 * w, 0.2 * w,
      AllCorners, 1, Fill)
  else
    canvas.FillEllipse(RectF(xp, yp, xp + w, yp + w), 1, Fill);

  xp := (Width - FDiameter) / 2;
  yp := 0;

  canvas.DrawEllipse(RectF(xp, yp, xp + Diameter, yp + Diameter), 1, Stroke);
end;

end.
Christian

Geändert von CHackbart ( 9. Apr 2014 um 10:12 Uhr)
  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 21:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz