3028 Commits

Author SHA1 Message Date
Seigo Nonaka
ba3028c1fc Introduce set/getFontVariationSettings.
This CL enables developers to specify axis values to the underlying
font collection. The specification of the font variation settings is
the same as the CSS font-variation-settings attribute in CSS working
draft as of 2016-11-30.

Code example: Here is an example to set width 100 and weight 1.5.

  TextView tv = (TextView) findViewById(R.id.textView);
  tv.setFontVariationSettings("'wdth' 100, 'wght' 1.5");

Bug: 33062398
Test: Manually done. Ran FrameworksGraphicsTests, CtsGraphicsTestCases
      and CtsWidgetTestCases
Change-Id: I249d464f8cdaa56017a987588b94ed685aadeb58
2017-01-12 18:11:03 +09:00
Seigo Nonaka
a0a4828614 Follow minikin::FontFamily constructor signature change.
minikin::FontFamily no longer has addFont function, instead it accept
vector of Fonts in its constructor. To follow this signature change,
holding minikin::Font instance in native and build minikin::FontFamily
instance in FontFamily.freeze() method.

Test: hwui test passed
Change-Id: Id10ca97f6f6f5bbe4999c1ad2736423a204d6e87
2017-01-11 17:57:59 +09:00
Derek Sollenberger
c543713bab Merge "Remove clipRegion from the public API." 2017-01-09 18:01:50 +00:00
sergeyv
6e3658a638 Hidden method to get a graphic buffer from a hardware bitmap
Test: locally tested Bitmap.getGraphicBuffer()
bug:30999911
Change-Id: I68d56d769045bada6a5db90ed884a570c49be4fd
2017-01-05 17:03:48 -08:00
sergeyv
0a0f23163a Move GraphicBuffer to graphics package
Test: locally tested Bitmap.createHardwareBitmap method
bug: 30999911
Change-Id: Iad432577f26f2362ede9e77cd8a5425c010692e5
2017-01-04 14:01:52 -08:00
Derek Sollenberger
b29b16e542 Remove clipRegion from the public API.
This API is difficult to support for printing and has other negative
effects as it does not respect the current matrix/clip.

Test: compile
Bug: 14650725
Change-Id: I71f9bd687d446c7ce8910d755421aad8e09458db
2017-01-04 14:57:43 -05:00
sergeyv
980bead518 Prohibit copyPixelsToBuffer & copyPixelsFromBuffer
Test: BitmapTest#testHardwareCopyPixels(From|To)Buffer
bug:30999911
Change-Id: I3bfa2846bff574bc0bfd54674eac794d1a6a0ff9
2017-01-03 15:54:57 -08:00
sergeyv
81f97ee47c HardwareBitmaps: support createBitmap methods that return immutable bitmap
Test: testCreateScaledBitmap, testCreateTransformedBitmap, testCreateSubsetBitmap in HardwareBitmapTests
bug:30999911
Change-Id: Ic128dfed78b18ad6f12dad50023ee7c2f5bfa4ad
2017-01-03 15:53:03 -08:00
Sergei Vasilinetc
99418fb205 Merge "Throw exception if getPixel(s) is called on a hardware bitmap" 2016-12-20 18:56:31 +00:00
Sergei Vasilinetc
3029730399 Merge "Add docs about Config.HARDWARE in Bitmap.writeToParcel method" 2016-12-20 18:55:21 +00:00
Mark Lu
b927731284 docs: update Paint.setTextSize() to indicate pixel units am: 5f05256106 am: 9c834b1241 am: 4da3266828
am: 84f12cd33e

Change-Id: I463334d7c43cb934848e10eb3040f4a898f6ed2c
2016-12-19 20:34:29 +00:00
Mark Lu
84f12cd33e docs: update Paint.setTextSize() to indicate pixel units am: 5f05256106 am: 9c834b1241
am: 4da3266828

