Jump to content
angusj

Image32 - 2D graphics library (open source freeware)

Recommended Posts

Thanks for your continued effort in making Image32 better and better!

So I want to use your svg viewer, and would like to make the following changes, and I'm wondering if you accept pull requests (or does sf.net even have a "pull request" feature?)?

 

  • Change `TBaseImgPanel.fScrollbarHorz  : TPanelScrollbar` from private to public, so that I can implement my own key-bindings for panning the image view.
  • Add `OnMouseWheel` event.
  • Make `TBaseImgPanel.ScaleAtPoint` public so that can I implement customized zooming.

Basically, I want to change the way how the image's zoomed out/in and panning.

Thanks!

 

15 hours ago, angusj said:

Just updated to version 3.2

https://sourceforge.net/projects/image32/

 

 

Share this post


Link to post

 

19 hours ago, Edwin Yip said:

So I want to use your svg viewer, and would like to make the following changes

Done.

Also, there was a problem with the last update where I failed to upload a recent change in Img32.pas which caused problems in Img32.Layers. That's now fixed too.

I've also made a minor update to the Layers301 sample application.

https://sourceforge.net/projects/image32/files/

 

layers301.thumb.png.fcb51a3105e702f94f1dc58647908aa7.png

 

Edited by angusj
For Edwin :)
  • Like 3

Share this post


Link to post
2 hours ago, angusj said:

 

Done.

Also, there was a problem with the last update where I failed to upload a recent change in Img32.pas which caused problems in Img32.Layers. That's now fixed too.

I've also made a minor update to the Layers301 sample application.

https://sourceforge.net/projects/image32/files/

 

layers301.png.8108f60d22a21b6cdd9efe160c3380c7.png

 

Thanks Angus, I'll check it out!

What a vivid colorful looking of the picture! It reminds me the early days of the web 2.0 era where all websites have such vivid colorful looking.

Edited by Edwin Yip

Share this post


Link to post

@angusj I've tried converting SVG to PNG, are text layers not included during conversion or I maybe missing something? I just followed the example code.

 

Thank you. 

Share this post


Link to post
3 hours ago, misc_bb said:

I maybe missing something?

Hi misc_bb. Yes, I think you are 😜.

 

Try modifying the SVG101 sample by adding a TSaveDialog control (with filters for PNG and JPG file types).

Then make sure both Img32.Fmt.PNG and Img32.Fmt.JPG are in you uses clause.

Finally add a mainmenu option with the following OnClick event:

procedure TForm1.SaveAs1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
    ImagePanel.Image.SaveToFile(SaveDialog1.FileName);
end;

 

test.png

 

Edit: If the image has transparency, make sure you save it as in PNG format, otherwise you'll probably get a black background.

Edit2: And if you don't want to add that extra bit of code, just make sure the image panel has focus (in SVG101) and click Ctrl+C. Then you can paste the result into your favorite image editor.

Edited by angusj

Share this post


Link to post
34 minutes ago, angusj said:

Hi misc_bb. Yes, I think you are 😜.

 

Try modifying the SVG101 sample by adding a TSaveDialog control (with filters for PNG and JPG file types).

Then make sure both Img32.Fmt.PNG and Img32.Fmt.JPG are in you uses clause.

Finally add a mainmenu option with the following OnClick event:


procedure TForm1.SaveAs1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
    ImagePanel.Image.SaveToFile(SaveDialog1.FileName);
end;

 

test.png

 

Edit: If the image has transparency, make sure you save it as in PNG format, otherwise you'll probably get a black background.

Edit2: And if you don't want to add that extra bit of code, just make sure the image panel has focus (in SVG101) and click Ctrl+C. Then you can paste the result into your favorite image editor.

Thanks Angus,

 

I was actually considering this documentation from the site: http://www.angusj.com/delphi/image32/Docs/Units/Img32.Fmt.SVG/_Body.htm then I realized this was only a mere change of format maybe that's why the text layers were not considered. And when I applied the SVG101 for the same svg file it did show the text layers. Although they are a bit messed up due to the font styles but that's another story. 

 

How about without going through an ImagePanel will it still work? I'm seeing an error when I tried just declaring/creating ImagePanel on the fly without the actual component in the form. The error comes in during the LoadFromFile. 

Share this post


Link to post
54 minutes ago, misc_bb said:

I realized this was only a mere change of format maybe that's why the text layers were not considered

