cltom 1 Posted March 16, 2023 Hello, this is a topic over which I have been turning in circles sinces years. Which graphics library to choose for which task. What functionality is there, how hard is it to accomplish the given task. This may sound generic but I feel with graphics libraries it is the desperately hard. For my applications I often have some drawing functionality. For some applications I found reasonable approaches: for some GDI+, for other cases GR32. For one specific project/idea I am stuck however, meanwhile to a pretty extensive degree. I guess the fundamental problem is that all libraries would do the trick it is just my lack of skill (despite the years of trying) prevents progress. So I have been looking into all sorts of libraries, packages, demos, examples, recommendations and threads which of course does not accomplish the actual goal. What the application should do: from a library of images the user should be able to drag and drop elements to the main image. Those elements can then be moved, deleted, rotated, single or in groups. I was pretty far with that approach with Graphics32, not quite there yet, though. The functionality to mark multiple elements was missing. More accuarely, the functionality to find/mark objects was rubbish too. Later I found the TRubberband which could help but there I guess for my skill-level graphics32 might not be the right tool. I was lucky enough that some approaches worked but the documentation, the examples, I spend hours and hours trying to understand it with little success. Other than that I found the learning curve of GR32 brutally steep given that the documentation and demos are not easy to understand and there are pretty much no introduction like tutorials. One of the examples that was actually really helpful was the "Reflect it baby" application that was posted on the german DP site. Purely drawing-based tasks I have tackled with a GDI+ component with decent results, I do not quite see it being ideal in this case. I gave it another go with an SVG component (because ideally the graphics library would come from svg-files). However, I dropped that SVG goal again since dissecting the svg elements would create another level of complexity. Even though the approach to have the library elements editable would stil be amazing. I looked briefly into Skia, also there I feel the demos are impressive (just as the graphics32 demos) but I'd need to spend way more time and again, I barely understand the demos. Again, my own limitations. So, there I am, somewhere between desperately wanting to get this done and losing endless amounts of time with very little progress. Finally, the question then is: which library to display, arrange, select images (png or svg) would you recommend? Either because the built-in functionality is there or the documentation allows enough progress. Share this post Link to post
Lajos Juhász 293 Posted March 16, 2023 For Delphi the future could be Skia. There was a weak promise that in the next major release maybe the VCL is going to use it. Share this post Link to post
FPiette 383 Posted March 16, 2023 56 minutes ago, cltom said: I have been turning in circles since years. Reading your post, I think you are looking for a library which does exactly what your application has to do. That would be marvelous but forget it! You actually need a library (or even none since you can use Delphi built-in function) capable of doing primitive graphic manipulation and display. Speaking about the main image - as you name it - your application should have a model of what is expected on screen and a rendering engine. The model is a list of operation applied to images. The list is ordered. By manipulation, I mean and image, and an operation such as position at X/Y coordinate, rotate of a given angle, scale with a given factor, crop this way, mask like that, and so on. The user interaction solely work on the list. When the user want to move an image, you use mouse event and the list to find which (sub)image if on the top and the user want - for example - drag. At each user interaction, you do the rendering. At the end, instead of rendering on screen, you render to a standard bitmap that you write as JPG or other image file format. Got the idea? 1 Share this post Link to post
dwrbudr 8 Posted March 16, 2023 Probably ImageEN should do the job, but it is not free. It has a lot of demos you can check. 1 Share this post Link to post
cltom 1 Posted March 16, 2023 3 hours ago, Lajos Juhász said: For Delphi the future could be Skia. There was a weak promise that in the next major release maybe the VCL is going to use it. True, I also read that. Also, Skia seems to be getting some attention currently. Apart from the demos and some Webinars (like the Starship-UI) it is also a bumpy learning road. Share this post Link to post
cltom 1 Posted March 16, 2023 2 hours ago, FPiette said: Reading your post, I think you are looking for a library which does exactly what your application has to do. That would be marvelous but forget it! You actually need a library (or even none since you can use Delphi built-in function) capable of doing primitive graphic manipulation and display. Speaking about the main image - as you name it - your application should have a model of what is expected on screen and a rendering engine. The model is a list of operation applied to images. The list is ordered. By manipulation, I mean and image, and an operation such as position at X/Y coordinate, rotate of a given angle, scale with a given factor, crop this way, mask like that, and so on. The user interaction solely work on the list. When the user want to move an image, you use mouse event and the list to find which (sub)image if on the top and the user want - for example - drag. At each user interaction, you do the rendering. At the end, instead of rendering on screen, you render to a standard bitmap that you write as JPG or other image file format. Got the idea? Thank you for your input. Probably yes, I am trying to compensate my skill level by searching for components that do most of what I want to achieve. When I started, I found the layers-example in the GR32 demos and with the functionality there (importing images), selecting them, scaling them, etc. it seemed this is already very close. But then again that's the downside, if a solution covers 50% of what you need, the remaining 50% can be a long way if you did not do the first half yourself. To the process: I think the idea is clear. In my prototypes I already had built a simple XML-syntax to describe the objects, so I would essentially just edit text and for the graphical representation interpret it. Where I was struggling the most I guess is conceptual decisions: - do I draw on an offline bitmap and copy that bitmap to screen when needed - with GDI+ I do it like that. Should I be doing it like that with GR32? - how to implement the marching an/rubberband controls to select multiple objects - see above: do I draw the rubberband offline? I guess this has all been solved a million times - the library: do I draw all elements of the library onto one single image and arrange the single images on the big parent image? or do I rather create a series of Images (TImage or TImage32) and arrange those? I went as far as reading through some OpenSource vector drawing programs to understand concepts. But then again, how much do you understand (with a certain skill level) from such projects ... Share this post Link to post
cltom 1 Posted March 16, 2023 1 hour ago, dwrbudr said: Probably ImageEN should do the job, but it is not free. It has a lot of demos you can check. True, forgot this one. I tried that too, for some reason I dismissed those a while ago .. should check the demos again probably. Share this post Link to post
Alexander Sviridenkov 357 Posted March 16, 2023 IMHO such tasks should not depend on graphic library and should not require low-level graphics knowlege. What you need is object manipulation library, like vector diagram editor. Here is simple implementation using HTML Component Library (compiled and project source). 20 minutes, 50 lines of code. You can drag images from lbrary at right side, select it, resize, rotate, delete (Del key): https://delphihtmlcomponents.com/ImageMove.zip It can use Direct2d or GDI+ or FMX canvas on any platform - doesn't matter. 1 Share this post Link to post
FPiette 383 Posted March 16, 2023 1 hour ago, cltom said: In my prototypes I already had built a simple XML-syntax to describe the objects Forget XML. It is slow and memory hungry. Use a TObjectList containing object describing the item. All item objects derive from the same base class having common properties like X,Y, scale, rotate,... 1 hour ago, cltom said: do I draw on an offline bitmap and copy that bitmap to screen when needed Yes, this is the way to go. It is faster to draw in memory and gives a flicker free display update. Anyway you need to draw to an offline bitmap to save the result in a file. 1 hour ago, cltom said: do I draw all elements of the library onto one single image and arrange the single images on the big parent image? You draw all elements to an offline bitmap, including the big parent image and then you display it. You can optimize speed of display by remembering the area which has been updated since la time it has been output to screen. About the library: As I said before you only need graphic primitive. You'll do the rest yourself in your application. To select the library - if ever one is needed because there is already so much in FMX framework - first establish the list of all operations or features you need. Then you can select one. Share this post Link to post
Anders Melander 1784 Posted March 16, 2023 12 hours ago, Lajos Juhász said: There was a weak promise that in the next major release maybe the VCL is going to use it. The kiss of death. Apart from I don't see it happening. What would "the VCL" use it for? Share this post Link to post
Anders Melander 1784 Posted March 16, 2023 9 hours ago, cltom said: But then again that's the downside, if a solution covers 50% of what you need, the remaining 50% can be a long way if you did not do the first half yourself. I haven't seen you ask for help anywhere. You could have tried that. I can probably tell you how to solve your problems with Graphics32, should you choose to continue that way, but you need to ask the questions first 🙂 I believe Image32 does layers too and it might be more accessible than Graphics32. When @angusj comes online he can chime in on that. 9 hours ago, cltom said: - do I draw on an offline bitmap and copy that bitmap to screen when needed - with GDI+ I do it like that. Should I be doing it like that with GR32? If you're using the TImage32 or TImgView32 controls then the double buffering is already built in and handled automatically. Each layer just needs to draw itself into a bitmap and the control will take care of the rest. 9 hours ago, cltom said: - how to implement the marching an/rubberband controls to select multiple objects - see above: do I draw the rubberband offline? I guess this has all been solved a million times Use a TRubberbandLayer. The layer is drawn on demand onto a bitmap like all other layers but that is already done by TRubberbandLayer so you don't need to do anything special. 9 hours ago, cltom said: the library: do I draw all elements of the library onto one single image and arrange the single images on the big parent image? or do I rather create a series of Images (TImage or TImage32) and arrange those? It depends on your needs. One possible solution is to have each vector object be represented by its own layer. Another is to draw all objects onto a single layer. Or you could do a combination. For simplicity, I would probably choose to draw all objects onto a single layer. Regardless TImage32 takes care of producing the final combined image. Share this post Link to post
Anders Melander 1784 Posted March 16, 2023 2 minutes ago, Anders Melander said: Use a TRubberbandLayer. The layer is drawn on demand onto a bitmap like all other layers but that is already done by TRubberbandLayer so you don't need to do anything special. Actually, now that I think of it, a TRubberBandLayer is used to move and resize another layer (see the ImgView_Layers example). For freehand rubber band selection, you would need to implement a custom layer. It's pretty simple. Btw, have you seen this old post: Share this post Link to post
angusj 126 Posted March 17, 2023 (edited) 4 hours ago, Anders Melander said: When @angusj comes online he can chime in on that. I've been lurking 😜, but when the OP mentioned TImage32, I was pretty sure he was referring to that class in Graphics32, rather than my own Image32 Graphics Library. While Image32 has many similarities with Graphics32, unlike Graphics32 it's cross-platform (using either FPC or Delphi's FMX framwork), and it also supports SVG images (reading not writing) which seems relevant given the parameters in this discussion. 17 hours ago, cltom said: What the application should do: from a library of images the user should be able to drag and drop elements to the main image. Those elements can then be moved, deleted, rotated, single or in groups. Drag and drop isn't something that a graphics library should do, but but rotating (and resizing and transforming etc) most definitely are things any decent graphics library will do. 17 hours ago, cltom said: I gave it another go with an SVG component (because ideally the graphics library would come from svg-files). However, I dropped that SVG goal again since dissecting the svg elements would create another level of complexity. Even though the approach to have the library elements editable would stil be amazing. SVG files, as in a library of SVG images, is completely separate from a Graphics (Display) Library, and I'd strongly recommend you source those separately. Anyhow, supporting SVG, even just reading them, is a huge task, but I think I've done a reasonable job of this in my Image32 library. (And Image32 is currently the preferred renderer for SVGIconImageList). As for editing SVG images, that is way beyond the means of a single developer. And while it may seem related to graphics display, it really isn't, and I seriously doubt you'd find a Graphics Libray (in any language) that supported editing SVG images. 17 hours ago, cltom said: I was pretty far with that approach with Graphics32, not quite there yet, though. ... I spend hours and hours trying to understand it with little success. Other than that I found the learning curve of GR32 brutally steep given that the documentation and demos are not easy to understand and there are pretty much no introduction like tutorials While Graphics32 is still an excellent library, IMHO it's now showing it's age and the documentation hasn't been updated in a very long time. So unless you've been using the library for a long time (and there are many who have and still are), it won't be easy getting up to speed. Edited March 17, 2023 by angusj typo, grammar Share this post Link to post
Edwin Yip 154 Posted March 17, 2023 Graphics32 + Angus's GR32_lines and GR32_text can be firm foundation for graphical apps. And no one mentioned https://github.com/fatihtsp/Blen2d4Delphi ? Share this post Link to post
cltom 1 Posted March 17, 2023 5 hours ago, Anders Melander said: I haven't seen you ask for help anywhere. You could have tried that. I can probably tell you how to solve your problems with Graphics32, should you choose to continue that way, but you need to ask the questions first 🙂 I believe Image32 does layers too and it might be more accessible than Graphics32. When @angusj comes online he can chime in on that. If you're using the TImage32 or TImgView32 controls then the double buffering is already built in and handled automatically. Each layer just needs to draw itself into a bitmap and the control will take care of the rest. Use a TRubberbandLayer. The layer is drawn on demand onto a bitmap like all other layers but that is already done by TRubberbandLayer so you don't need to do anything special. It depends on your needs. One possible solution is to have each vector object be represented by its own layer. Another is to draw all objects onto a single layer. Or you could do a combination. For simplicity, I would probably choose to draw all objects onto a single layer. Regardless TImage32 takes care of producing the final combined image. Hello Anders, thanks a lot for your input and the offer to help ;-) Having used GR32 for some projects, I have a bias to continue to use it. Also the more successfull applications and prototypes and are based on GR32. Two of the main conceptual topics are already answered (single image vs. multiple layers and doublebuffering). Regarding single image vs. layers: does the number of layers make a difference in the choice? I expect around 50-300 elements. Simplicity is a strong argument though ;-) Drawing the elements that way already works pretty straightforward. I have all the images in a Bitmap32List and copy them over to the main Image32. By the way: is there a recommendation difference for this task between GR32.Image32 and ImageView32? Regarding DoubleBuffering: so it should work to have the procedure that draws everyting in the MouseMove event of the Image32? Something like: procedure Tfrm_Draw.img_MainMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer; Layer: TCustomLayer); begin case SelectedTool of pmSelect : if ssLeft in Shift then Drawing.ObjectMove(X, Y); end; Drawing.Draw(Library); end; and procedure TDrawing.Draw(ElementLibrary: TLibrary); begin Destination.SetupBitmap(true, Config.BackGroundColor); Destination.BeginUpdate; if Config.BackGroundImageShow then DrawBackgroundImage; if Config.GridShow then DrawGrid; DrawAllElements(ElementLibrary); Destination.EndUpdate; end; Destination being a TImage32. I guess with larger images this might give performance issues? Or does this approach still allow to only repaint a section? In case of drawing all elements onto a single GR32.Image32 the idea is then to use the TRubberBand for the visual representation of the frame but do the selection of the elements within that range manually? Finding the objects is not difficult given their coordinates and dimensions. Thank you!! Share this post Link to post
cltom 1 Posted March 17, 2023 5 hours ago, Anders Melander said: Actually, now that I think of it, a TRubberBandLayer is used to move and resize another layer (see the ImgView_Layers example). For freehand rubber band selection, you would need to implement a custom layer. It's pretty simple. Btw, have you seen this old post: I will look into it, thank you!! Share this post Link to post
cltom 1 Posted March 17, 2023 (edited) 4 hours ago, Edwin Yip said: Graphics32 + Angus's GR32_lines and GR32_text can be firm foundation for graphical apps. And no one mentioned https://github.com/fatihtsp/Blen2d4Delphi ? thank you! Just as a sidenote, seeing another package, I guess if all the brilliant people that have created these libraries aligned their efforts and focuses on fewer but more consistently supported libraries, it would be a huge leap. Edited March 17, 2023 by cltom grammar correction Share this post Link to post
angusj 126 Posted March 17, 2023 (edited) 44 minutes ago, cltom said: I guess if all the brilliant people that have created these libraries aligned their efforts and focus on fewer but more consistently supported libraries, it would be a huge leap. I was a contributor to Graphics32 for many years, but eventually Graphics32 had become too unweildy for me, and no longer useful over the longer term. My initial inclination was to do a major Graphics32 rewrite/update .. things like pruning 20!! various Line and Lineto methods from TBitmap32. These kind of made sense historically, but made absolutely no sense now. But when I started pruning these methods, I realised I was unravelling a Gordian's knot (ie an almost impossible task). So many of these methods had been interwoven inside other methods that I realised I'd be better off starting from scratch, which is what I did with Image32. Edit: Not that I'm including myself in "all the brilliant people", just a long term programming hack 😜. Edit2: And an expert is just someone who knows an awful lot about very little. Edited March 17, 2023 by angusj Share this post Link to post
cltom 1 Posted March 17, 2023 (edited) 2 hours ago, angusj said: I was a contributor to Graphics32 for many years, but eventually Graphics32 had become too unweildy for me, and no longer useful over the longer term. My initial inclination was to do a major Graphics32 rewrite/update .. things like pruning 20!! various Line and Lineto methods from TBitmap32. These kind of made sense historically, but made absolutely no sense now. But when I started pruning these methods, I realised I was unravelling a Gordian's knot (ie an almost impossible task). So many of these methods had been interwoven inside other methods that I realised I'd be better off starting from scratch, which is what I did with Image32. Edit: Not that I'm including myself in "all the brilliant people", just a long term programming hack 😜. Edit2: And an expert is just someone who knows an awful lot about very little. Thank you for the insight! I guess with every growing project you can come to a point where the continuous addition of complexity and the widening of the scope over the years results in the feeling that the only way forward is to start all over with better structures to begin with (at least in this aspect I think I know what I am talking about ;-)). I clearly cannot comment on the specifics of GR32, I just used it in some applications. However, after browsing graphics libraries for some time now and finding a myriad of them in all sorts of flavours, degrees of completion, target auditorium, documentation quality, accessibility, future proofness and of course commercial approaches I had the impression that many of the projects seem to rely on the effort of individuals. As impressive as it is, this left me with the question, if the "market" for components/libraries in the Delphi space is big enough for so many solutions and if a common effort would lead to a more sustainable, more accessible, better documented, better supported solution. Also this is more a question than a statement. Personally, my biggest struggle is to get into these components. There are often demos, which is an excellent showcase, an ad if you will. However, to me it sometimes feels like advertising a set of workshop tools with an art nouveau dresser. It is impressive that such a piece of furniture was built with those tools. If you want to build a table of your own, it is however, still a long journey. By no means I am not complaining about the availability of components (many of them even free of charge) where individuals have spent months of their time to create something that enables others to build something. I am deeply impressed and grateful for these components. Also, of course, I am nowhere close to judge about how many libraries are the "right amount" let alone "which is the best". Again, I was just asking, given the fact that there are only so many of those experts/hacks/experts 😉 and the target auditorium is not exactly a million of JS developers, if the balance is right between the number of packages vs. the broad acceptance/documentation/future proofness/... of them. Edited March 17, 2023 by cltom missing part Share this post Link to post
Cristian Peța 103 Posted March 17, 2023 12 hours ago, Anders Melander said: The kiss of death. Apart from I don't see it happening. What would "the VCL" use it for? Custom Styles? They are so slow now. Share this post Link to post
angusj 126 Posted March 17, 2023 3 hours ago, cltom said: As impressive as it is, this left me with the question, if the "market" for components/libraries in the Delphi space is big enough for so many solutions. Honestly, the "market" for new Delphi components/libraries died about 10 years ago. The only people writing Delphi code now are old timers who've been around since Borland days, and before its lead developer got poached by Microsoft to write C#. So there's no longer a market for third-party Delphi developers, unless they've migrated their code into other languages (usually C#). The only "new" Delphi code is written by old hacks like me who aren't trying to make money out of this. Share this post Link to post
Anders Melander 1784 Posted March 17, 2023 11 hours ago, cltom said: Regarding single image vs. layers: does the number of layers make a difference in the choice? No, I don't think it should. A layer is a fairly small object so the overhead should be negligible. 11 hours ago, cltom said: I have all the images in a Bitmap32List and copy them over to the main Image32. I think the easiest way to do it with layers would be to have each layer associated with a bitmap (i.e. it contains a reference to the bitmap, not a copy of the bitmap) and then have the layer draw the bitmap onto the TImage32 back-buffer. 11 hours ago, cltom said: By the way: is there a recommendation difference for this task between GR32.Image32 and ImageView32? One has scrollbars (to move the viewport), and the other doesn't. That's about it I think. 11 hours ago, cltom said: Regarding DoubleBuffering: so it should work to have the procedure that draws everyting in the MouseMove event of the Image32? No, definitely not. Each layer draws itself onto the back buffer on demand (i.e. when the TImage32 requests it). To force a layer to redraw itself you call the layer Changed method. To force a full redraw call TImage32.Changed You can either use a standard TPositionedLayer (and draw in its OnPaint event handler) or a simple custom layer class that can draw itself: type TIndirectBitmapLayer = class abstract(TPositionedLayer) // Based on TCustomBitmapLayer. Does not own the bitmap it draws. private FBitmap: TBitmap32; FCropped: Boolean; protected procedure Paint(Buffer: TBitmap32); override; protected procedure SetCropped(Value: Boolean); property Bitmap: TBitmap32 read FBitmap; public constructor Create(ALayerCollection: TLayerCollection; ABitmap: TBitmap32); property Cropped: Boolean read FCropped write SetCropped; end; constructor TIndirectBitmapLayer.Create(ALayerCollection: TLayerCollection; ABitmap: TBitmap32); begin inherited Create(ALayerCollection); FBitmap := ABitmap; end; procedure TIndirectBitmapLayer.Paint(Buffer: TBitmap32); var SrcRect, DstRect, ClipRect, TempRect: TRect; ImageRect: TRect; begin if FBitmap.Empty then Exit; DstRect := MakeRect(GetAdjustedRect(Location)); ClipRect := Buffer.ClipRect; GR32.IntersectRect(TempRect, ClipRect, DstRect); if GR32.IsRectEmpty(TempRect) then Exit; SrcRect := MakeRect(0, 0, FBitmap.Width, FBitmap.Height); if Cropped and (LayerCollection.Owner is TCustomImage32) and (not TImage32Access(LayerCollection.Owner).PaintToMode) then begin if (DstRect.Width < 0.5) or (DstRect.Height < 0.5) then Exit; ImageRect := TCustomImage32(LayerCollection.Owner).GetBitmapRect; GR32.IntersectRect(ClipRect, ClipRect, ImageRect); end; StretchTransfer(Buffer, DstRect, ClipRect, FBitmap, SrcRect, FBitmap.Resampler, FBitmap.DrawMode, FBitmap.OnPixelCombine); end; procedure TIndirectBitmapLayer.SetCropped(Value: Boolean); begin if Value <> FCropped then begin FCropped := Value; Changed; end; end; 11 hours ago, cltom said: In case of drawing all elements onto a single GR32.Image32 the idea is then to use the TRubberBand for the visual representation of the frame but do the selection of the elements within that range manually? Finding the objects is not difficult given their coordinates and dimensions. A standard TRubberbandLayer can be associated with a single "child layer" at a time and can then be used to move and resize that child layer. You will probably want something that can handle multi-selection. I would look at how TRubberbandLayer works and try to extend that. Drawing of object frames and similar stuff can be done in layers that sit below or on top of everything else. For example look at the following (it's from a bitmap editor): From bottom to top we have: Background, including frame with drop-shadow Checkerboard pattern Image layers (there's two in this example) Raster grid Selection mask (marching ants) Tool cursor (a stippled polygon) //------------------------------------------------------------------------------ // // TBitmapEditor Layers and Paint Stages // //------------------------------------------------------------------------------ (* +---------------------+ ^ / / | / Hotspot /-+ | +---------------------+ / | / Cursor /-+ | +---------------------+ / | / Selection /-+ | +---------------------+ / | / Mask /-+ Layers ---> | +---------------------+ / | / Grid /-+ | +---------------------+ / | / Tool rendering /-----+ | +---------------------+ / | / Layer 2 /-+ | +---------------------+ / | / Layer 1 /-+ | +---------------------+ / | / Floating selection /-+ | +---------------------+ / | / Layer 0 /-----+ ^ +---------------------+ / | / Image /-+ | +---------------------+ / | <--- Stages / Background /-+ | +---------------------+ / | / / +---------------------+ *) I think you should start by getting the bitmap layers working and then we can talk about how to handle the selection UI later. Share this post Link to post
Anders Melander 1784 Posted March 17, 2023 11 hours ago, angusj said: things like pruning 20!! various Line and Lineto methods from TBitmap32. These kind of made sense historically, but made absolutely no sense now. As I've explained to you before, the reason why there are so many variants is that a line is a low-level primitive and the many different variants cover 3 different coordinate types (fixed, float, integer) and different combinations of orientation, anti-aliasing, transparency, stippling, and clipping options. Each one optimized for its particular feature subset. Sure, we could have just replaced them all with a single mediocre all-in-one method, but then why use Graphics32 at all if not for the performance gains possible with specialization? 9 hours ago, cltom said: I guess with every growing project you can come to a point where the continuous addition of complexity and the widening of the scope over the years results in the feeling that the only way forward is to start all over with better structures to begin with (at least in this aspect I think I know what I am talking about ;-)). If the library architecture is poorly designed, or the architecture has become obsolete, then I would agree that it might make sense to start from scratch. I don't really think that's what we're talking about here, though. It's just so much easier (and often more fun) to write code when you don't have to stay within the constraints of an existing framework. I think many libraries, not just graphics libraries, start as someone's hobby experiment and eventually end up growing into a fully featured library that does the same as all the others, but in a slightly different way. From an evolutionary POV diversity is good, but with an eco-system as small as Delphi's I think it just fragments the users - and the contributors. 9 hours ago, cltom said: Personally, my biggest struggle is to get into these components. There are often demos, which is an excellent showcase, an ad if you will. However, to me it sometimes feels like advertising a set of workshop tools with an art nouveau dresser. It is impressive that such a piece of furniture was built with those tools. If you want to build a table of your own, it is however, still a long journey. Yes, that's definitely a problem. https://github.com/graphics32/graphics32/issues/69 5 hours ago, angusj said: The only people writing Delphi code now are old timers who've been around since Borland days, and before its lead developer got poached by Microsoft to write C#. Wow. I can't speak about how things are in Australia, but at the companies I work with there are more "young" Delphi developers than "old" ones (and I'm not defining "young" as "younger than me" 🙂 ). WRT Anders Hejlsberg isn't it time to let that one go? He was just a (very skilled) developer who left for another job. It happens, you know. 1 Share this post Link to post
cltom 1 Posted March 18, 2023 13 hours ago, Anders Melander said: No, definitely not. Each layer draws itself onto the back buffer on demand (i.e. when the TImage32 requests it). To force a layer to redraw itself you call the layer Changed method. To force a full redraw call TImage32.Changed You can either use a standard TPositionedLayer (and draw in its OnPaint event handler) or a simple custom layer class that can draw itself: I think you should start by getting the bitmap layers working and then we can talk about how to handle the selection UI later. Hej Anders, as a quick reaction: thank you for the support! I will dive into the layer concept a little more as (until now) the only way I did was to draw everyting onto one bitmap. Thanks for the patience! 😉 best regards thomas Share this post Link to post
cltom 1 Posted March 18, 2023 13 hours ago, Anders Melander said: SrcRect := MakeRect(0, 0, FBitmap.Width, FBitmap.Height); if Cropped and (LayerCollection.Owner is TCustomImage32) and (not TImage32Access(LayerCollection.Owner).PaintToMode) then begin if (DstRect.Width < 0.5) or (DstRect.Height < 0.5) then Exit; ImageRect := TCustomImage32(LayerCollection.Owner).GetBitmapRect; GR32.IntersectRect(ClipRect, ClipRect, ImageRect); end; StretchTransfer(Buffer, DstRect, ClipRect, FBitmap, SrcRect, FBitmap.Resampler, FBitmap.DrawMode, FBitmap.OnPixelCombine); end; Sorry, the TImage32Access and Stretchtransfer come from which unit? Share this post Link to post