Skip to content
Riccardo Ciovati edited this page Jan 9, 2015 · 4 revisions

Attributes

Besides the standard android: attributes, custom ones has been defined to be able to set specific parameter related to the view.

Below a list of the attributes, their default value (if any) and their correspondent Java method (if any).

Center Face

Tells the view whether to automatically crop the image so to center an eventually detected face.

  • XML Attribute:masaccio:center_face
  • Method: MasaccioImageView.setCenterFace(boolean)
  • Default value: false

Face Detection Activation Flags

Sets the flags indicating in which situation to activate the face detection (0 means always). Possible values regards the aspect ratio of the source image, that is, if the height is greater than the width (portraitImage), the width is greater than the height (landscapeImage) or they are equals (squareImage). Note that the flags can be composed with | in the XML or with & in Java. Note also that, in case the center face attribute is false, the flags will be ignored.

  • XML Attribute: masaccio:activate_face_detection
  • Method: MasaccioImageView.setActivateDetectionFlags(int)
  • Default value: 0

Post Scale

Sets the scale factor to apply after the crop has been computed. If a face is detected the scaled image will try to center it inside the view.

  • XML Attribute: masaccio:scale
  • Method: MasaccioImageView.setScale(float)
  • Default value: 1

Post X Translation

Sets the translation on the x axis to apply after the crop has been computed. The value is interpreted as a ratio of the difference between the cropped image and the view width.

  • XML Attribute: masaccio:translate_x
  • Method: MasaccioImageView.setTranslateX(float)
  • Default value: 0.5

Post Y Translation

Sets the translation on the y axis to apply after the crop has been computed. The value is interpreted as a ratio of the difference between the cropped image and the view height.

  • XML Attribute: masaccio:translate_y
  • Method: MasaccioImageView.setTranslateY(float)
  • Default value: 0.5

Pre Scale

Sets the scale factor to apply after the crop has been computed, but before the post matrix is applied. If a face is detected the scaled image will try to center it inside the view. Note that this attribute is useless if no animation is set (see below).

  • XML Attribute: masaccio:pre_scale
  • Method: MasaccioImageView.setPreScale(float)
  • Default value: 1

Pre X Translation

Sets the translation on the x axis to apply after the crop has been computed, but before the post matrix is applied. The value is interpreted as a ratio of the difference between the cropped image and the view width. Note that this attribute is useless if no animation is set (see below).

  • XML Attribute: masaccio:pre_translate_x
  • Method: MasaccioImageView.setPreTranslateX(float)
  • Default value: 0.5

Pre Y Translation

Sets the translation on the y axis to apply after the crop has been computed, but before the post matrix is applied. The value is interpreted as a ratio of the difference between the cropped image and the view height. Note that this attribute is useless if no animation is set (see below).

  • XML Attribute: masaccio:pre_translate_y
  • Method: MasaccioImageView.setPreTranslateY(float)
  • Default value: 0.5

Pre/Post Matrix Activation

Sets the flags indicating in which situation to activate the post matrix (0 means always). Possible values regards the aspect ratio of the source image, that is, if the height is greater than the width (portraitImage), the width is greater than the height (landscapeImage) or they are equals (squareImage), and wether a face has been detected (ifFace) or not (ifNoFace). Note that the flags can be composed with | in the XML or with & in Java. Note also that, in case the center face attribute is false, the flags will be respected anyway.

  • XML Attribute: masaccio:activate_matrix
  • Method: MasaccioImageView.setActivateMatrixFlags(int)
  • Default value: 0

Animation Duration

Sets the duration of the animation in milliseconds between the pre and post matrix.

  • XML Attribute: masaccio:animation_duration
  • Method: MasaccioImageView.setAnimationDuration(long)
  • Default value: 0

Animation Interpolator

Sets the interpolator of the animation between the pre and post matrix.

  • XML Attribute: masaccio:animation_interpolator
  • Method: MasaccioImageView.setAnimationInterpolator(Interpolator)
  • Default value: null

Cyclic Animation

Tells the widget to cyclically restart the animation between the pre and post matrix as soon as it ends.

  • XML Attribute: masaccio:cyclic_animation
  • Method: MasaccioImageView.setCyclicAnimation(boolean)
  • Default value: false

Minimum face detection confidence

Tells the widget to ignore the faces with confidence detection level less than the given value.

  • XML Attribute: masaccio:min_confidence
  • Method: MasaccioImageView.setMinConfidence(float)
  • Default value: 0
  • Valid values: 0-1