5

There are a few Paint constant in Android about which I couldn't find much info. Could anyone help me with a bit of explanation about those flags:

  • LINEAR_TEXT_FLAG
  • SUBPIXEL_TEXT_FLAG
  • FILTER_BITMAP_FLAG

Is 'subpixel' mode something close to ClearType or is it something altogether different?

Toto
  • 89,455
  • 62
  • 89
  • 125
Albus Dumbledore
  • 12,368
  • 23
  • 64
  • 105

1 Answers1

8

SUBPIXEL is indeed for sub-pixel antialiasing, which is currently not supported on Android. Setting this flag will have no effect. FILTER_BITMAP is used to apply bilinear filtering to bitmaps when they are transformed (scaled for instance.) It's usually a good idea to enable FILTER_BITMAP unless speed matters (much) more than quality. LINEAR_TEXT is used to draw text at a 64px text size with a scale factor set to your textSize/64.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200
  • 1
    Thanks, Romain! Could you explain a bit more about the LINEAR_TEXT flag? I mean, I still don't understand why one would need to use it. Also there's that in the docs, for the LINEAR_TEXT_FLAG constant they say 'bit mask for the flag enabling linear-text (no caching)'. Do you know what is that 'caching' here they are talking about? – Albus Dumbledore Jan 19 '11 at 21:28
  • By the way, I am very happy to be talking directly to a developer from the Android team! – Albus Dumbledore Jan 19 '11 at 21:32
  • 5
    Text rendering uses a font cache containing bitmap representations of each glyph the application needs. Linear text basically lets you skip the font cache. – Romain Guy Jan 19 '11 at 22:03