How to draw from ImageList to TImage

In Delphi 2009:

If I try to draw a transparent image (32-bit BMP or PNG) from ImageList, 
the alpha does not show through:

                   B:=TBitMap.Create;
                   ImageList1.GetBitmap(8,B);
                   Image1.Bitmap.Assign(B);
                   B.Free;

But If I link a TButton to that same ImageList /Index, then the alpha works.



I.O.W. how do I draw with a TImage, like a TButton does from an 
ImageList? Not just with transparent color, but using alpha channel.

Thanks in advance
AntonE
0
Anton
6/1/2009 1:01:16 AM
embarcadero.delphi.graphics 928 articles. 0 followers. Follow

3 Replies
8394 Views

Similar Articles

[PageSpeed] 32

"Anton Ekermans" <antone@true.co.za> wrote in message 
news:123210@forums.codegear.com...

>                   B:=TBitMap.Create;
>                   ImageList1.GetBitmap(8,B);
>                   Image1.Bitmap.Assign(B);
>                   B.Free;

Try this:

{code:delphi}
ImageList1.GetBitmap(8, Image1.Bitmap);
{code}

-- 
Remy Lebeau (TeamB)
0
Remy
6/1/2009 5:50:33 AM
Remy Lebeau (TeamB) wrote:
> "Anton Ekermans" <antone@true.co.za> wrote in message 
> news:123210@forums.codegear.com...
> 
>>                   B:=TBitMap.Create;
>>                   ImageList1.GetBitmap(8,B);
>>                   Image1.Bitmap.Assign(B);
>>                   B.Free;
> 
> Try this:
> 
> {code:delphi}
> ImageList1.GetBitmap(8, Image1.Bitmap);
> {code}
> 
Nope, still o draws the background block & no alpha. If I set 
transparent=true then it just bit-mask the image to remove background 
color, but still no alpha. That same image draw to TButton just fine...
0
Anton
6/1/2009 7:39:45 AM
Maybe you should try

ImageList1.Draw(Bitmap.Canvas,0,0,Index)

-Atle
0
Atle
6/1/2009 2:42:44 PM
Reply:

Similar Artilces:

delphi and drawing
Hello Delphi Masters, I have one little problem with drawing in Delphi. I have some data in TDataSet component for example two fields month and some value for that month, and I need to represent that data in some grpahic way. For example I have five parallel manufacturers and all of them can make some product and it can be some qty at month. I need to represent how many is all of them is busy by plan in graphic maner, something like chart bars and my user need to drag one product (bar) from one manufacturer to another from may to september... So, is tehere some tool or idea...

draw graphics
  I am trying to do some graphics on the fly.I cant even draw a line  between 2 points as i get garbage printed to the screen.Imports System.DrawingImports System.Drawing.Imaging  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        Dim objBitmap As Bitmap        Dim objGraphics As Graphics        Dim oColor As System.Drawing.Color        objBitmap = New Bitmap(200, 200)        objGraphics = Graphics.FromImage(objBitmap)  &...

Add graphic to Imagelist
Hi, I add some bmp's to my global TImageList on the main form. Because there are so many clients (menu's) registered in the ImageList this takes almost one second to add four bitmaps. I didn't find something like BeginUpdate / EndUpdate for the TImageList. What possibilites do I have to speed up the process, e.g. disable all clients and reenable them, once I'm done? cu Christian "Christian Kaufmann" <christian.kaufmann@gmx.net> wrote in message news:67889@forums.codegear.com... > I didn't find something like BeginUpdate / EndUpdate for > the TImageList. It actually does, but they are private. I have no idea why. However, the TCustomImageList.Change() method is protected and dynamic, so you could derive a new component from TImageList and override Change() in it. Then you can implement your own public methods that set/clear your own counter, and then have your overriden Change() call the inherited Change() only when the counter is 0. -- Remy Lebeau (TeamB) ...

Drawing to a TImage in a Frame
Hi I have a blank timage in a frame and want to draw to it when the frame is initialized. i am looking for a onshow, oncreate, ondraw but nothing. How do I then create the initial state I want in the image? Hi Colin Colin Maharaj wrote: > Hi I have a blank timage in a frame and want to draw > to it when the frame is initialized. I don't think TImage was ever meant for drawing, it is meant to be an easy way of handle an Image resource and show it, so it is better to draw to a TBitmap and then show the bitmap. But if the image isn't ready made, I suggest a...

Drawing graphics in asp
Hi, I am wondering if it is possible in ASP to draw a graph on a web form. basicly I would need only some horizontal lines with a given starting point and length. What would be the best way to do this? Is there maybe a component where you can draw on? or do I need to buy a 3th party graph component then? regards  Rob__________________Rob Warning Hello, in ASP.NET drawing is done using GDI+. You can find the classes in the namespace System.Drawing. This can be used to create a bitmap image which you can display. You can't draw directly on the form.Good luck! When yo...