Change-Id: I65e2a1c43bd049e5c4cada55e8689ecc98a70fa5
2016-12-19 20:27:51 +00:00
sergeyv
57eafc6f90 Throw exception if getPixel(s) is called on a hardware bitmap
Test: android.graphics.cts.BitmapTest#testHardwareGetPixel
bug:30999911
Change-Id: Ifa5a80d048c44c91122e9e7c79ca3ef9ecab963e
2016-12-19 11:52:06 -08:00
sergeyv
f161dce70e Add docs about Config.HARDWARE in Bitmap.writeToParcel method
Test: android.graphics.cts.BitmapTest#testWriteHwBitmapToParcel
bug:30999911
Change-Id: I5282df7d881d76f3e78979a2e5d3777f78673a5d
2016-12-19 10:56:27 -08:00
Sergei Vasilinetc
8b6fe1d894 Merge "Support Bitmap.copy for hardware bitmaps" 2016-12-19 18:41:21 +00:00
Mark Lu
cab02c5b3a docs: update description for BitmapFactory.Options#inBitmap am: a8f4286272 am: 58d24b22ed am: 2b77de3a44
am: f34e9fc48d

Change-Id: I856c71a7b0dd930ecc0b5cc8805060a65a197324
2016-12-19 18:14:24 +00:00
Mark Lu
5f05256106 docs: update Paint.setTextSize() to indicate pixel units
bug: 2321154
Change-Id: Ic71404677a8079c744b99d4848d69c6ff52089ab
2016-12-17 07:23:29 +00:00
Mark Lu
2b77de3a44 docs: update description for BitmapFactory.Options#inBitmap am: a8f4286272
am: 58d24b22ed

Change-Id: I8e3a23304924623e2379155dcc7df1f739a5b7f0
2016-12-17 02:28:22 +00:00
sergeyv
05126d151e Support Bitmap.copy for hardware bitmaps
Test: android.uirendering.cts.testclasses.HardwareBitmapTests#testBitmapConfig*
bug:30999911
Change-Id: I2e80dff914bfa0666290701072ac93d30d218e8d
2016-12-16 17:46:10 -08:00
Mark Lu
a8f4286272 docs: update description for BitmapFactory.Options#inBitmap
bug: 18730109
Change-Id: Iab062d41af3a32208d3500179d3737278a035188
2016-12-16 15:43:27 -08:00
Romain Guy
f7e79d6eb3 Remove RGBX_FP16 format
Bug: 32984164
Test: compile
Change-Id: I22ffe0991d3c4add68317a0554dcac6a7ac56d12
2016-12-16 10:23:21 -08:00
Romain Guy
9505a65527 Add new RGBA_F16 bitmap config
This configuration uses 64 bits per pixel. Heach component is stored as a
half precision float value (16 bits). Half floats can be decoded/encoded
using android.util.Half.

RGBA_F16 bitmaps are used to decode wide-gamut images stored in 16 bit
formats (PNG 16 bit for instance). aapt is currently not aware of PNG
16 bits so such files must be placed in raw/ resource directories.

This first pass provides only partial drawing support with hardware
acceleration. RGBA_F16 bitmaps are stored in linear space and need
to be encoded to gamma space with the appropriate OETF to be rendered
properly on Android's current surfaces. They are however suitable for
linear blending. Full rendering support will be provided in a future
CL (BitmapShaders might be a bit tricky to handle properly during
shader generation).

Bug: 32984164
Test: bit CtsGraphicsTestCases:android.graphics.cts.BitmapRGBAF16Test

Change-Id: I328e6b567441a1b9d152a3e7be944a2cf63193bd
2016-12-16 09:15:07 -08:00
Chris Craik
15589c36d7 Merge "Outline & Path perf improvements" 2016-12-14 18:03:22 +00:00
Sergei Vasilinetc
82f8f3e04e Merge "Prohibit Config.HARDWARE in factory methods, that create mutable bitmaps" 2016-12-14 17:40:49 +00:00
Chris Craik
2414e1b051 Outline & Path perf improvements
Bug: 33460152
Test: device boots, ViewShowHidePerfTests#add[Factory:NestedLinearLayoutTree,depth:6] 770us -> 650us (userdebug 960MHz bullhead)

