Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

delphi cartoon drwaing

I need an application so:
1) It loads a JPEG or BMP at the background (easy part)
2) User can add some pre-defned shapes (as comic strip ballon above the background) and texts
3) User can move/edit/delete this baloons and edit texts as well
4) User can save the whole work in JPEG

Is there an avaible component to make this work ?

Best regards
1 Solution
TheRealLokiSenior DeveloperCommented:
the only tricky part is placing the baloons/text on the image without blitzing the background.
This link shows you how to do that

So, load the jpg, but convert it to bmp so you can work on it more easily (by using image1.pictures.bitmap.canvas)

Apart from that, keep an "original image" on file (and in memory while you work), and perhaps simply make a list of "changes done to the image"
an ini file for example

[change 1]
type=overlay image
overlay image filename=c:\temp\baloonshape1.jpg

[change 2]
font=comic sans serif
font size=10
font color=$00FF00
font underline=0
font bold=1

basically 1 ini section per actual end result image/text that has been added.
as you move a baloon, update the ini file, and then "redraw the whole thing" 1 step at a time (the image and mask may still be in memory if you use that link i pasted above)

That's probably how I'd do it anyway
hello yarek , ,  I can not tell much from your statements in your question about the complexity of your  " pre-defned shapes " or the pixel size of these, and other factors that would affect this kind of operation, , but if you do not need photographic image detail in your " pre-defned shapes ", I would think that Meta file images (delphi TMetafile) would be the best way to do this, you can also do text as a TMetafile, , with TMetafiles you will not need to do masking for transparent drawing. . .  Have you used the TMetafile ?
the graphics 32 package is great for this :)

Graphics32 is a set of functions, classes, components and controls designed for high-performance graphics programming.

Being highly specialized for 32-bit pixel format, it provides fast operations with pixels and graphic primitives and in most cases Graphics32 considerably outperforms standard TBitmap/TCanvas classes.

The library comes with a full source code, documentation and examples.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now