ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to access the Shape images?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

860 Posts

Posted - Sep 21 2020 :  17:40:40  Show Profile  Reply
How can I access the Shape images?

I would like to present the shapes to the user not only in a ComboBox but as THUMBNAILS in a Thumbnail View, like in Explorer.

xequte

38180 Posts

Posted - Sep 21 2020 :  19:41:46  Show Profile  Reply
Hi Peter

Please see the examples at IEDrawShape showing how to output all shapes:

http://www.imageen.com/help/IEDrawShape.html

You can also quickly draw shapes to a combo or list box:

http://www.imageen.com/help/IEDrawShapeToComboListBoxItem.html

or TImageEnMView:

http://www.imageen.com/help/AddShapesToImageEnMView.html:

// Save all shapes as gif files
for shp := Low(TIEShape) to High(TIEShape) do
begin
  bmp := TIEBitmap.Create;
  bmp.Allocate( Thumb_Size, Thumb_Size );
  bmp.Fill(clWhite );
  IEDrawShape( bmp.IECanvas, shp, 0, 0, bmp.Width, bmp.Height, iebTrue, clNone, 0, $00FF8000 );
  bmp.write( 'D:\' + IEShapeToStr( shp ) +'.gif');
  bmp.free;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 22 2020 :  11:03:22  Show Profile  Reply
Generally: As combo- or list-boxes have only a 1-dimensional selection functionality, a 2-dimensional selection mode offered by thumbnail-views is a better UI-choice for 2-dimensional items like shapes.
Go to Top of Page

xequte

38180 Posts

Posted - Sep 22 2020 :  16:14:59  Show Profile  Reply
Hi

The TImageEnMView makes a nice selector:

http://www.imageen.com/help/AddShapesToImageEnMView.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 22 2020 :  19:00:59  Show Profile  Reply
Thanks for the link!
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 23 2020 :  05:25:14  Show Profile  Reply
 
The TImageEnMView makes a nice selector


I am sure there is a method to give back the selected correct internal Shape index number even if parameter UniqueOnly = True?
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 23 2020 :  10:05:43  Show Profile  Reply
This is how I fill a TImageEnMView with shapes taking their colors from the current text-layer:



However, I was not able to figure out how to set the color of the area outside of the shape:



Can this color be set?
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 23 2020 :  10:21:40  Show Profile  Reply
Well, when setting
AlphaFill = True
the area gets filled. It seems to take its color from BackgroundColor in OnGetColors.

The documentation says: "AlphaFill uses an alpha background". Does this mean that the area outside of the shape is made transparent so that the background color shines through?
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 23 2020 :  10:48:58  Show Profile  Reply
I am always amazed how enormous the possibilities of ImageEn are!
Go to Top of Page

xequte

38180 Posts

Posted - Sep 23 2020 :  17:32:22  Show Profile  Reply
Thanks for your compliments, Peter,

In 9.2.0 (next week), if you have used AddShapesToImageEnMView, you can access the shape of an item by typecastings its tag as TIEShape, e.g.

// Get selected shape
shp := TIEShape( ImageEnMView1.ImageTag[ ImageEnMView1.SelectedImage ]);
ShowMessage( IEShapeToStr( shp ));


Regarding your draw issue, the images you are adding to the TImageEnMView probably do not have alpha. Can you show me your fill code?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 25 2020 :  10:08:48  Show Profile  Reply
Hi Nigel,

good. Currently, I get the shape by:

procedure TForm1.ImageEnMView1Select(Sender: TObject; idx: Integer);
begin
  ImageEnView1.Layers[FLayerIndex].BorderShape := TIEShape(idx);
end;


But accessing the shape from the shape-image tag is indeed a very good idea because it compensates for possible errors when UniqueOnly = True.

The problem with setting the color of the mentioned shape area has been solved by setting AlphaFill to True and with a smart color-management.
Go to Top of Page

xequte

38180 Posts

Posted - Sep 27 2020 :  16:11:52  Show Profile  Reply
Nicely done, Peter.

9.2.0 is out now too.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

860 Posts

Posted - Sep 27 2020 :  17:10:30  Show Profile  Reply
I've read the details. Looks very good.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: