How to resize a bitmap in firemonkey

Hello 
that should be easy but it not
  myBitmap:TBitmap;

  myBitmap :=   TBitmap.CreateFromFile(FILENAME_1);
   // let say the size is 64 X 64
// I increase to 250  
  myBitmap.SetSize(250,250);
// save to another file
myBitmap.Savetofile(FILENAME_2);
myBitmap.free;

 the file is all black
Any thoughts 
thank you
PW
0
Philippe
7/16/2014 12:16:06 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

3 Replies
6847 Views

Similar Articles

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

SetSize sets the height and width of the bitmap but does not resize it's contents.


function ResizeBitmap(B: TBitmap;Width,Height: Integer): TBitmap;
begin
  Result := TBitmap.Create(Width,Height);
  Result.Clear(0);
  if Result.Canvas.BeginScene then
    try
      Result.Canvas.DrawBitmap(B,RectF(0,0,B.Width,B.Height),RectF(0,0,Width,Height),1);
    finally
      Result.Canvas.EndScene;
    end;
end;

procedure TForm2.Image1Click(Sender: TObject);
var
B: TBitmap;
begin
 B := ResizeBitmap(Image1.Bitmap,250,250);
 Image1.Bitmap.SetSize(250,250);
 Image1.Bitmap.CopyFromBitmap(B);
 B.Free;
end;
0
Eli
7/16/2014 1:16:58 PM
*thank you VERY MUCH* That does it 
Firemonkey is one non obvious thing after another

I took the liberty to modify it a bit so it is not a function

//==============================================================================
procedure ResizeBitmap(fB: TBitmap; const fWidth, fHeight: integer);
//==============================================================================
var
  pTemp: TBitmap;
begin
  pTemp := nil;
  try
    pTemp := TBitmap.Create(fWidth, fHeight);
    pTemp.Clear(0);
    if pTemp.Canvas.BeginScene then
      try
        pTemp.Canvas.DrawBitmap(fB, RectF(0, 0, fB.Width, fB.Height),
          RectF(0, 0, fWidth, fHeight), 1);
        fB.SetSize(fWidth, fHeight);
      finally
        pTemp.Canvas.EndScene;
      end;
    fB.CopyFromBitmap(pTemp);
  finally
    FreeAndNil(pTemp);
  end;
end;

Edited by: Philippe Watel on Jul 16, 2014 6:53 PM
0
Philippe
7/16/2014 3:54:51 PM
Philippe Watel wrote:
> Hello 
> that should be easy but it not
>   myBitmap:TBitmap;
> 
>   myBitmap :=   TBitmap.CreateFromFile(FILENAME_1);

myBitmap := myBitmap.CreateThumbnail(250,250)
0
Dominique
7/16/2014 6:13:59 PM
Reply:

Similar Artilces:

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
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....

Firemonkey Bitmap Question
I am trying to write a firemonkey application to display a world map in a bitmap and apply a template to dim out some regions of the map. I have the map and the template but don't know how to put them together. I did something similar in a VCL app by stepping through each pixel individually (using scanline ?) and multiplying the RGB components by a constant before writing each pixel back into the bitmap. Although this worked OK, I feel there must be a more efficient way to do this in a single bitmap operation. I tried putting my dimming values into a separate bitmap and using CreateFromBitmapAndMask (Map, Template) but the result was a psychedelic mess that bore no relation to what I expected to happen. I also tried writing the template from a bitmap over the map bitmap with opacity < 1, but again this didn't do as I wanted. Any suggestions out there would be appreciated. I am using Delphi XE2 Update 4 on Win XP Sp3 Many Thanks! Why not use two image components, on top of each other, with the map in the bottom one and the dim-out in the top one? ...

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...

Delphi XE2, OSX and FireMonkey?
1. Does anyone know if developing with FireMonkey will be the only way to develop for OSX with XE2? 2. Does anyone know if you will need to compile on a Mac for OSX, or will XE2 cross compile? I know this will all come out during the world tour, but I'm just trying to get some idea so I can start planning. 1. Yes, I think for now it will be the only way. But you can probably build a native UI for OSX by directly using the API, like you can also develop Win32 applications without using the VCL. 2. XE2 will only be available for Windows, but it will compile for other platforms. &l...

