GDI+ in firemonkey has problem??!!!

i want use gdi+ in firemonkey xe3
i have error : code is
{code}
procedure printf(Sender: TCanvas;left,top:integer;text:widestring;font:tfont;all_width,all_height:integer);
  var AGraphics       : IGPGraphics;
  AFont           : IGPFont;
  APath           : IGPGraphicsPath;
  oo:TGPStringFormat;siz:TGPSizeF;
  //MATRIS:TGPMatrix;
begin
  AFont := TGPFont.Create(Form1.Canvas.Font.Family,Form1.Canvas.Font.size, font.Style,UnitPixel);


// I HAVE ERROR this line for SENDER 
  AGraphics := TGPGraphics.Create(Sender);    
// error is : [dcc32 Error] Unit1.pas(39): E2250 There is no overloaded version of 'Create' that can be called with these arguments


  AGraphics.SmoothingMode := SmoothingModeAntiAlias;
  AGraphics.InterpolationMode:=InterpolationModeHighQuality;
  AGraphics.TextRenderingHint := TextRenderingHintAntiAliasGridFit;
  siz:=AGraphics.MeasureStringF(text,aFont,nil);
  if all_width<>0 then left:=left+round((all_width/2)-(siz.Width/2));
  if all_height<>0 then top:=top+round((all_height/2)-(siz.Height/2));
  APath:=TGPGraphicsPath.Create();
  APath.SetFillMode(FillModeWinding);
  OO:=TGPStringFormat.Create();
  OO.GenericTypographic();
  APath.AddString(text,AFont,MakePoint(left,top),oo);
  AGraphics.FillPath(TGPSolidBrush.Create(MakeColor(font.Color)),APath);
end;
{code}
0
reza2
2/19/2013 9:10:24 AM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

4 Replies
2236 Views

Similar Articles

[PageSpeed] 13
Get it on Google Play
Get it on Apple App Store

> {quote:title=reza2 babaee2 wrote:}{quote}
> i want use gdi+ in firemonkey xe3
> i have error : code is
> {code}
> procedure printf(Sender: TCanvas;left,top:integer;text:widestring;font:tfont;all_width,all_height:integer);
>   var AGraphics       : IGPGraphics;
>   AFont           : IGPFont;
>   APath           : IGPGraphicsPath;
>   oo:TGPStringFormat;siz:TGPSizeF;
>   //MATRIS:TGPMatrix;
> begin
>   AFont := TGPFont.Create(Form1.Canvas.Font.Family,Form1.Canvas.Font.size, font.Style,UnitPixel);
> 
> 
> // I HAVE ERROR this line for SENDER 
>   AGraphics := TGPGraphics.Create(Sender);    
> // error is : [dcc32 Error] Unit1.pas(39): E2250 There is no overloaded version of 'Create' that can be called with these arguments
> 
> 
>   AGraphics.SmoothingMode := SmoothingModeAntiAlias;
>   AGraphics.InterpolationMode:=InterpolationModeHighQuality;
>   AGraphics.TextRenderingHint := TextRenderingHintAntiAliasGridFit;
>   siz:=AGraphics.MeasureStringF(text,aFont,nil);
>   if all_width<>0 then left:=left+round((all_width/2)-(siz.Width/2));
>   if all_height<>0 then top:=top+round((all_height/2)-(siz.Height/2));
>   APath:=TGPGraphicsPath.Create();
>   APath.SetFillMode(FillModeWinding);
>   OO:=TGPStringFormat.Create();
>   OO.GenericTypographic();
>   APath.AddString(text,AFont,MakePoint(left,top),oo);
>   AGraphics.FillPath(TGPSolidBrush.Create(MakeColor(font.Color)),APath);
> end;
> {code}

===========
just define AGraphics as TGPGraphics instead of IGPGraphics...
and handover the canvas handle!

cheers,
Peter