Actually I forgot to mention 😱, you have to load some fonts before they can be rendered in Image32 (and SVG files only very rarely contain font resources).

Image32 reads TrueType fonts both directly from files or indirectly through the OS as demo'ed in SVG101 ...

procedure TForm1.FormCreate(Sender: TObject);
begin
  ...
  FontManager.Load('Arial');
  FontManager.Load('Arial Bold');
  FontManager.Load('Arial Italic');
  FontManager.Load('Arial Bold Italic');
  FontManager.Load('Times New Roman');
  FontManager.Load('Times New Roman Bold');
  FontManager.Load('Times New Roman Italic');
  FontManager.Load('Times New Roman Bold Italic');

and make sure you add Img32.Text to your uses clause. Also, you don't need to load a whole lot of fonts, just the ones that you'll need.

 

More info here: http://www.angusj.com/delphi/image32/Docs/Units/Img32.Text/_Body.htm

 

54 minutes ago, misc_bb said:

How about without going through an ImagePanel will it still work?

You certainly don't need ImagePanel, that's just useful for displaying images on a form. You can just save images to file if you wish.

Edited by angusj
  • Like 2

Share this post


Link to post

@angusi

 

I am very interested in Image32 - forgive my dumb question -  is it suitable to be used for developing CAD-like application, or interactive 2D graphics (that is based on user mouse dragging etc)?

 

Thank you

Share this post


Link to post
1 hour ago, wuwuxin said:

is it suitable to be used for developing CAD-like application, or interactive 2D graphics (that is based on user mouse dragging etc)?

Hi wuwuxin. Here are several short videos that demonstrate Image32's interactive capabilities...

http://www.angusj.com/delphi/image32/Videos/img32.ctrls.mkv

http://www.angusj.com/delphi/image32/Videos/layers301.mkv

http://www.angusj.com/delphi/image32/Videos/layers201.mkv

 

 

  • Like 3
  • Thanks 1

Share this post


Link to post
42 minutes ago, Edwin Yip said:

The Image32-based controls demo is cool! And this seems to be a new feature added most recently.

It's a soon to be released **experimental** (or proof of concept) unit that creates visual controls entirely independant of VCL and FMX.

However, these controls would really require a lot of work to make genuinely useful and ISTM that I'm probably just reinventing the wheel.

Having said that this new Img32.CTRL unit could be very useful if there were reasonably simple Linux, Android and Mac equivalents of the Window's CreateWindow/WindowProc GUI.

 

Share this post


Link to post

I tried to run exsamples FMX1 and FMX2 but both fail!  Many errors were shown by the compiler.

 

Anybody have success on these 2 examples?  :classic_huh:

Share this post


Link to post
1 hour ago, TimCruise said:

I tried to run exsamples FMX1 and FMX2 but both fail!  Many errors were shown by the compiler.

Hi Tim. What version of Delphi are you using? Older versions of Delphi don't contain the FMX library.

Share this post


Link to post
36 minutes ago, angusj said:

Hi Tim. What version of Delphi are you using? Older versions of Delphi don't contain the FMX library.

I am using the Delphi Community v10.4.2.

 

I can run the bouncing green ball project, however.

 

I am totally new to this software and catching up quite well.  I guess it can help me to build a very large dashboard GUI. :classic_cheerleader:

Edited by TimCruise

Share this post


Link to post
10 minutes ago, TimCruise said:

I am using the Delphi Community v10.4.2.

I can run the bouncing green ball project, however.

I am totally new to this software and catching up quite well.  I guess it can help me to build a very large dashboard GUI. :classic_cheerleader:

Hi again Tim. I see in another thread that you've installed Image32 as part of SVGIconImageList. I suspect the problem lies there and you may need to temporarily uninstall 
SVGIconImageList and reinstalling Image32 before compiling the FMX sample apps. Otherwise, I'm not aware of anyone else having problems with compiling the samples.

  • Confused 1

Share this post


Link to post
19 hours ago, angusj said:

Hi again Tim. I see in another thread that you've installed Image32 as part of SVGIconImageList. I suspect the problem lies there and you may need to temporarily uninstall 
SVGIconImageList and reinstalling Image32 before compiling the FMX sample apps. Otherwise, I'm not aware of anyone else having problems with compiling the samples.

Angus,

If you can make a GitIT package, it will be much better.  :classic_unsure:

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×