Making Firemonkey more compatible with Delphi
I have programmed in Delphi since 1995 Delphi1 I am now evaluating Delphi XE4. It boggles my mind, why embarcadero has lost the most important aspects of Delphi. Simplicity and Fast User Interface creation. I can easily see how Firemonkey can be improved to bring it in line with traditional Delphi Techniques by doing the following. 1. All Firemonkey controls need a data aware counterpart. 2. Firemonkey Styles need to be converted to TControl descendants. 3. ie. TLayout goes to TPanel ( TFMXPanel ) 4. ie. TRectangle does to TFrame TFMXFrame ) 5. LiveBindings gets placed underneath ( TFMXDataSource ) 6. Style Editor becomes a simple FMX Editor. Unless this is done, I cannot see how XE4 can really take off as a product Kind Regards, Robert. Robert Gilland wrote: > 1. All Firemonkey controls need a data aware counterpart. > 5. LiveBindings gets placed underneath ( TFMXDataSource ) It seems you've missed the point of LiveBindings -- Dave Nottage [TeamB] Robert Gilland wrote: > I have programmed in Delphi since 1995 Delphi1 > > I am now evaluating Delphi XE4. > > It boggles my mind, why embarcadero has lost the most important > aspects of Delphi. > > Simplicity and Fast User Interface creation. > > I can easily see how Firemonkey can be improved to bring it in line > with traditional Delphi Techniques by doing the following. > > > 1. All Firemonkey controls ne...

ANN: Delphi XE2 FireMonkey BOOK
September 5, 2012 Coogara Consulting is pleased to announce that our new book is available: "FireMonkey Development for iOS and OS X with Delphi XE2" by Graeme Chandler. It is available printed (comb binding) or in PDF and MOBI (Kindle compatible) formats. Only from: http://shop.coogara.com Regards Graeme Chandler Coogara Consulting http://www.coogara.com.au http://shop.coogara.com http://www.strikingwood.com.au Graeme Chandler wrote: > Coogara Consulting is pleased to announce that our new book is > available: > > "FireMonkey Dev...

How can i change Bitmap Pixelformat in Firemonkey
Hello, I write a Firemonkey application on xe4 for windows. In it, i must save a bitmap (only black and white), that a user draw with a signature pad. If I save the bitmap, it was about 1.7 mb big for only one smal line, that the user draw. The problem now is, that i have about 20 - 30 bitmaps on a day and always on evening, i must send the files via ftp to an ftp server. The line speed was very slow and so the transfer runs about 1 hour or more. How can i set the pixelformat to pf1bit that i became a smaller bitmapsize? I search for the property Pixelformat, but it was in Firemon...

Firemonkey XE6 assign bitmap to tImageViewer
Hi, I would like to assign a bitmap that I create programatically in memory to a TImageViewer (I have tried tImage with the same results). This is my code, and my only working solution has been to save the bitmap to a file (so I know the bitmap is working), and then read that. Is there a way to avoid the disk read/write operations, since the bitmap could be large? MapDraw.DrawMapOnBMP(MyBitmap,fName); //creates an in memory bitmap //ImageViewer1.Bitmap := MyBitmap; //does not work //ImageViewer1.Bitmap.Assign(MyBitmap); //does n...

Delphi FireMonkey project / testComplete and MSAA
Hi I am actualy working on a new team project developped using FireMonkey. We want to create automated tests with TestComplete which is already used to run tests on some VCL projects. Unfortunatly, we discovered that TestComplete is not directly compatible with FireMonkey application, it only sees the windows but not the controls on it. Making some research we, found that TestComplete is able to identify controls thanks to MSAA. So we created a really short project (only one form with some controls) using the FireMonkey Accessibility Pack in order to look at TestComplete's behavio...

Delphi, Firemonkey, IOS, and TCP howto?
I was really excited about the new ability to compile IOS apps written in Delphi, but I'm starting to find some major limitations, unless I'm really overlooking something. I want to write an iphone/pad app that needs to retrieve data from a socket connection, or from a webpage (http, webservice, anything). It seems that all of the Firemonkey internet and indy components are not supported within xcode. Am I overlooking something here, or is this a feature that will not be implemented, or is it planned to be implemented? If this kind of communication is not supported, this is a hu...