Edited by: Peter Wichenthaler-Sternbach on Feb 19, 2013 2:14 AM
0
Peter
2/19/2013 10:17:38 AM
> {quote:title=Peter Wichenthaler-Sternbach wrote:}{quote}
> > {quote:title=reza2 babaee2 wrote:}{quote}
> > i want use gdi+ in firemonkey xe3
> > i have error : code is
> > {code}
> > procedure printf(Sender: TCanvas;left,top:integer;text:widestring;font:tfont;all_width,all_height:integer);
> >   var AGraphics       : IGPGraphics;
> >   AFont           : IGPFont;
> >   APath           : IGPGraphicsPath;
> >   oo:TGPStringFormat;siz:TGPSizeF;
> >   //MATRIS:TGPMatrix;
> > begin
> >   AFont := TGPFont.Create(Form1.Canvas.Font.Family,Form1.Canvas.Font.size, font.Style,UnitPixel);
> > 
> > 
> > // I HAVE ERROR this line for SENDER 
> >   AGraphics := TGPGraphics.Create(Sender);    
> > // error is : [dcc32 Error] Unit1.pas(39): E2250 There is no overloaded version of 'Create' that can be called with these arguments
> > 
> > 
> >   AGraphics.SmoothingMode := SmoothingModeAntiAlias;
> >   AGraphics.InterpolationMode:=InterpolationModeHighQuality;
> >   AGraphics.TextRenderingHint := TextRenderingHintAntiAliasGridFit;
> >   siz:=AGraphics.MeasureStringF(text,aFont,nil);
> >   if all_width<>0 then left:=left+round((all_width/2)-(siz.Width/2));
> >   if all_height<>0 then top:=top+round((all_height/2)-(siz.Height/2));
> >   APath:=TGPGraphicsPath.Create();
> >   APath.SetFillMode(FillModeWinding);
> >   OO:=TGPStringFormat.Create();
> >   OO.GenericTypographic();
> >   APath.AddString(text,AFont,MakePoint(left,top),oo);
> >   AGraphics.FillPath(TGPSolidBrush.Create(MakeColor(font.Color)),APath);
> > end;
> > {code}
> 
> ===========
> just define AGraphics as TGPGraphics instead of IGPGraphics...
> and handover the canvas handle!
> 
> cheers,
> Peter
> 
> Edited by: Peter Wichenthaler-Sternbach on Feb 19, 2013 2:14 AM

-----------------------------------------------------------------------------------------------------------------------------
sorry - no dont work when i set  TGPGraphics instead of IGPGraphics coz some property may have error.
but this code work in vcl xe3 but dont work in firemonkey.
compiler can not accept Tcanvas (sender named here)
-=-=-=-=-=-
if i can convert a text to path in firemonkey i dont use this procedure .......do u know way to convert some font to path easily.???
0
reza2
2/19/2013 2:03:48 PM
> {quote:title=reza2 babaee2 wrote:}{quote}
> > {quote:title=Peter Wichenthaler-Sternbach wrote:}{quote}
> > > {quote: snip...
> -----------------------------------------------------------------------------------------------------------------------------
> sorry - no dont work when i set  TGPGraphics instead of IGPGraphics coz some property may have error.
> but this code work in vcl xe3 but dont work in firemonkey.
> compiler can not accept Tcanvas (sender named here)
> -=-=-=-=-=-
> if i can convert a text to path in firemonkey i dont use this procedure .......do u know way to convert some font to path easily.???

Btw, you  have to handover the HDC handle  (e.g. TCanvas.BufferHandle), not the TCanvas itself.... 

And sure :)  

FMX.Types.TCanvas.TextToPath

=>  docwiki
http://docwiki.embarcadero.com/Libraries/XE3/en/FMX.Types.TCanvas.TextToPath
=> offline
ms-help://embarcadero.rs_xe3/libraries/FMX.Types.TCanvas.TextToPath.html

hth!

DocWiki link added

Edited by: Peter Wichenthaler-Sternbach on Feb 19, 2013 7:13 AM
0
Peter
2/19/2013 3:19:20 PM
no error now when i user BufferHandle ,and program run.
but notting draw.........

{code}
uses IGDIPlus;
{$R *.fmx}

procedure printf(Sender: TCanvas;left,top:integer;text:widestring;font:tfont;all_width,all_height:integer);
  var AGraphics       : iGPGraphics;
  AFont           : IGPFont;
  APath           : IGPGraphicsPath;
  oo:TGPStringFormat;siz:TGPSizeF;
  //MATRIS:TGPMatrix;
begin

  AFont := TGPFont.Create(Form1.lbl1.Font.Family,Form1.lbl1.Font.size, Form1.lbl1.Font.Style,UnitPixel);
  AGraphics := TGPGraphics.Create(Sender.BufferHandle);
  AGraphics.SmoothingMode := SmoothingModeAntiAlias;
  AGraphics.InterpolationMode:=InterpolationModeHighQuality;
  AGraphics.TextRenderingHint := TextRenderingHintAntiAliasGridFit;
  siz:=AGraphics.MeasureStringF(text,aFont,nil);
  if all_width<>0 then left:=left+round((all_width/2)-(siz.Width/2));
  if all_height<>0 then top:=top+round((all_height/2)-(siz.Height/2));
  APath:=TGPGraphicsPath.Create();
  APath.SetFillMode(FillModeWinding);
  OO:=TGPStringFormat.Create();
  OO.GenericTypographic();
  APath.AddString(text,AFont,MakePoint(left,top),oo);
  AGraphics.FillPath(TGPSolidBrush.Create(MakeColor(Form1.lbl1.FontColor)),APath);
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
printf(image2.Canvas,100,100,'sdfsdfsdf',lbl1.Font,0,0);
end;
{code}

