Unit 'icon' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#amunits]

GetIconRectangleA

Query the size of the area an icon renders into

Declaration

Source position: icon.pas line 368

function GetIconRectangleA(

  rp: pRastPort;

  const icon: pDiskObject;

  const label_: pCHAR;

  rect: pRectangle;

  const tags: pTagItem

):LongBool;

Arguments

rp

  

Pointer to the RastPort to use for calculating the the size of the label with respect to the font and style options currently in use; this parameter may be NULL if the label is NULL, too.

icon

  

True if the parameters were well-formed and the output data fits into the Rectangle data structure (which may not be the case if the image is too large for a signed 16 bit integer to hold).

label_

  

Label for icon, if nil no text is calculated

rect

  

Pointer to a Rectangle to fill in. The contents will take the size of the icon image, the icon border size and -- if you provide RastPort and label text -- the icon label into account. Due to how labels are printed, the rectangle^.MinX and rectangle^.MinY members may be negative.

tags

  

Additional drawing options to be taken into account. (ICONDRAWA_*)

Description

This function will calculate the size of the area icon rendering would affect.

Notes:

This function can be used to optimize on-screen rendering by precalculating the area rendering would cover. To make sure that the precalculated area size matches the one covered by the actual drawing operation, the RastPorts you use for measuring and for drawing should share the same font and the same text styles.

The image size calculated by this function can be slightly larger than the data you will find in the icon's do_Gadget.GadgetRender Image structure since the icon border will be taken into account. This happens regardless of whether icon.library was switched into frameless icon rendering mode or whether the icon is frameless. To obtain the size of the icon without taking the border into account, use the ICONDRAWA_Borderless tag.

See also

DrawIconStateA

  

Draw an icon as if it were an image

IconControlA

  

Set and get icon and icon.library options


Documentation generated on: 2021-07-30