Delphi XE5 Firemonkey iOS7 Style (where is it?)
It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. Am I missing something obvious? > {quote:title=David Templar wrote:}{quote} > It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" > > Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. > > Am I missing something obvious? What you see in the IDE is one thing. Have you run your app on iOS7 and you see old style? Best Regards, Cristian Peta > {quote:title=Cristian Peta wrote:}{quote} > > {quote:title=David Templar wrote:}{quote} > > It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" > > > > Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. > > > > Am I missing something obvious? > > What you see in the IDE is one thi...

Pop-up on Mobile apps (FireMonkey / Delphi )
Hi everyone, I'm currently working on a FireMonkey mobile app with Delphi (XE6) and since i'm really new to this i'm in need of a little bit of help. For my App i'd like to build in a subscription screen that would work like a pop-up, showing modal on the same form than the login. I've been looking around a bit on the internet but couldn't find any usefull advice. I found a video ("FireMonkey: Showing Modal form with animation and Shadow effect" from Yaroslav Brovin) thad proved me that it was possible, but was unable to find how. I'm sure it'...

ANN: TMS Pack for FireMonkey v1.5 with new TMS Grid for FireMonkey released
We're very proud to announce the availability of TMS Pack for FireMonkey v1.5 at http://www.tmssoftware.com/site/tmsfmxpack.asp that includes our new TMS Grid for FireMonkey and also a new Outlook style navigation bar and advanced edit controls. Screenshot: http://www.tmssoftware.com/site/img/TMSFMXGridCollection_small.png TMS Grid for FireMonkey feature set: - Fully style-able, customizable and architected from the ground up for FireMonkey - Fully cross platform, support for Win32, Win64, Mac OSX, iOS - High performance: handles >500.000 rows, >10.000 columns witho...

Form.OnResize fired BEFORE form resize on Firemonkey
Hi there! Something strange happening, I am using XE5 up 2. I have only one form on my Firemonkey Application for win32, using styles. I have a OnResize event handler to reposition some objects inside the form. But That should be done AFTER the resize, with the new dimensions. However i noted that was not happening, I had this same code on a VCL form that used to work. I have placed a breakpoint on the very first line of the OnResize eventhandler and when I try to resize the form using the mouse on the down-right corner, when I MouseDown the OnRisize happens. Is it a ...

Is there a plan to rewrite the Delphi IDE using FireMonkey ?
I guess this should be a logical move to target multiple platforms and prove that Embarcadero is eating its own dog food. Although I think I've read somewhere that Delphi is using some Microsoft technology for the form designer but I might be wrong there. Is FireMonkey suitable for that kind of application or is the VCL still the way to go for "professional" business oriented applications ? What are your thoughts ? When XE2 is released I hope there will be a clear indication as to what kind of applications FireMonkey is suitable for or not. <John Riche> wrote in message...

Delphi Contest: Absolutely Insane Firemonkey Demo
Hello! We would like to announce unusual Delphi summer contest: "Absolutely Insane Firemonkey Demo". It's purpose is to learn the real limits of the new Firemonkey technology and have some fun in the process. Join us! Learn more: [http://www.helpinator.com/blog/2012/07/11/delphi-firemonkey-contest/|http://www.helpinator.com/blog/2012/07/11/delphi-firemonkey-contest/] ...

VCL DLL used in Firemonkey
Hi I have a DLL written in VCL that captures a TBitmap. I need to use that in a Firemonkey application. However, the pointer passed is HBitmap which does not exist in FMX. How can I achieve this? I have access to both the DLL and FMX code so changing to something useable by both it is not a problem. Using Windows 7, Delphi XE5 Thanks > {quote:title=Bennie Coetzer wrote:}{quote} > Hi > I have a DLL written in VCL that captures a TBitmap. I need to use that in a Firemonkey application. However, the pointer passed is HBitmap which does not exist in FMX. How can I achiev...

Delphi firemonkey form and keyboard Previous/Next
If I have a web a webform (html) with many fields the Iphone and Ipad keyboard show Previous/Next field. Is there a way to get this functionality with Delphi and a FM form ? B ...