why notting drawing ?

and can u send me a sample for FMX.Types.TCanvas.TextToPath??

tnx.

Edited by: reza2 babaee2 on Feb 20, 2013 1:03 AM
0
reza2
2/20/2013 9:05:10 AM
Reply:

Similar Artilces:

xe3
i have some problem for draw a text on canvas with gdi+ ,but this code work in vcl....... i change my TGPGraphics.Create(canvas_m) to TGPGraphics.Create(canvas_m.BufferHandle); but dose not work ,please help me... and can we have some unit same GDI+ in fire monkey, that draw text without edge on canvas??? {code} procedure printf(canvas_m: TCanvas;left,top:integer;text:widestring;font:tfont;all_width,all_height:integer); var AGraphics : iGPGraphics; AFont : IGPFont; APath : IGPGraphicsPath; oo:TGPStringFormat;siz:TGPSizeF; //MATRIS:TGPMatr...

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Ann: X-platform report generator for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Firemonkey Problems
I am new to Firemonkey. I have created the beginning of a program in FireMonkey that includes: SQLConnection SQLQuery DatasetProvider ClientDataSet BindingsList BindSourceDB GridBindSourceDB created by the LiveBinding Wizard The Grid is populated with selected fields from a SQLite3 database. I have three problems. I can’t find a way to center the test in a TLabel and place it at a vertical position that I select. I Can’t find a way to change the font, font size, font color or font horizontal position in the Heading or Body in a GridBindSourceDB. The Edit functions are grayed out...

Delphi XE8 FireMonkey iOS Style problem with segmented buttons
Hi, Going through some tutorials to get used to mobile development using FireMonkey and Delphi XE8. One of the most basic layouts tend to use the toolbar component with segmented speed buttons, and then applying the correct segmented style to each button. However, there seems to be an issue with the iOS style. ...