drawing text on graphics
I know how to draw text on graphics and all thats fine however I do have a couple of questions   1) the text comes out blurry on jpg images. Any ideas on how to make it clearer and smooth? 2) what font can you recommend that I can use which looks good, the font color I will be using is white since the images are generally dark. I just can't seem to find a font I am attracted to.   Thanks!C# MVP When I see blurry text in a graphic sometimes it's because image is not displayed at exact image size.  For example, if image size is 100 x 100, but you display i...

2D graphics for Delphi....
I have another graphics related problem, which is 2D rather than 3D, so I guess GLScene is not a candidate: Say I have a 2D array with XY coordinates and a scalar value in each point. These values vary in some continuous way across the whole XY surface (like barometric pressure across the earth), but the array only contain the (regular or irregular) sampling points. How would I go about color-coding the data so that there is a level map created with one color is designating one pressure range, possibly even with colors gradually changing across the area. Note that there are only so...

Delphi 2009 and TImage
Delphi 2009 uses ... Jpeg, PNGImage; OpenPictureDialog1.Filter := GraphicFilter( TGraphic ); 1. How to add GIF support? I searched the help for gif and gifimage but found nothing... what is the unit name I have to add to uses to enable GIF support. 2. Is there support for TIF? 3. Can you draw a rubberband on TImage of a jpg is loaded? Bill "Bill Miller" <@w2m00@frontiernet00.net> wrote in message news:19997@forums.codegear.com... > 1. How to add GIF support? uses ..., GIFImage > 2. Is there support for TIF? No. But there are third-p...

