Why so many types? TGraphic, TPicture, TImage, TBitmap etc lazarus / 39-Graphics ---------------------------------------------------------------------- Graeme · 2015-11-03 13:12 As the subject line says... Why are there so many different data types for seemingly the same thing - a representation of an image in memory. On the contrary, fpGUI only has TfpgImage, which can be instantiated and populated from file, copied rectangle from a canvas, memory (direct access to ImageData), drawn directly via AggPas etc. fpGUI doesn't need more "image data types", so why does VCL and LCL have so many different types? What are they all used for? ---------------------------------------------------------------------- skalogryz · 2015-11-03 13:35 This is OOP wrappers over win32api. Good old legacy. So here how it works. The basic abstract-class is TGraphics. It does nothing by itself and has to be implemented. Implementations are: TBitmap, TIcon ... something else. Why TBitmap and TIcon were chosen, probably because of win32api HBITMAP and HICON. TPicture is just a container for TGraphics, it can load it from different formats and allocates a proper TGraphic instance. It also provides methods to convert on TGraphic implementation to another (i.e. force TBitmap to TIcon or so). Good old delphi / Win32 legacy. TImage is actually visual LCL component, so an image (TPicture, as the container for any sort of TGraphics) could placed on a form as a control. To make things worse, both RTL and LCL has additional layers/implementations of image processing. ---------------------------------------------------------------------- Graeme · 2015-11-03 14:31 Quote from: skalogryz on November 03, 2015, 02:35:00 pmGood old delphi / Win32 legacy. ...snip... To make things worse, both RTL and LCL has additional layers/implementations of image processing. Many thanks for that info. What a mess though! It is just confusing and overcomplicating matters. ---------------------------------------------------------------------- taazz · 2015-11-03 20:08 TGraphic = abstract uncestor of in memory graphics, used on tbitmap, tgif, tpng etc each class manages only the peculiarities of its own format no unnecessary comvertions from jpg to bmp if not absolutly necessary. TPicture = polymorphic tgraphic container can host any tgraphic descentant and can convert between them tooused to open graphic files from disk and databases.TImage = a proxy to draw the graphic on screen its canvas is directly linked to the parent control's canvas and not the graphics internal data. Its properties define the on screen region that the graphic is to be displayed and not the graphics dimensions overall you could say that the image has no real value other than displaying a graphic on screen.Some have tried to extend it with graphic manipulation routines like stretching rotating grayscale and monochrome conversions and various other filters conversions but it never catch on because it was not designed to support an arbitrary number of filters so you ended up with multiple TImage descendants that each one could do a couple of things but none could do all of them. It is a good design that allows you to focus on the problem at hand. As it stands I prefer the current design from a single TImage with everything coded in there and no easy way to extend it.