Delphi XE8 FireMonkey iOS Style problem with segmented buttons [Edit]
Hi, Going through some tutorials to get used to mobile development using FireMonkey and Delphi XE8. One of the most basic layouts tend to use the toolbar component with segmented speed buttons, and then applying the correct segmented style to each button. However, there seems to be an issue with the iOS style. [Screenshot.|https://drive.google.com/file/d/0B68Ju-patBf-RVVEMmI5UDd2cG8/view?usp=sharing] Using the "segmentedbuttonleft", "segmentedbuttonmiddle", and "segmentedbuttonright" styles is producing an extra border on the right button in iOS. It seems...

Delphi XE 5 / XE 6 Firemonkey custom component display problem
Hi everybody, I've a problem and I would like to know if you have encountered the same type of problem, and better, if you have solved it. Let's go for the explanation! With Firemonkey if you chose to create a new component derived from TListBox class with the wizard and you build and install it on a custom palet there is no problem. I mean that you can drag your own new component on a form and all is OK! But if you are doing the same thing with the TCustomListBox class as ancestor you can create your component without problem but when you drag this new one on a form you have ...

Firemonkey
I am so dammed frustrated with firemonkey and livebindings. The VCL + DB Controls were fast, consistent, and stable. This fmx framework is crap. It's slow on my i5 Macbook. I'd be embarrassed to put out an app like this. The help is lousy and apparently very few people are using it based on my failed Google searches. I can see why. Livebindings is cute when you have a few fields, but it a rats nest when you have a moderately complex form and have to wire up dozens of controls. There is no official support for nullable fields in livebindings which blows my mind....

installation problem FireMonkey
Hi! Can not install FireMonkey-iOS.dmg, so we get an error, what could be the problem? http://s1.ipicture.ru/uploads/20120331/WW862UKq.png Please help me !!! vitaly golub wrote: > > {quote:title=Joanna Carter (Team OOAD) wrote:}{quote} > > Le 31/03/12 14:48, vitaly golub a écrit : > > > > > Hi! Can not install FireMonkey-iOS.dmg, so we get an error, what > > > could be the problem? > > > > Like the message says, you have to have Xcode installed first. > > > > Joanna > > > > -- > > Jo...

Firemonkey SplashScreen Problem
Hi! I have a complex APP which takes about 9-10 seconds to startup. The problem is that while the Splashscreen appears immediately, it goes off after 2 seconds. On the remaining 8 seconds, the screen is completly blank. The foms are created, and then Application.Run is fired, but until the first form is FormActivated ... there is at least 4-5 seconds delay. I can't make a custom Splashscreen.Show, because it doesn't show at all, until all packages are loaded. Anybody have a workaround? > {quote:title=László Mlnvszky wrote:}{quote} > Hi! > > I hav...

Firemonkey datagrid problem
I'm converting a simple database application from VCL to FM. My ClientDataset (about 15K records) is linked to a string grid using LiveBindings. It connects OK, but it only displays the first 200 records. I've tried setting RowCount to zero (as in the sample demo), to the actual number of visible rows (21) and also to 65535. Sometimes, it seems that the RowCount is reset by the IDE to 200 without action by me. ...

Firemonkey SplashScreen Problem
Hi! I have a complex APP which takes about 9-10 seconds to startup. The problem is that while the Splashscreen appears immediately, it goes off after 2 seconds. On the remaining 8 seconds, the screen is completly blank. The foms are created, and then Application.Run is fired, but until the first form is FormActivated ... there is at least 4-5 seconds delay. I can't make a custom Splashscreen.Show, because it doesn't show at all, until all packages are loaded. Anybody have a workaround? > {quote:title=László Mlnvszky wrote:}{quote} > Hi! > > I hav...

Gdi+ colormatrix to firemonkey
Hi all, how to convert the gdi+ TGPColorMatrix into FireMonkey ? In firemonkey it is present the effect sepia, as I can modify the default color? thx Perauto Informatica srl wrote: > how to convert the gdi+ TGPColorMatrix into FireMonkey ? > In firemonkey it is present the effect sepia, as I can modify the > default color? You'd probably get better response if you posted your question in the FireMonkey forum. -- Andy Syms Technosoft Systems Ltd "Coming back to where you started is not the same as never leaving." -- Terry Pratchett (A Hat F...

Installing components for FireMonkey HD and FireMonkey iOS
Hi, How do I install components for both FireMonkey HD and FireMonkey iOS? I have one package 'FMXMyFireMonkeyControl' and 'FMIFireMonkeyControl' which both point to the same file with the same registration 'TFireMonkeyControl'. If I compile one package (FMXMyFireMonkeyControl) it installs correctly, then change the include file (FMCompile.INC) to compile for IOS (FMIFireMonkeyControl) which is included in the FMX.FireMonkeyControl.pas file: {$I FMCOMPILE.INC} uses {$IFDEF COMPILEIOS} FMX_Types, FMX_Objects, FMX_Forms, FMX_Dialogs, FMX_Effe...

Web resources about - GDI+ in firemonkey has problem??!!! - embarcadero.delphi.firemonkey

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

The problem with “bringing the country together”
... our country needs is to reject the very premise of politics. The disparate factions in the United States don’t even agree on what our problems ...

Samsung confirms fix for Galaxy Note 5 S Pen "problem"
... the stylus instead is spring-loaded and can be ejected by pressing it. Unfortunately, the new installation was not without a potential problem ...

Apple confirms bug that makes the iPhone’s most frustrating problem even more frustrating
... as and satisfied as they are though, we doubt any iPhone user would make the claim that his or her handset is perfect. No, iPhones have problems ...

One of Africa's most promising economies is facing a fundamental problem
Ethiopia's regime wants prosperity and total control — and is finding it might not be able to have both.

More problems for Twitter
Third sporadic outage in five days hits social media giant

The problem with Chinese data...
John Rutledge, Safanad chief investment strategist, shares his thoughts on China's GDP and real economic growth. And Mike Santoli, CNBC senior ...

How I quickly fixed a weird Siri Remote problem
I’ve been suffering with this strange issue for about a week: my Apple TV’s Siri Remote’s Menu button stopped working. All the other buttons–Home, ...

The FTC Wants To Regulate Phantom Problems That Don’t Exist
If you take away the dealers, you take away competition, and prices will go up.

‘Degrassi: Next Class’: “The Drugs Have Changed But The Problems Are Still The Same”
Degrassi is known for tackling the complex issues that high school students face. Subjects such as teen pregnancy, drugs, school shooting and ...

Resources last updated: 1/20/2016 4:01:46 AM