How can I draw an icon from a handle to a Firemonkey bitmap ?
Hello, I have an application that will run only on windows. One of the functionalities of the application require me to extract a window handle from a different process and use it for a list object. In win32, this is simple: I get the original icon handle (the source app is our own so it places that handle in a windows property that can easily be retrieved), make a copy of it (with CopyIcon) and then assign that new handle to the Handle property of a new TIcon oject. Another example that would have the same problem would be extract an icon from and application file or a dll. How ca...

Saving a TImage.bitmap as a jpeg file in Firemonkey
I need some assistance with TBitmap / TBitmapcodec. I do not know how to save a bitmap in a TImage to a jpg (or other) format file. Any help will be appreciated - even some guidance as to where to find an example, an explanation, etc. I am using Delphi XE2 with FM 1 > I need some assistance with TBitmap / TBitmapcodec. I do not know how to save > a bitmap in a TImage to a jpg (or other) format file. Any help will be appreciated - > even some guidance as to where to find an example, an explanation, etc. > I am using Delphi XE2 with FM 1 Just use the SaveToFile method of...

A little bit about FireMonkey and Delphi XE2 @andreanolanusse
A little bit about FireMonkey and Delphi XE2 http://www.andreanolanusse.com/en/a-little-bit-about-firemonkey-and-delphi-xe2/ -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ...

Firemonkey - XE 5 - Mac OS X Firemonkey HD App
My Firemonkey applications have no icon when they run in the dock. What is odd is that when I navigate in the finder to the app bundle to /Users/my_user_id/RADPAServer/scratch-dir I see the icon there, and if I open the app bundle, it contains the .icns file, which seems valid. But the Finder itself, in my iMac running OS X 10.8.5 seems to refuse to show the icon in the dock. Running the app bundle normally (not via RADPASERVER) also results in a broken icon. Note that if I make an icon myself, using the OS X app Icon Composer, and put it in there, it seems valid, but (a) the defau...

Web resources about - How to resize a bitmap in firemonkey - embarcadero.delphi.firemonkey

Firemonkeys - GamesIndustry International
The world's leading games industry website. Get insight from todays industry leaders with news, interviews and analysis of global gaming trends. ...

Firemonkey’s Real Racing 3 To Launch At The End Of February
In September, Apple demoed Firemonkey’s Real Racing 3 at the iPhone 5 event . Three months later and the game has yet to show up in the App Store. ...

EA Games and Firemonkey Bringing Real Racing 3 to Android, Fasten your Seat Belts
Start up your engines race fans, EA Games is teaming up with Firemonkey to bring Real Racing 3 to mobile devices. If you’re a fan of more realistic ...

EA's Firemint and IronMonkey Studios Merge to Become FireMonkeys
... game development studios into one mega-studio in Australia. Firemint and IronMonkeys will be merged into a single studio now known as Firemonkeys ...

News: Firemonkeys announces Real Racing 3
Firemonkeys, a new gaming subsidiary of Electronic Arts born from the merger of FireMint and IronMonkey, has announced the coming release of ...

firemonkeys - iMore
EA has pushed out another impressive update to its equally impressive iOS racer, Real Racing 3, that for the first time brings cars from Ferrari ...

Firemonkeys on Real Racing 3 going free-to-play
... got a hands-on preview of Real Racing 3. We also spoke with Ptolemy Oberin, one of the game’s programmers and project lead at developer Firemonkeys, ...

Real Racing 3 coming in 2012 from Firemonkeys
The first game from recently merged developer Firemonkeys is Real Racing 3 , the developer revealed moments ago during EA's Summer Showcase event ...

Firemonkeys Previews Real Racing 3 for iPhone and iPad
Firemonkeys, the new combined studio from EA combining the IronMonkey and Firemint gaming studios, has announced the development of Real Racing ...

EA Mobile Moves: IronMonkey & Firemint Merge Into “Firemonkeys,” Now Have 50M Players Between
... that it is merging two top mobile game studios, IronMonkey and Firemint , which will fittingly combine to create a new company, called Firemonkeys. ...

Resources last updated: 3/8/2016 4:28:25 AM