Drawing.Graphics issue
I'm trying to generate thumbnails on the fly without a horrible loss in quality so I've found that using the Drawing.Graphics class might be the best way.   dim imageUrl as String = Request.QueryString("img") Dim fullSizeImg As System.Drawing.Image fullSizeImg = System.Drawing.Image.FromFile(Server.MapPath(imageUrl))Dim myresizer As Drawing.Graphics myresizer = Drawing.Graphics.FromImage(fullSizeImg) myresizer.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic Response.ContentType = "image/jpg" myresizer.DrawImage(fullSizeImg,...

Draw line on TImage.
Hallo I wish to draw a line on a TImage. I do this by using the following code, and it works: AImage.Canvas.Pen.Color := clBlack; AImage.Canvas.Pen.Width := 1; AImage.Canvas.Pen.Style := psSolid; AImage.Canvas.PenPos := Point(10,10); AImage.Canvas.LineTo(20,20); However, it only works if the actual image is BMP. If I load a JPG, it gives an error. EInvalidOperation (Can only modify an image if it contains a bitmap) Any ideas how I can bypass this problem? Thanks Michael Michael Posthuma wrote: > Hallo > > I wish to draw a line on a TImage. > >...

System.Drawing.Graphics Problem
I have written a function to dynamically resize images retrieved from an SQL database then push them to the browser.  If I bypass my resize routine, the image displays perfectly, but full size.  Uncomment the resize routine, and I get a blank screen with no error messages.  Any suggestions as to where I've gone wrong? Thanks, - Brad   Dim bytImageData As Byte() = DirectCast(rsImageData.Item("Properties_ImageData"), Byte())Dim stmImage As New MemoryStream()stmImage.Write(bytImageData, 0, bytImageData.Length)Dim bmpImage As New Bitmap(stmImage)'Create ...

need Help for drawing in delphi
Hello I try to make some graphics in my app. I have a panel and over it a TImage for drawing. I have a events list (lets say 5). For each event from list I want to make a square at equal distance from another. The square i color them in diferent color by the type of event. The "create" is working well but the selection of a square is not working. when I click inside of a square i want to change his color to advice the user. create the square: [CODE] imgEvents.Canvas.Brush.Color := typeColor; imgEvents.Canvas.FloodFill(0, 0, typeColor, fsSurface)...

Problem with PNG graphics in Delphi
I am not a programmer, I am a graphic designer and worked on some images for a program being written in Delphi (I am uncertain of the version). The problem seems to be that no matter what size I create the image, Delphi distorts it and creates what appear to be "holes" in the image that are transparent and show the background color What can we do to fix this issue if anything? Any help would be greatly appreciated. Am 27.03.2010 14:12, schrieb Kristina Thompson: > I am not a programmer, I am a graphic designer and worked on some images for a program being written in Delp...

How can I draw SVG in Delphi?
How can I draw SVG in Delphi? Free VCL or Demo is very welcome. Thanks -- Auto generate flowchart & N-S chart from code! http://www.ezProg.com > {quote:title=Lee Billows wrote:}{quote} > How can I draw SVG in Delphi? Free VCL or Demo is very welcome. Hello. You can see ExtGraph (http://extgraph.sourceforge.net/index.html) based on SimpleGraph. Regards. Am 11.08.2010 18:03, schrieb Lee Billows: > How can I draw SVG in Delphi? Free VCL or Demo is very welcome. > Thanks > You can take a look http://www.crossgl.com/aggpas/ which has a few very nice demos there. kind regards Mike HI, I have study SimpleGraph before, but it export *.sgp, not *.svg? Is sgp is svg? -- Auto generate flowchart & N-S chart from code! http://www.ezProg.com <Neftali -German Estevez-> дÈëÏûÏ¢ÐÂÎÅ:271926@forums.embarcadero.com... >> {quote:title=Lee Billows wrote:}{quote} >> How can I draw SVG in Delphi? Free VCL or Demo is very welcome. > > Hello. > You can see ExtGraph (http://extgraph.sourceforge.net/index.html) based on > SimpleGraph. > > Regards. Hi, Thanks. The code can view svg rightly and is helpful . I will try to draw a svg graph -- Auto generate flowchart & N-S chart from code! http://www.ezProg.com "Michael Rabatscher" <m.rabatscher@gmail.com> дÈëÏûÏ&...

TRibbon Delphi 2009 and ImageLists
Can 32-bit png images be used sucessfully with TRibbon or are bitmaps required? I can not seem to get the transparency to work correctly no matter what I do to the png image ( changing the transparent color ). The disabled png images all show up with a white background. Enabled images seem to be ok except there is a 1 pixel width line along the top and left side of the image when the image is hovered over. Any ideas? Bill > {quote:title=Bill Miller wrote:}{quote} > Can 32-bit png images > Any ideas? How do you create 32-bit pngs? I have Photoshop 8.0 and the...

API Calls for drawing graphics ?
Dear Friends , I am using 'Windows API Calls' to draw graphics( lines , rectangles .... ) on a window . But , another window cover on this window and after move it , the original graphics (lines , rectangles ... ) that I drew will disapper. I wrote the function as follows .................... ------------- ULong ll_device , ll_hRgn MousePos mpos // Structure x , y for Mouse positions ll_device = GetDC( ahd_hd ) // (parameter) ahd_hd is an handle for window SetNull(ll_hRgn) // Set region to entire client area InvalidateRgn( ahd_hd , ll_hRg...

Drawing a TImage to a TPanel canvas
Hi there, I've written a TPanel descendant (called TMap) that has a TImage as a private member (called FMap). I want to be able to load an image (bitmap, jpeg, png, etc.) to be displayed on the canvas of the TMap, resized to fit but preserving the aspect ratio. I've set the Proportional and Center properties of the TImage to true when it is created. With my test image (a fairly large, high-quality jpeg) I've been able to get the image onto the TMap but I can't get it to work without sacrificing the fit or the aspect ratio. For example: +procedure TMap.Paint;+ +begin+ +inherited;+ +FMap.Height := Height;+ +FMap.Width := Width;+ +Canvas.StretchDraw(GetClientRect, FMap.Picture.Graphic);+ +end;+ displays the image but the aspect ratio is out. This code: +procedure TMap.Paint;+ +begin+ +inherited;+ +FMap.Height := Height;+ +FMap.Width := Width;+ +Canvas.Draw(0, 0, FMap.Picture.Graphic);+ +end;+ only displays the top left section of the image. The following calls: +Canvas.CopyRect(Rect(0, 0, Height, Width), FMap.Canvas, FMap.ClientRect);+ +BitBlt(Canvas.Handle, 0, 0, Width, Height, FMap.Canvas.Handle, 0, 0, SRCCOPY);+ raise an EInvalidOperation exception with the error message "Can only modify an image if it contains a bitmap". Copying it to a TBitmap buffer before painting to the canvas only seems to introduce graphical artifacts. It does work if I make FMap visible and align it to client, but I'd rathe...

3D graphics library for Delphi?
I am working on a scientific program which needs to visualize 3D body properties. It is supposed to show the properties of the ground after doing a set of measurements and inverting the results. So a block that can be twisted and turned and where the properties are color coded (semi-transparent) is what I am after. We (not myself though) have used GLScene for 2D visualization but for 3D it was done before using VTK and C++ code. But I want to use Delphi since I have 16 years of experience with Object Pascal and basically none with C++... So is it possible to render 3D data as color codes boxes with GLScene or is there a different recommended graphics package for Delphi? I am using Delphi7, BDS2006 and Delphi 2007, might also install XE (for which I have a license too). -- Bo Berglund Developer in Sweden > {quote:title=Eric Grange wrote:}{quote} > > GLScene is now FireMonkey, the new GUI and 3D library for Delphi since > > Delphi XE2. > > No actually FireMonkey is a severely cut down version of DXScene. > DXScene itself was initially a derivative of GLScene retasked for > DirectX, which was later refocused on GUI and multi-platform. > > GLScene is still GLScene, and is truly 3D capable, where FireMonkey > doesn't even support 3D transparency (it only supports blending...). > > Eric Eric, I have been using GLScene for years and want thank you for all the work you have put into it :) ...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Delphi 2009 TImage gif
When loading a gif file into a Timage control I get an error. "Unknown picture file extension (.gif)." However not only have I found various webpages that state TImage can now show gif files, the help file that came with Delphi states it can show gif files. I also have found out about the TGifImage component, however I can't find it anywhere in my Delphi application. What am I missing? Derek McKinnon wrote: > When loading a gif file into a Timage control I get an error. > > "Unknown picture file extension (.gif)." > > However not on...

3D graphics for Delphi in 2013?
Is it possible for Embarcadero to provide some near future prospects regarding 3D graphic capabilities for Delphi (not firemonkey)? By 3D I do not mean 3-D text or a little 3D triangle structure like the case with Firemonkey... I mean full 3D engine graphics capability usable in _Delphi for Windows PC applications_. To think: We are using fast computers with exciting graphics interface capability and it is _the worst supported aspect of Delphi_. Delphi is currently decades behind time in this regard...and I do not even mention the other standard PC peripherals like audio, mouse, keyboard ...

TImage, TScrollBox and TPageControl in Delphi 2009
What is the best way to create and destroy a TImage whose Parent is TScrollBox on TPageControl tabsheet in Delphi 2009? When the app is closed there is an AV for the toolbar on Form1? Am I creating them incorrectly or am I not freeing them correctly? Bill procedure TForm1.AddTabSheet; begin with PageControl1 do // Create a new Tabsheet TabSheet := TTabSheet.Create( Self ); // Set the Tabsheet.PageControl to PageControl1 TabSheet.PageControl := PageControl1; // Set the activepage to tabsheet PageControl1.ActivePage := TabSheet; with Tabsheet do begi...

DrawString
Hello,in my ASP.NET application (C# language) i generate an image.I use Graphics object from System.Drawing.Graphics namespace. I want to draw string to my image. But I can't find any method to format string to horizontal center and vertical center. Is it any solution how to do it? I'm looking for DrawText GDI+ function equivalent ant its parameter uFormat.Best regardsMilan Kotaskainfo@softkom.cz Use the overload of the DrawString method that takes a StringFormat object.Set the Alignment and LineAlignment properties of this StringFormat object to StringAlignment.CenterYou should now h...

How to Draw Graphics on Web Page On the fly?
How to Draw Graphics on Web Page On the fly? I want to create Dynamic Custom ImageMap Server Control which draw status (red and green signals).I already create image using System.Drawing class,now I want to render that control on webpage.I dont want to access server hard disk to set ImgURL property of IMageMap. I want to set ImgURl from memory. I tryout IHTTPModule,but it require registration in web.config,that I dont want,so I need another solution. PLease Help Me. What you need is an ASHX file. See http://www.developerfusion.co.uk/show/5223/ for an example of how to pull an ima...

Web resources about - How to draw from ImageList to TImage - embarcadero.delphi.graphics

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Visual Basic for Applications - Wikipedia, the free encyclopedia
Visual Basic for Applications ( VBA ) is an implementation of Microsoft 's event-driven programming language Visual Basic 6 and its associated ...

Add media to your website > Cincopa
Create free slideshow for website, add music and video, create cool podcast. Use Cincopa easy to embed plugins and make your website engaging. ...

Pre-Process your images with promises
... images array. To facilitate data binding, //the WinJS.BindingList method is invoked, passing the //image array. WinJS.Namespace.define("ImageList", ...

Latest Menus Articles
This is a Codeguru directory of articles on the C++ topic of Menus.

Annotated Web MVC Controllers in Spring 2.5
Spring 2.5 introduces an approach for writing annotated Web MVC controllers, which we haven't been blogging about much yet... I'll take the opportunity ...

C# SDK Documentation — Leap Motion C# and Unity SDK v2.2 documentation
Developer Portal What's new Getting Started Documentation Examples Blog Community JavaScript C# and Unity C++ Java Python Objective-C C# SDK ...

.NET Compact Framework releases 1.0 SP3
- Transitions between managed and native code can cause memory leaks on ARM platforms. - A NullReferenceException is thrown when a Web Method ...

Microsoft Small Basic Program Listing
'- 'To-Do '- '- 'initialize the window first '- GraphicsWindow . Hide ( ) GraphicsWindow . CanResize = "false" GraphicsWindow . Width ...

Coded Smorgasbord: Sweet Mysteries of Life
... of an array... And finally, Andrew sends us this example of defensive programming, that’s about as safe as we can make it: Private Sub Im ...

Resources last updated: 3/11/2016 12:09:41 PM