Improve perf for outline & simple path methods

native_methodName -> nMethodName in Path.java

Change-Id: Id2374bbaca3256d2e4f19dae9abe67f794a171b3
2016-12-13 16:52:08 -08:00
sergeyv
9fbb0b5ab3 Prohibit Config.HARDWARE in factory methods, that create mutable bitmaps
Test: android.cts.graphics.BitmapTest#testCreateMutableBitmapWithHardwareConfig
bug:30999911
Change-Id: I7cd4e2625563b6659613ccd180a57c56dcf7c2b1
2016-12-12 17:46:59 -08:00
Derek Sollenberger
dcc3630100 Remove Rasterizer and its subclasses from the public API.
Test: compile
Bug: 14650725
Change-Id: I99e1942d4d1b85f4efdcb3faf3fee1aa6c839b7e
2016-12-12 10:53:58 -05:00
TreeHugger Robot
0221d16cf4 Merge "Allow only U+0020..U+007E characters for axis tag." 2016-12-02 19:48:57 +00:00
Seigo Nonaka
0ec4f416ff Allow only U+0020..U+007E characters for axis tag.
CSS Font4 only allows U+0020..U+007E characters for tag string.
Reject outside of this range.

Bug: 33062398
Test: am instrument -w -e class android.graphics.VariationParserTest \
com.android.frameworks.graphicstests/android.test.InstrumentationTestRunner
Change-Id: Ia119151bc67caebfdaacda17aa3ee261a9e5d872
2016-12-02 18:24:00 +00:00
Teng-Hui Zhu
14efe881d4 Update the documentation related to VD / AVD
fix:32705240
fix:32683765
fix:32831830
fix:32705244

Test: make offline-sdk-docs and view the HTML file.
Merged-In: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae

Change-Id: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae
2016-12-01 11:18:51 -08:00
Amith Yamasani
f81df2d5e5 Merge "Secure MATCH_UNINSTALLED_PACKAGES across users" 2016-12-01 17:01:07 +00:00
TreeHugger Robot
b059a0826d Merge "Add API to visualize/debug/compare color spaces and colors" 2016-12-01 02:23:47 +00:00
Amith Yamasani
0d1fd8d091 Secure MATCH_UNINSTALLED_PACKAGES across users
Introduce a new internal flag MATCH_ANY_USER for genuine uses
of searching through all apps on the device.

Some temporary accommodations for Launchers that reach across
to the work profile until we have a new LauncherApps API to do
that officially.

Bug: 31000380
Test: CTS tests added
Change-Id: I2e43dc49d6c2e11814a8f8d1eb07ef557f31af34
2016-11-30 13:24:53 -08:00
Romain Guy
15296a2d34 Add API to visualize/debug/compare color spaces and colors
ColorSpace.createRenderer() returns a ColorSpace.Renderer which
can be used to visualize multiple color spaces and colors (each
associated with a specific color space) in the same CIE 1931 xyY
chromaticity diagram. This API was used to generate all the
diagrams shown in the documentation.

Bug: 32984164
Test: ColorSpaceTest in CTS
Change-Id: Ic94d939d5cfd563d826701f5e876b67b47ed56ec
2016-11-30 09:33:28 -08:00
Yirui Huang
e4b016ec41 Merge "Introduce font variation settings parser" 2016-11-30 01:13:04 +00:00
TreeHugger Robot
df68c9119c Merge "Make LD stateful / opacity management look more like DC" 2016-11-29 18:05:39 +00:00
yirui
3002ab6729 Introduce font variation settings parser
Font variation settings enables developer to specify font axes for
configuring glyph looking. This CL parse Font Variation settings to
make a array of Axis. More work is needed for using parsed axes.

Bug: 33062398
Test: Done by unittests.
Change-Id: I529b98b28df1c738237bee0729d9f479bd656dd3
2016-11-29 18:04:03 +09:00
TreeHugger Robot
b6504180ec Merge "Add images to document built-in color spaces" 2016-11-29 03:48:51 +00:00
Romain Guy
199e5a98dd Add images to document built-in color spaces
Bug: 32984164
Test: make offline-sdk-referenceonly-docs and manual validation of output

Change-Id: I2f0e00e5a0581517bb7c535e8aee150f87ac7a6e
2016-11-28 17:38:27 -08:00
Alan Viverette
eb7277590a Make LD stateful / opacity management look more like DC
Some initial cleanup before making changes to either class.

Test: n/a, refactoring only
Bug: 33124798
Change-Id: Idf0328bcc6de72b694ca7b35122ecad845cf1c4b
2016-11-28 14:55:18 -05:00
TreeHugger Robot
ab3225d742 Merge "Introduce android.graphics.ColorSpace" 2016-11-24 04:05:20 +00:00
Romain Guy
68bd5fdd1a Introduce android.graphics.ColorSpace
This class can be used to define color spaces. A color space has a color model
and a profile connection space (CIE XYZ D50). This implementation can be used
to query various properties of RGB color spaces or perform conversions between
various color spaces (RGB, XYZ and Lab).

Refer to the documentation for more details.

Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ColorSpaceTest
Bug: 32984164
Change-Id: Ie2117c1212c1375a7d403d3c1afaf73d7c2e0b47
2016-11-23 18:10:04 -08:00
sergeyv
da6c8ffcc5 Introduce Bitmap.Config.Hardware with @hide annotation
Test: HardwareBitmapTests
bug:30999911
Change-Id: Iaa0e18842704cb6bcd483c63a095dcb22baaf5e0
2016-11-22 18:28:54 -08:00
TreeHugger Robot
583727a345 Merge "Update the documentation related to VD / AVD" 2016-11-21 05:49:19 +00:00
Seigo Nonaka
1a625911a2 Merge "Add wordSpacing parameter to Paint" 2016-11-17 08:00:01 +00:00
Teng-Hui Zhu
18ad5f4368 Update the documentation related to VD / AVD
fix:32705240
fix:32683765
fix:32831830
fix:32705244

Test: make offline-sdk-docs and view the HTML file.

Change-Id: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae
2016-11-16 15:14:10 -08:00
Seigo Nonaka
219e2c7949 Add wordSpacing parameter to Paint
Adds the ability to control word spacing from Java, wiring up the
plumbing to the corresponding change that adds it at the Minikin
level.

Bug: 31707212
Test: ran graphicstests
Change-Id: I568186aca961d51ee5231cb0331f882b7b005e90
2016-11-16 16:24:07 +09:00
John Reck
3bdecbf0fd return 0 for allocation size if recycled
Change-Id: Ic471701faf026411938ebe87131533a8ef09bbd7
Fixes: 19804653
Test: none
2016-11-14 11:28:17 -08:00
John Reck
9192d5e8d7 Remove unused method
Test: builds

Change-Id: I8ad660f083a57f30db5ed0e2fe777286720033ca
2016-10-31 10:44:12 -07:00
John Reck
1ece145e01 Re-order draw methods to make update-api happy
update-api orders methods alhabetically by name, but when
there's multiple methods with the same name it falls back to
the ordering within the file.

Re-order the methods in canvas.java to match what's already in
current.txt to avoid unnecessary changes.

Also auto-formatted the draw methods as some were mis-indented.

Test: No behavior change, just method re-ordering
Change-Id: I2a7d313c8e7a6bd9187c4ed7dbde944b88aa32bb
2016-10-20 17:05:10 +00:00