Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

auto import from //depot/cupcake/@135843

  • Loading branch information...
commit 9066cfe9886ac131c34d59ed0e2d287b0e3c0087 1 parent d83a98f
The Android Open Source Project authored
Showing with 1,305,183 additions and 0 deletions.
  1. +432 −0 Android.mk
  2. 0  MODULE_LICENSE_APACHE2
  3. +222 −0 NOTICE
  4. +311,265 −0 api/1.xml
  5. +311,400 −0 api/2.xml
  6. +311,400 −0 api/3.xml
  7. +333,143 −0 api/current.xml
  8. +31 −0 awt/Android.mk
  9. +1,354 −0 awt/com/android/internal/awt/AndroidGraphics2D.java
  10. +96 −0 awt/com/android/internal/awt/AndroidGraphicsConfiguration.java
  11. +87 −0 awt/com/android/internal/awt/AndroidGraphicsFactory.java
  12. +274 −0 awt/com/android/internal/awt/AndroidImageDecoder.java
  13. +536 −0 awt/com/android/internal/awt/AndroidJavaBlitter.java
  14. +75 −0 awt/com/android/internal/awt/AndroidNativeEventQueue.java
  15. +88 −0 awt/com/android/internal/awt/AndroidWTK.java
  16. +52 −0 awt/com/android/internal/awt/AwtFactory.java
  17. +66 −0 awt/com/android/internal/awt/ImageOutputStreamWrapper.java
  18. +681 −0 awt/java/awt/AWTEvent.java
  19. +47 −0 awt/java/awt/AWTException.java
  20. +712 −0 awt/java/awt/AWTKeyStroke.java
  21. +47 −0 awt/java/awt/AWTListenerList.java
  22. +61 −0 awt/java/awt/AWTPermission.java
  23. +39 −0 awt/java/awt/ActiveEvent.java
  24. +166 −0 awt/java/awt/Adjustable.java
  25. +352 −0 awt/java/awt/AlphaComposite.java
  26. +2,443 −0 awt/java/awt/BasicStroke.java
  27. +195 −0 awt/java/awt/BufferCapabilities.java
  28. +990 −0 awt/java/awt/Color.java
  29. +6,020 −0 awt/java/awt/Component.java
  30. +56 −0 awt/java/awt/ComponentBehavior.java
  31. +154 −0 awt/java/awt/ComponentOrientation.java
  32. +51 −0 awt/java/awt/Composite.java
  33. +54 −0 awt/java/awt/CompositeContext.java
  34. +427 −0 awt/java/awt/Cursor.java
  35. +201 −0 awt/java/awt/Dimension.java
  36. +723 −0 awt/java/awt/Dispatcher.java
  37. +165 −0 awt/java/awt/DisplayMode.java
  38. +596 −0 awt/java/awt/Event.java
  39. +118 −0 awt/java/awt/EventDispatchThread.java
  40. +320 −0 awt/java/awt/EventQueue.java
  41. +253 −0 awt/java/awt/EventQueueCore.java
  42. +1,541 −0 awt/java/awt/Font.java
  43. +47 −0 awt/java/awt/FontFormatException.java
  44. +466 −0 awt/java/awt/FontMetrics.java
  45. +255 −0 awt/java/awt/GradientPaint.java
  46. +204 −0 awt/java/awt/GradientPaintContext.java
  47. +924 −0 awt/java/awt/Graphics.java
  48. +513 −0 awt/java/awt/Graphics2D.java
  49. +226 −0 awt/java/awt/GraphicsConfiguration.java
  50. +196 −0 awt/java/awt/GraphicsDevice.java
  51. +212 −0 awt/java/awt/GraphicsEnvironment.java
  52. +54 −0 awt/java/awt/HeadlessException.java
  53. +72 −0 awt/java/awt/HeadlessGraphicsEnvironment.java
  54. +226 −0 awt/java/awt/HeadlessToolkit.java
  55. +55 −0 awt/java/awt/IllegalComponentStateException.java
  56. +205 −0 awt/java/awt/Image.java
  57. +78 −0 awt/java/awt/ImageCapabilities.java
  58. +179 −0 awt/java/awt/Insets.java
  59. +59 −0 awt/java/awt/ItemSelectable.java
  60. +783 −0 awt/java/awt/MenuComponent.java
  61. +57 −0 awt/java/awt/MenuContainer.java
  62. +64 −0 awt/java/awt/ModalContext.java
  63. +418 −0 awt/java/awt/MouseDispatcher.java
  64. +57 −0 awt/java/awt/Paint.java
  65. +69 −0 awt/java/awt/PaintContext.java
  66. +211 −0 awt/java/awt/Point.java
  67. +515 −0 awt/java/awt/Polygon.java
  68. +723 −0 awt/java/awt/Rectangle.java
  69. +606 −0 awt/java/awt/RenderingHints.java
  70. +162 −0 awt/java/awt/Shape.java
  71. +50 −0 awt/java/awt/Stroke.java
  72. +1,444 −0 awt/java/awt/Toolkit.java
  73. +255 −0 awt/java/awt/ToolkitImpl.java
  74. +57 −0 awt/java/awt/Transparency.java
  75. +44 −0 awt/java/awt/color/CMMException.java
  76. +414 −0 awt/java/awt/color/ColorSpace.java
  77. +468 −0 awt/java/awt/color/ICC_ColorSpace.java
  78. +1,477 −0 awt/java/awt/color/ICC_Profile.java
  79. +78 −0 awt/java/awt/color/ICC_ProfileGray.java
  80. +154 −0 awt/java/awt/color/ICC_ProfileRGB.java
  81. +173 −0 awt/java/awt/color/ICC_ProfileStub.java
  82. +47 −0 awt/java/awt/color/ProfileDataException.java
  83. +8 −0 awt/java/awt/color/package.html
  84. +36 −0 awt/java/awt/event/AWTEventListener.java
  85. +58 −0 awt/java/awt/event/AWTEventListenerProxy.java
  86. +114 −0 awt/java/awt/event/ActionEvent.java
  87. +35 −0 awt/java/awt/event/ActionListener.java
  88. +123 −0 awt/java/awt/event/AdjustmentEvent.java
  89. +35 −0 awt/java/awt/event/AdjustmentListener.java
  90. +46 −0 awt/java/awt/event/ComponentAdapter.java
  91. +88 −0 awt/java/awt/event/ComponentEvent.java
  92. +41 −0 awt/java/awt/event/ComponentListener.java
  93. +40 −0 awt/java/awt/event/ContainerAdapter.java
  94. +89 −0 awt/java/awt/event/ContainerEvent.java
  95. +37 −0 awt/java/awt/event/ContainerListener.java
  96. +40 −0 awt/java/awt/event/FocusAdapter.java
  97. +96 −0 awt/java/awt/event/FocusEvent.java
  98. +37 −0 awt/java/awt/event/FocusListener.java
  99. +40 −0 awt/java/awt/event/HierarchyBoundsAdapter.java
  100. +37 −0 awt/java/awt/event/HierarchyBoundsListener.java
  101. +154 −0 awt/java/awt/event/HierarchyEvent.java
  102. +35 −0 awt/java/awt/event/HierarchyListener.java
  103. +190 −0 awt/java/awt/event/InputEvent.java
  104. +156 −0 awt/java/awt/event/InputMethodEvent.java
  105. +37 −0 awt/java/awt/event/InputMethodListener.java
  106. +138 −0 awt/java/awt/event/InvocationEvent.java
  107. +96 −0 awt/java/awt/event/ItemEvent.java
  108. +35 −0 awt/java/awt/event/ItemListener.java
  109. +43 −0 awt/java/awt/event/KeyAdapter.java
  110. +687 −0 awt/java/awt/event/KeyEvent.java
  111. +39 −0 awt/java/awt/event/KeyListener.java
  112. +49 −0 awt/java/awt/event/MouseAdapter.java
  113. +232 −0 awt/java/awt/event/MouseEvent.java
  114. +43 −0 awt/java/awt/event/MouseListener.java
  115. +40 −0 awt/java/awt/event/MouseMotionAdapter.java
  116. +37 −0 awt/java/awt/event/MouseMotionListener.java
  117. +103 −0 awt/java/awt/event/MouseWheelEvent.java
  118. +35 −0 awt/java/awt/event/MouseWheelListener.java
  119. +86 −0 awt/java/awt/event/PaintEvent.java
  120. +59 −0 awt/java/awt/event/TextEvent.java
  121. +36 −0 awt/java/awt/event/TextListener.java
  122. +64 −0 awt/java/awt/event/WindowAdapter.java
  123. +168 −0 awt/java/awt/event/WindowEvent.java
  124. +37 −0 awt/java/awt/event/WindowFocusListener.java
  125. +47 −0 awt/java/awt/event/WindowListener.java
  126. +36 −0 awt/java/awt/event/WindowStateListener.java
  127. +178 −0 awt/java/awt/font/FontRenderContext.java
  128. +197 −0 awt/java/awt/font/GlyphJustificationInfo.java
  129. +266 −0 awt/java/awt/font/GlyphMetrics.java
  130. +403 −0 awt/java/awt/font/GlyphVector.java
  131. +179 −0 awt/java/awt/font/GraphicAttribute.java
  132. +185 −0 awt/java/awt/font/ImageGraphicAttribute.java
  133. +238 −0 awt/java/awt/font/LineBreakMeasurer.java
  134. +116 −0 awt/java/awt/font/LineMetrics.java
  135. +91 −0 awt/java/awt/font/MultipleMaster.java
  136. +418 −0 awt/java/awt/font/OpenType.java
Sorry, we could not display the entire diff because too many files (5,180) changed.
View
432 Android.mk
@@ -0,0 +1,432 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH := $(call my-dir)
+
+# We have a special case here where we build the library's resources
+# independently from its code, so we need to find where the resource
+# class source got placed in the course of building the resources.
+# Thus, the magic here.
+# Also, this module cannot depend directly on the R.java file; if it
+# did, the PRIVATE_* vars for R.java wouldn't be guaranteed to be correct.
+# Instead, it depends on the R.stamp file, which lists the corresponding
+# R.java file as a prerequisite.
+# TODO: find a more appropriate way to do this.
+framework-res-source-path := APPS/framework-res_intermediates/src
+
+# the library
+# ============================================================
+include $(CLEAR_VARS)
+
+# FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk
+LOCAL_SRC_FILES := $(call find-other-java-files,$(FRAMEWORKS_BASE_SUBDIRS))
+
+# The following filters out code we are temporarily not including at all.
+# TODO: Move AWT and beans (and associated harmony code) back into libcore.
+# TODO: Maybe remove javax.microedition entirely?
+# TODO: Move SyncML (org.mobilecontrol.*) into its own library.
+LOCAL_SRC_FILES := $(filter-out \
+ org/mobilecontrol/% \
+ ,$(LOCAL_SRC_FILES))
+
+## READ ME: ########################################################
+##
+## When updading this list of aidl files, consider if that aidl is
+## part of the SDK API. If it is, also add it to the list below that
+## is preprocessed and distributed with the SDK. This list should
+## not contain any aidl files for parcelables, but the one below should
+## if you intend for 3rd parties to be able to send those objects
+## across process boundaries.
+##
+## READ ME: ########################################################
+LOCAL_SRC_FILES += \
+ core/java/android/accounts/IAccountsService.aidl \
+ core/java/android/app/IActivityPendingResult.aidl \
+ core/java/android/app/IActivityWatcher.aidl \
+ core/java/android/app/IAlarmManager.aidl \
+ core/java/android/app/IInstrumentationWatcher.aidl \
+ core/java/android/app/IIntentReceiver.aidl \
+ core/java/android/app/IIntentSender.aidl \
+ core/java/android/app/INotificationManager.aidl \
+ core/java/android/app/ISearchManager.aidl \
+ core/java/android/app/IServiceConnection.aidl \
+ core/java/android/app/IStatusBar.aidl \
+ core/java/android/app/IThumbnailReceiver.aidl \
+ core/java/android/app/ITransientNotification.aidl \
+ core/java/android/app/IWallpaperService.aidl \
+ core/java/android/app/IWallpaperServiceCallback.aidl \
+ core/java/android/bluetooth/IBluetoothA2dp.aidl \
+ core/java/android/bluetooth/IBluetoothDevice.aidl \
+ core/java/android/bluetooth/IBluetoothDeviceCallback.aidl \
+ core/java/android/bluetooth/IBluetoothHeadset.aidl \
+ core/java/android/content/ISyncAdapter.aidl \
+ core/java/android/content/ISyncContext.aidl \
+ core/java/android/content/pm/IPackageDataObserver.aidl \
+ core/java/android/content/pm/IPackageDeleteObserver.aidl \
+ core/java/android/content/pm/IPackageInstallObserver.aidl \
+ core/java/android/content/pm/IPackageManager.aidl \
+ core/java/android/content/pm/IPackageStatsObserver.aidl \
+ core/java/android/database/IContentObserver.aidl \
+ core/java/android/hardware/ISensorService.aidl \
+ core/java/android/net/IConnectivityManager.aidl \
+ core/java/android/os/ICheckinService.aidl \
+ core/java/android/os/IHardwareService.aidl \
+ core/java/android/os/IMessenger.aidl \
+ core/java/android/os/IMountService.aidl \
+ core/java/android/os/INetStatService.aidl \
+ core/java/android/os/IParentalControlCallback.aidl \
+ core/java/android/os/IPermissionController.aidl \
+ core/java/android/os/IPowerManager.aidl \
+ core/java/android/text/IClipboard.aidl \
+ core/java/android/view/IApplicationToken.aidl \
+ core/java/android/view/IOnKeyguardExitResult.aidl \
+ core/java/android/view/IRotationWatcher.aidl \
+ core/java/android/view/IWindow.aidl \
+ core/java/android/view/IWindowManager.aidl \
+ core/java/android/view/IWindowSession.aidl \
+ core/java/com/android/internal/app/IBatteryStats.aidl \
+ core/java/com/android/internal/app/IUsageStats.aidl \
+ core/java/com/android/internal/gadget/IGadgetService.aidl \
+ core/java/com/android/internal/gadget/IGadgetHost.aidl \
+ core/java/com/android/internal/view/IInputContext.aidl \
+ core/java/com/android/internal/view/IInputContextCallback.aidl \
+ core/java/com/android/internal/view/IInputMethod.aidl \
+ core/java/com/android/internal/view/IInputMethodCallback.aidl \
+ core/java/com/android/internal/view/IInputMethodClient.aidl \
+ core/java/com/android/internal/view/IInputMethodManager.aidl \
+ core/java/com/android/internal/view/IInputMethodSession.aidl \
+ im/java/android/im/IImPlugin.aidl \
+ location/java/android/location/IGpsStatusListener.aidl \
+ location/java/android/location/ILocationListener.aidl \
+ location/java/android/location/ILocationManager.aidl \
+ media/java/android/media/IAudioService.aidl \
+ media/java/android/media/IMediaScannerListener.aidl \
+ media/java/android/media/IMediaScannerService.aidl \
+ telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
+ telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
+ telephony/java/com/android/internal/telephony/ITelephony.aidl \
+ telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
+ telephony/java/com/android/internal/telephony/gsm/ISimPhoneBook.aidl \
+ telephony/java/com/android/internal/telephony/gsm/ISms.aidl \
+ wifi/java/android/net/wifi/IWifiManager.aidl
+
+# FRAMEWORKS_BASE_JAVA_SRC_DIRS comes from build/core/pathmap.mk
+LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
+
+LOCAL_INTERMEDIATE_SOURCES := \
+ $(framework-res-source-path)/android/R.java \
+ $(framework-res-source-path)/android/Manifest.java \
+ $(framework-res-source-path)/com/android/internal/R.java
+
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core ext
+
+LOCAL_MODULE := framework
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+# List of classes and interfaces which should be loaded by the Zygote.
+LOCAL_JAVA_RESOURCE_FILES += $(LOCAL_PATH)/preloaded-classes
+
+#LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
+
+LOCAL_DX_FLAGS := --core-library
+
+include $(BUILD_JAVA_LIBRARY)
+
+# Make sure that R.java and Manifest.java are built before we build
+# the source for this library.
+framework_res_R_stamp := \
+ $(call intermediates-dir-for,APPS,framework-res,,COMMON)/src/R.stamp
+$(full_classes_compiled_jar): $(framework_res_R_stamp)
+
+# Make sure that framework-res is installed when framework is.
+$(LOCAL_INSTALLED_MODULE): | $(dir $(LOCAL_INSTALLED_MODULE))framework-res.apk
+
+framework_built := $(LOCAL_BUILT_MODULE)
+
+# AIDL files to be preprocessed and included in the SDK,
+# relative to the root of the build tree.
+# ============================================================
+aidl_files := \
+ frameworks/base/core/java/android/accounts/IAccountsService.aidl \
+ frameworks/base/core/java/android/app/Notification.aidl \
+ frameworks/base/core/java/android/app/PendingIntent.aidl \
+ frameworks/base/core/java/android/content/ComponentName.aidl \
+ frameworks/base/core/java/android/content/Intent.aidl \
+ frameworks/base/core/java/android/content/SyncStats.aidl \
+ frameworks/base/core/java/android/content/res/Configuration.aidl \
+ frameworks/base/core/java/android/gadget/GadgetProviderInfo.aidl \
+ frameworks/base/core/java/android/net/Uri.aidl \
+ frameworks/base/core/java/android/os/Bundle.aidl \
+ frameworks/base/core/java/android/os/ParcelFileDescriptor.aidl \
+ frameworks/base/core/java/android/view/KeyEvent.aidl \
+ frameworks/base/core/java/android/view/MotionEvent.aidl \
+ frameworks/base/core/java/android/view/Surface.aidl \
+ frameworks/base/core/java/android/view/WindowManager.aidl \
+ frameworks/base/core/java/android/widget/RemoteViews.aidl \
+ frameworks/base/core/java/com/android/internal/view/IInputContext.aidl \
+ frameworks/base/core/java/com/android/internal/view/IInputMethod.aidl \
+ frameworks/base/core/java/com/android/internal/view/IInputMethodCallback.aidl \
+ frameworks/base/core/java/com/android/internal/view/IInputMethodClient.aidl \
+ frameworks/base/core/java/com/android/internal/view/IInputMethodManager.aidl \
+ frameworks/base/core/java/com/android/internal/view/IInputMethodSession.aidl \
+ frameworks/base/graphics/java/android/graphics/Bitmap.aidl \
+ frameworks/base/graphics/java/android/graphics/Rect.aidl \
+ frameworks/base/graphics/java/android/graphics/Region.aidl \
+ frameworks/base/im/java/android/im/IImPlugin.aidl \
+ frameworks/base/location/java/android/location/Criteria.aidl \
+ frameworks/base/location/java/android/location/Location.aidl \
+ frameworks/base/telephony/java/android/telephony/ServiceState.aidl \
+ frameworks/base/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
+ frameworks/base/telephony/java/com/android/internal/telephony/ITelephony.aidl
+
+gen := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
+$(gen): PRIVATE_SRC_FILES := $(aidl_files)
+ALL_SDK_FILES += $(gen)
+$(gen): $(aidl_files) | $(AIDL)
+ @echo Aidl Preprocess: $@
+ $(hide) $(AIDL) --preprocess $@ $(PRIVATE_SRC_FILES)
+
+# the documentation
+# ============================================================
+
+# TODO: deal with com/google/android/googleapps
+packages_to_document := \
+ android \
+ javax/microedition/khronos
+
+# Search through the base framework dirs for these packages.
+# The result will be relative to frameworks/base.
+fwbase_dirs_to_document := \
+ test-runner \
+ $(patsubst $(LOCAL_PATH)/%,%, \
+ $(wildcard \
+ $(foreach dir, $(FRAMEWORKS_BASE_JAVA_SRC_DIRS), \
+ $(addprefix $(dir)/, $(packages_to_document)) \
+ ) \
+ ) \
+ )
+
+# These are relative to dalvik/libcore
+# Intentionally not included from libcore:
+# icu openssl suncompat support
+libcore_to_document := \
+ annotation/src/main/java/java \
+ archive/src/main/java/java \
+ auth/src/main/java/javax \
+ awt-kernel/src/main/java/java \
+ concurrent/src/main/java \
+ crypto/src/main/java/javax \
+ dalvik/src/main/java/dalvik \
+ json/src/main/java \
+ junit/src/main/java \
+ logging/src/main/java/java \
+ luni/src/main/java/java \
+ luni-kernel/src/main/java/java \
+ math/src/main/java/java \
+ nio/src/main/java/java \
+ nio_char/src/main/java/java \
+ prefs/src/main/java/java \
+ regex/src/main/java/java \
+ security/src/main/java/java \
+ security/src/main/java/javax \
+ security-kernel/src/main/java/java \
+ sql/src/main/java/java \
+ sql/src/main/java/javax \
+ text/src/main/java/java \
+ x-net/src/main/java/javax \
+ xml/src/main/java/javax \
+ xml/src/main/java/org/xml/sax \
+ xml/src/main/java/org/xmlpull/v1 \
+ xml/src/main/java/org/w3c
+
+non_base_dirs := \
+ ../../external/apache-http/src/org/apache/http
+
+# These are relative to frameworks/base
+dirs_to_document := \
+ $(fwbase_dirs_to_document) \
+ $(non_base_dirs) \
+ $(addprefix ../../dalvik/libcore/, $(libcore_to_document))
+
+html_dirs := \
+ $(FRAMEWORKS_BASE_SUBDIRS) \
+ $(non_base_dirs)
+
+# These are relative to frameworks/base
+framework_docs_LOCAL_SRC_FILES := \
+ $(call find-other-java-files, $(dirs_to_document)) \
+ $(call find-other-html-files, $(html_dirs))
+
+framework_docs_LOCAL_DROIDDOC_SOURCE_PATH := \
+ $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
+
+framework_docs_LOCAL_INTERMEDIATE_SOURCES := \
+ $(framework-res-source-path)/android/R.java \
+ $(framework-res-source-path)/android/Manifest.java \
+ $(framework-res-source-path)/com/android/internal/R.java
+
+framework_docs_LOCAL_JAVA_LIBRARIES := \
+ core \
+ ext \
+
+framework_docs_LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+framework_docs_LOCAL_DROIDDOC_HTML_DIR := docs/html
+framework_docs_LOCAL_DROIDDOC_OPTIONS := \
+ -error 1 -error 2 -warning 3 -error 4 -error 6 -error 8 \
+ -overview $(LOCAL_PATH)/core/java/overview.html
+
+framework_docs_LOCAL_ADDITIONAL_JAVA_DIR:=$(call intermediates-dir-for,JAVA_LIBRARIES,framework)
+
+web_docs_sample_code_flags := \
+ -hdf android.hasSamples 1 \
+ -samplecode samples/ApiDemos guide/samples/ApiDemos "API Demos" \
+ -samplecode samples/LunarLander guide/samples/LunarLander "Lunar Lander" \
+ -samplecode samples/NotePad guide/samples/NotePad "Note Pad"
+
+sample_dir := development/samples
+
+web_docs_sample_code_flags := \
+ -hdf android.hasSamples 1 \
+ -samplecode $(sample_dir)/ApiDemos \
+ guide/samples/ApiDemos "API Demos" \
+ -samplecode $(sample_dir)/LunarLander \
+ guide/samples/LunarLander "Lunar Lander" \
+ -samplecode $(sample_dir)/NotePad \
+ guide/samples/NotePad "Note Pad"
+
+
+# ==== static html in the sdk ==================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES)
+LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
+LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES)
+LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
+LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
+LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
+LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR)
+
+LOCAL_MODULE := offline-sdk
+
+LOCAL_DROIDDOC_OPTIONS:=\
+ $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
+ -title "Android SDK" \
+ -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \
+ -todo $(OUT_DOCS)/$(LOCAL_MODULE)-docs-todo.html \
+ -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_stubs_current_intermediates/src \
+ -apixml $(INTERNAL_PLATFORM_API_FILE) \
+ -sdkvalues $(OUT_DOCS) \
+ -warning 3 \
+ -hdf android.whichdoc offline
+
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-sdk
+
+include $(BUILD_DROIDDOC)
+
+static_doc_index_redirect := $(out_dir)/index.html
+$(static_doc_index_redirect): \
+ $(LOCAL_PATH)/docs/docs-documentation-redirect.html | $(ACP)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) $(ACP) $< $@
+
+$(full_target): $(static_doc_index_redirect)
+$(full_target): $(framework_built)
+$(INTERNAL_PLATFORM_API_FILE): $(full_target)
+$(call dist-for-goals,sdk,$(INTERNAL_PLATFORM_API_FILE))
+
+
+# ==== docs for the web (on the google app engine server) =======================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES)
+LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
+LOCAL_STATIC_JAVA_LIBRARIES:=$(framework_docs_LOCAL_STATIC_JAVA_LIBRARIES)
+LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES)
+LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
+LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
+LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
+LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR)
+
+LOCAL_MODULE := online-sdk
+
+LOCAL_DROIDDOC_OPTIONS:= \
+ $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
+ $(web_docs_sample_code_flags) \
+ -toroot / \
+ -hdf android.whichdoc online
+
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-sdk
+
+include $(BUILD_DROIDDOC)
+
+
+# ==== docs that have all of the stuff that's @hidden =======================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES)
+LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
+LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework
+LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
+LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
+LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
+LOCAL_ADDITIONAL_JAVA_DIR:=$(call intermediates-dir-for,JAVA_LIBRARIES,framework)
+
+LOCAL_MODULE := hidden
+LOCAL_DROIDDOC_OPTIONS:=\
+ $(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
+ -title "Android SDK - Including hidden APIs."
+# -hidden
+
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=assets-sdk
+
+include $(BUILD_DROIDDOC)
+
+# Build ext.jar
+# ============================================================
+
+ext_dirs := \
+ ../../external/apache-http/src \
+ ../../external/gdata/src \
+ ../../external/protobuf/src \
+ ../../external/tagsoup/src
+
+ext_src_files := $(call all-java-files-under,$(ext_dirs))
+
+# ==== the library =========================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(ext_src_files)
+
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core
+LOCAL_STATIC_JAVA_LIBRARIES := libgoogleclient
+
+LOCAL_MODULE := ext
+
+include $(BUILD_JAVA_LIBRARY)
+
+
+# Include subdirectory makefiles
+# ============================================================
+
+# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
+# team really wants is to build the stuff defined by this makefile.
+ifeq (,$(ONE_SHOT_MAKEFILE))
+include $(call first-makefiles-under,$(LOCAL_PATH))
+endif
View
0  MODULE_LICENSE_APACHE2
No changes.
View
222 NOTICE
@@ -0,0 +1,222 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Android-specific code. ==
+ =========================================================================
+
+Android Code
+Copyright 2005-2008 The Android Open Source Project
+
+This product includes software developed as part of
+The Android Open Source Project (http://source.android.com).
+
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for Apache Commons code. ==
+ =========================================================================
+
+Apache Commons
+Copyright 1999-2004 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for Jakarta Commons Logging. ==
+ =========================================================================
+
+Jakarta Commons Logging (JCL)
+Copyright 2005,2006 The Apache Software Foundation.
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Nuance code. ==
+ =========================================================================
+
+These files are Copyright 2007 Nuance Communications, but released under
+the Apache2 License.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
View
311,265 api/1.xml
311,265 additions, 0 deletions not shown
View
311,400 api/2.xml
311,400 additions, 0 deletions not shown
View
311,400 api/3.xml
311,400 additions, 0 deletions not shown
View
333,143 api/current.xml
333,143 additions, 0 deletions not shown
View
31 awt/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_JAVA_RESOURCE_DIRS := resources
+
+LOCAL_JAVA_LIBRARIES := core framework
+
+LOCAL_MODULE:= android.awt
+
+LOCAL_DX_FLAGS := --core-library
+
+include $(BUILD_JAVA_LIBRARY)
View
1,354 awt/com/android/internal/awt/AndroidGraphics2D.java
@@ -0,0 +1,1354 @@
+/*
+ * Copyright 2007, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.awt;
+
+import com.android.internal.awt.AndroidGraphicsConfiguration;
+import com.android.internal.graphics.NativeUtils;
+
+import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.Stroke;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Area;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.PathIterator;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
+import java.awt.image.DataBuffer;
+import java.awt.image.DirectColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.WritableRaster;
+import java.awt.image.renderable.RenderableImage;
+import java.text.AttributedCharacterIterator;
+import java.util.Map;
+
+import org.apache.harmony.awt.gl.ImageSurface;
+import org.apache.harmony.awt.gl.MultiRectArea;
+import org.apache.harmony.awt.gl.Surface;
+import org.apache.harmony.awt.gl.font.AndroidGlyphVector;
+import org.apache.harmony.awt.gl.font.FontMetricsImpl;
+import org.apache.harmony.awt.gl.image.OffscreenImage;
+
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Path;
+
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.Region;
+import android.graphics.Typeface;
+import android.graphics.PixelXorXfermode;
+import android.view.Display;
+import android.view.WindowManager;
+import android.content.Context;
+
+public class AndroidGraphics2D extends Graphics2D {
+
+ private int displayWidth, displayHeight;
+
+ protected Surface dstSurf = null;
+ protected MultiRectArea clip = null;
+
+ protected Composite composite = AlphaComposite.SrcOver;
+ protected AffineTransform transform = new AffineTransform();
+
+ private static AndroidGraphics2D mAg;
+ private static Canvas mC;
+
+ // Android Paint
+ public static Paint mP;
+
+ private static java.awt.Font mFnt;
+
+ // Cached Matrix
+ public static Matrix mM;
+ private static FontMetrics mFm;
+ private static RenderingHints mRh;
+ private static Color mBc;
+
+ private Area mCurrClip;
+
+ public final static double RAD_360 = Math.PI / 180 * 360;
+
+ // Image drawing
+ private AndroidJavaBlitter blitter;
+ private DirectColorModel cm;
+ private SinglePixelPackedSampleModel sm;
+ private WritableRaster wr;
+
+
+ public static AndroidGraphics2D getInstance() {
+ if (mAg == null) {
+ throw new RuntimeException("AndroidGraphics2D not instantiated!");
+ }
+ return mAg;
+ }
+
+ public static AndroidGraphics2D getInstance(Context ctx, Canvas c, Paint p) {
+ if (c == null || ctx == null) {
+ throw new RuntimeException(
+ "Illegal argument, Canvas cannot be null!");
+ }
+ mAg = new AndroidGraphics2D(ctx, c, p);
+ return mAg;
+ }
+
+ private AndroidGraphics2D(Context ctx, Canvas c, Paint p) {
+ super();
+ mC = c;
+ mP = p;
+ mM = new Matrix();
+ mM.reset();
+ mM = mC.getMatrix();
+ Rect r = mC.getClipBounds();
+ int cl[] = {-1, r.top, r.left, -2, r.top, r.right, -2, r.bottom, r.right, -2, r.bottom, r.left};
+ mCurrClip = new Area(createShape(cl));
+ if(ctx != null) {
+ WindowManager wm = (WindowManager)ctx.getSystemService(Context.WINDOW_SERVICE);
+ Display d = wm.getDefaultDisplay();
+ displayWidth = d.getWidth();
+ displayHeight = d.getHeight();
+ }
+ blitter = new AndroidJavaBlitter(c);
+ cm = new DirectColorModel(32, 0xff0000, 0xff00, 0xff, 0xff000000);
+ sm = new SinglePixelPackedSampleModel(
+ DataBuffer.TYPE_INT, displayWidth, displayHeight, cm.getMasks());
+ wr = Raster.createWritableRaster(sm, null);
+ dstSurf = new ImageSurface(cm, wr);
+ }
+
+ @Override
+ public void addRenderingHints(Map<?, ?> hints) {
+ if (mRh == null) {
+ mRh = (RenderingHints) hints;
+ }
+ mRh.add((RenderingHints) hints);
+ }
+
+ public float[] getMatrix() {
+ float[] f = new float[9];
+ mC.getMatrix().getValues(f);
+ return f;
+ }
+
+ /**
+ *
+ * @return a Matrix in Android format
+ */
+ public float[] getInverseMatrix() {
+ AffineTransform af = new AffineTransform(createAWTMatrix(getMatrix()));
+ try {
+ af = af.createInverse();
+ } catch (NoninvertibleTransformException e) {
+ }
+ return createMatrix(af);
+ }
+
+ private Path getPath(Shape s) {
+ Path path = new Path();
+ PathIterator pi = s.getPathIterator(null);
+ while (pi.isDone() == false) {
+ getCurrentSegment(pi, path);
+ pi.next();
+ }
+ return path;
+ }
+
+ private void getCurrentSegment(PathIterator pi, Path path) {
+ float[] coordinates = new float[6];
+ int type = pi.currentSegment(coordinates);
+ switch (type) {
+ case PathIterator.SEG_MOVETO:
+ path.moveTo(coordinates[0], coordinates[1]);
+ break;
+ case PathIterator.SEG_LINETO:
+ path.lineTo(coordinates[0], coordinates[1]);
+ break;
+ case PathIterator.SEG_QUADTO:
+ path.quadTo(coordinates[0], coordinates[1], coordinates[2],
+ coordinates[3]);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ path.cubicTo(coordinates[0], coordinates[1], coordinates[2],
+ coordinates[3], coordinates[4], coordinates[5]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ path.close();
+ break;
+ default:
+ break;
+ }
+ }
+
+ private Shape createShape(int[] arr) {
+ Shape s = new GeneralPath();
+ for(int i = 0; i < arr.length; i++) {
+ int type = arr[i];
+ switch (type) {
+ case -1:
+ //MOVETO
+ ((GeneralPath)s).moveTo(arr[++i], arr[++i]);
+ break;
+ case -2:
+ //LINETO
+ ((GeneralPath)s).lineTo(arr[++i], arr[++i]);
+ break;
+ case -3:
+ //QUADTO
+ ((GeneralPath)s).quadTo(arr[++i], arr[++i], arr[++i],
+ arr[++i]);
+ break;
+ case -4:
+ //CUBICTO
+ ((GeneralPath)s).curveTo(arr[++i], arr[++i], arr[++i],
+ arr[++i], arr[++i], arr[++i]);
+ break;
+ case -5:
+ //CLOSE
+ return s;
+ default:
+ break;
+ }
+ }
+ return s;
+ }
+ /*
+ public int[] getPixels() {
+ return mC.getPixels();
+ }*/
+
+ public static float getRadian(float degree) {
+ return (float) ((Math.PI / 180) * degree);
+ }
+
+ private Shape getShape() {
+ return null;
+ }
+
+ public static float getDegree(float radian) {
+ return (float) ((180 / Math.PI) * radian);
+ }
+
+ /*
+ * Degree in radian
+ */
+ public static float getEllipsisX(float degree, float princAxis) {
+ return (float) Math.cos(degree) * princAxis;
+ }
+
+ public static float getEllipsisY(float degree, float conAxis) {
+ return (float) Math.sin(degree) * conAxis;
+ }
+
+ @Override
+ public void clip(Shape s) {
+ mC.clipPath(getPath(s));
+ }
+
+ public void setCanvas(Canvas c) {
+ mC = c;
+ }
+
+ @Override
+ public void draw(Shape s) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mP.setStyle(Paint.Style.STROKE);
+ mC.drawPath(getPath(s), mP);
+ mP.setStyle(tmp);
+ }
+/*
+ private ArrayList getSegments(Shape s) {
+ ArrayList arr = new ArrayList();
+ PathIterator pi = s.getPathIterator(null);
+ while (pi.isDone() == false) {
+ getCurrentSegment(pi, arr);
+ pi.next();
+ }
+ return arr;
+ }
+
+ private void getCurrentSegment(PathIterator pi, ArrayList arr) {
+ float[] coordinates = new float[6];
+ int type = pi.currentSegment(coordinates);
+ switch (type) {
+ case PathIterator.SEG_MOVETO:
+ arr.add(new Integer(-1));
+ break;
+ case PathIterator.SEG_LINETO:
+ arr.add(new Integer(-2));
+ break;
+ case PathIterator.SEG_QUADTO:
+ arr.add(new Integer(-3));
+ break;
+ case PathIterator.SEG_CUBICTO:
+ arr.add(new Integer(-4));
+ break;
+ case PathIterator.SEG_CLOSE:
+ arr.add(new Integer(-5));
+ break;
+ default:
+ break;
+ }
+ }
+*/
+ /*
+ * Convenience method, not standard AWT
+ */
+ public void draw(Path s) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mP.setStyle(Paint.Style.STROKE);
+ s.transform(mM);
+ mC.drawPath(s, mP);
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public void drawGlyphVector(GlyphVector g, float x, float y) {
+ // TODO draw at x, y
+ // draw(g.getOutline());
+ /*
+ Matrix matrix = new Matrix();
+ matrix.setTranslate(x, y);
+ Path pth = getPath(g.getOutline());
+ pth.transform(matrix);
+ draw(pth);
+ */
+ Path path = new Path();
+ char[] c = ((AndroidGlyphVector)g).getGlyphs();
+ mP.getTextPath(c, 0, c.length, x, y, path);
+ mC.drawPath(path, mP);
+ }
+
+ @Override
+ public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
+ throw new RuntimeException("Not implemented!");
+ }
+
+ @Override
+ public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
+ throw new RuntimeException("Not implemented!");
+ }
+
+ @Override
+ public void drawString(AttributedCharacterIterator iterator, float x,
+ float y) {
+ throw new RuntimeException("AttributedCharacterIterator not supported!");
+
+ }
+
+ @Override
+ public void drawString(AttributedCharacterIterator iterator, int x, int y) {
+ throw new RuntimeException("AttributedCharacterIterator not supported!");
+
+ }
+
+ @Override
+ public void drawString(String s, float x, float y) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+
+ mP.setStyle(Paint.Style.FILL);
+ Path pth = new Path();
+ mP.getTextPath(s, 0, s.length(), x, y, pth);
+ mC.drawPath(pth, mP);
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public void drawString(String str, int x, int y) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mP.setStrokeWidth(0);
+
+ mC.drawText(str.toCharArray(), 0, str.toCharArray().length, x, y,
+ mP);
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public void fill(Shape s) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mP.setStyle(Paint.Style.FILL);
+ mC.drawPath(getPath(s), mP);
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public Color getBackground() {
+ return mBc;
+ }
+
+ @Override
+ public Composite getComposite() {
+ throw new RuntimeException("Composite not implemented!");
+ }
+
+ @Override
+ public GraphicsConfiguration getDeviceConfiguration() {
+ return new AndroidGraphicsConfiguration();
+ }
+
+ @Override
+ public FontRenderContext getFontRenderContext() {
+ return new FontRenderContext(getTransform(), mP.isAntiAlias(), true);
+ }
+
+ @Override
+ public java.awt.Paint getPaint() {
+ throw new RuntimeException("AWT Paint not implemented in Android!");
+ }
+
+ public static Canvas getAndroidCanvas() {
+ return mC;
+ }
+
+ public static Paint getAndroidPaint() {
+ return mP;
+ }
+
+ @Override
+ public RenderingHints getRenderingHints() {
+ return mRh;
+ }
+
+ @Override
+ public Stroke getStroke() {
+ if (mP != null) {
+ return new BasicStroke(mP.getStrokeWidth(), mP.getStrokeCap()
+ .ordinal(), mP.getStrokeJoin().ordinal());
+ }
+ return null;
+ }
+
+ @Override
+ public AffineTransform getTransform() {
+ return new AffineTransform(createAWTMatrix(getMatrix()));
+ }
+
+ @Override
+ public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
+ // ???AWT TODO check if on stroke
+ return s.intersects(rect.getX(), rect.getY(), rect.getWidth(), rect
+ .getHeight());
+ }
+
+ @Override
+ public void rotate(double theta) {
+ mM.preRotate((float) AndroidGraphics2D
+ .getDegree((float) (RAD_360 - theta)));
+ mC.concat(mM);
+ }
+
+ @Override
+ public void rotate(double theta, double x, double y) {
+ mM.preRotate((float) AndroidGraphics2D.getDegree((float) theta),
+ (float) x, (float) y);
+ mC.concat(mM);
+ }
+
+ @Override
+ public void scale(double sx, double sy) {
+ mM.setScale((float) sx, (float) sy);
+ mC.concat(mM);
+ }
+
+ @Override
+ public void setBackground(Color color) {
+ mBc = color;
+ mC.clipRect(new Rect(0, 0, mC.getWidth(), mC.getHeight()));
+ // TODO don't limit to current clip
+ mC.drawARGB(color.getAlpha(), color.getRed(), color.getGreen(), color
+ .getBlue());
+ }
+
+ @Override
+ public void setComposite(Composite comp) {
+ throw new RuntimeException("Composite not implemented!");
+ }
+
+ public void setSpaint(Paint paint) {
+ mP = paint;
+ }
+
+ @Override
+ public void setPaint(java.awt.Paint paint) {
+ setColor((Color)paint);
+ }
+
+ @Override
+ public Object getRenderingHint(RenderingHints.Key key) {
+ if (mRh == null) {
+ return null;
+ }
+ return mRh.get(key);
+ }
+
+ @Override
+ public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) {
+ if (mRh == null) {
+ mRh = new RenderingHints(hintKey, hintValue);
+ } else {
+ mRh.put(hintKey, hintValue);
+ }
+ applyHints();
+ }
+
+ @Override
+ public void setRenderingHints(Map<?, ?> hints) {
+ mRh = (RenderingHints) hints;
+ applyHints();
+ }
+
+ private void applyHints() {
+ Object o;
+
+ // TODO do something like this:
+ /*
+ * Set s = mRh.keySet(); Iterator it = s.iterator(); while(it.hasNext()) {
+ * o = it.next(); }
+ */
+
+ // /////////////////////////////////////////////////////////////////////
+ // not supported in skia
+ /*
+ * o = mRh.get(RenderingHints.KEY_ALPHA_INTERPOLATION); if
+ * (o.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT)) { } else
+ * if (o.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY)) { }
+ * else if (o.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED)) { }
+ *
+ * o = mRh.get(RenderingHints.KEY_COLOR_RENDERING); if
+ * (o.equals(RenderingHints.VALUE_COLOR_RENDER_DEFAULT)) { } else if
+ * (o.equals(RenderingHints.VALUE_COLOR_RENDER_QUALITY)) { } else if
+ * (o.equals(RenderingHints.VALUE_COLOR_RENDER_SPEED)) { }
+ *
+ * o = mRh.get(RenderingHints.KEY_DITHERING); if
+ * (o.equals(RenderingHints.VALUE_DITHER_DEFAULT)) { } else if
+ * (o.equals(RenderingHints.VALUE_DITHER_DISABLE)) { } else if
+ * (o.equals(RenderingHints.VALUE_DITHER_ENABLE)) { }
+ *
+ * o = mRh.get(RenderingHints.KEY_FRACTIONALMETRICS); if
+ * (o.equals(RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT)) { } else
+ * if (o.equals(RenderingHints.VALUE_FRACTIONALMETRICS_OFF)) { } else if
+ * (o.equals(RenderingHints.VALUE_FRACTIONALMETRICS_ON)) { }
+ *
+ * o = mRh.get(RenderingHints.KEY_INTERPOLATION); if
+ * (o.equals(RenderingHints.VALUE_INTERPOLATION_BICUBIC)) { } else if
+ * (o.equals(RenderingHints.VALUE_INTERPOLATION_BILINEAR)) { } else if
+ * (o .equals(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)) { }
+ *
+ * o = mRh.get(RenderingHints.KEY_RENDERING); if
+ * (o.equals(RenderingHints.VALUE_RENDER_DEFAULT)) { } else if
+ * (o.equals(RenderingHints.VALUE_RENDER_QUALITY)) { } else if
+ * (o.equals(RenderingHints.VALUE_RENDER_SPEED)) { }
+ *
+ * o = mRh.get(RenderingHints.KEY_STROKE_CONTROL); if
+ * (o.equals(RenderingHints.VALUE_STROKE_DEFAULT)) { } else if
+ * (o.equals(RenderingHints.VALUE_STROKE_NORMALIZE)) { } else if
+ * (o.equals(RenderingHints.VALUE_STROKE_PURE)) { }
+ */
+
+ o = mRh.get(RenderingHints.KEY_ANTIALIASING);
+ if (o != null) {
+ if (o.equals(RenderingHints.VALUE_ANTIALIAS_DEFAULT)) {
+ mP.setAntiAlias(false);
+ } else if (o.equals(RenderingHints.VALUE_ANTIALIAS_OFF)) {
+ mP.setAntiAlias(false);
+ } else if (o.equals(RenderingHints.VALUE_ANTIALIAS_ON)) {
+ mP.setAntiAlias(true);
+ }
+ }
+
+ o = mRh.get(RenderingHints.KEY_TEXT_ANTIALIASING);
+ if (o != null) {
+ if (o.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT)) {
+ mP.setAntiAlias(false);
+ } else if (o.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)) {
+ mP.setAntiAlias(false);
+ } else if (o.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_ON)) {
+ mP.setAntiAlias(true);
+ }
+ }
+ }
+
+ @Override
+ public void setStroke(Stroke s) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ BasicStroke bs = (BasicStroke) s;
+ mP.setStyle(Paint.Style.STROKE);
+ mP.setStrokeWidth(bs.getLineWidth());
+
+ int cap = bs.getEndCap();
+ if (cap == 0) {
+ mP.setStrokeCap(Paint.Cap.BUTT);
+ } else if (cap == 1) {
+ mP.setStrokeCap(Paint.Cap.ROUND);
+ } else if (cap == 2) {
+ mP.setStrokeCap(Paint.Cap.SQUARE);
+ }
+
+ int join = bs.getLineJoin();
+ if (join == 0) {
+ mP.setStrokeJoin(Paint.Join.MITER);
+ } else if (join == 1) {
+ mP.setStrokeJoin(Paint.Join.ROUND);
+ } else if (join == 2) {
+ mP.setStrokeJoin(Paint.Join.BEVEL);
+ }
+ }
+
+ public static float[] createMatrix(AffineTransform Tx) {
+ double[] at = new double[9];
+ Tx.getMatrix(at);
+ float[] f = new float[at.length];
+ f[0] = (float) at[0];
+ f[1] = (float) at[2];
+ f[2] = (float) at[4];
+ f[3] = (float) at[1];
+ f[4] = (float) at[3];
+ f[5] = (float) at[5];
+ f[6] = 0;
+ f[7] = 0;
+ f[8] = 1;
+ return f;
+ }
+
+ private float[] createAWTMatrix(float[] matrix) {
+ float[] at = new float[9];
+ at[0] = matrix[0];
+ at[1] = matrix[3];
+ at[2] = matrix[1];
+ at[3] = matrix[4];
+ at[4] = matrix[2];
+ at[5] = matrix[5];
+ at[6] = 0;
+ at[7] = 0;
+ at[8] = 1;
+ return at;
+ }
+
+ public static Matrix createMatrixObj(AffineTransform Tx) {
+ Matrix m = new Matrix();
+ m.reset();
+ m.setValues(createMatrix(Tx));
+ return m;
+ }
+
+ @Override
+ public void setTransform(AffineTransform Tx) {
+ mM.reset();
+ /*
+ * if(Tx.isIdentity()) { mM = new Matrix(); }
+ */
+ mM.setValues(createMatrix(Tx));
+ Matrix m = new Matrix();
+ m.setValues(getInverseMatrix());
+ mC.concat(m);
+ mC.concat(mM);
+ }
+
+ @Override
+ public void shear(double shx, double shy) {
+ mM.setSkew((float) shx, (float) shy);
+ mC.concat(mM);
+ }
+
+ @Override
+ public void transform(AffineTransform Tx) {
+ Matrix m = new Matrix();
+ m.setValues(createMatrix(Tx));
+ mC.concat(m);
+ }
+
+ @Override
+ public void translate(double tx, double ty) {
+ mM.setTranslate((float) tx, (float) ty);
+ mC.concat(mM);
+ }
+
+ @Override
+ public void translate(int x, int y) {
+ mM.setTranslate((float) x, (float) y);
+ mC.concat(mM);
+ }
+
+ @Override
+ public void clearRect(int x, int y, int width, int height) {
+ mC.clipRect(x, y, x + width, y + height);
+ if (mBc != null) {
+ mC.drawARGB(mBc.getAlpha(), mBc.getBlue(), mBc.getGreen(), mBc
+ .getRed());
+ } else {
+ mC.drawARGB(0xff, 0xff, 0xff, 0xff);
+ }
+ }
+
+ @Override
+ public void clipRect(int x, int y, int width, int height) {
+ int cl[] = {-1, x, y, -2, x, y + width, -2, x + height, y + width, -2, x + height, y};
+ Shape shp = createShape(cl);
+ mCurrClip.intersect(new Area(shp));
+ mC.clipRect(new Rect(x, y, x + width, y + height), Region.Op.INTERSECT);
+ }
+
+ @Override
+ public void copyArea(int sx, int sy, int width, int height, int dx, int dy) {
+ copyArea(mC, sx, sy, width + dx, height + dy, dx, dy);
+ }
+
+ @Override
+ public Graphics create() {
+ return this;
+ }
+
+ @Override
+ public void dispose() {
+ mC = null;
+ mP = null;
+ }
+
+ @Override
+ public void drawArc(int x, int y, int width, int height, int sa, int ea) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mP.setStrokeWidth(0);
+ mC.drawArc(new RectF(x, y, x + width, y + height), 360 - (ea + sa),
+ ea, true, mP);
+ }
+
+
+ // ???AWT: only used for debuging, delete in final version
+ public void drawBitmap(Bitmap bm, float x, float y, Paint p) {
+ mC.drawBitmap(bm, x, y, null);
+ }
+
+ @Override
+ public boolean drawImage(Image image, int x, int y, Color bgcolor,
+ ImageObserver imageObserver) {
+
+ if(image == null) {
+ return true;
+ }
+
+ boolean done = false;
+ boolean somebits = false;
+ Surface srcSurf = null;
+ if(image instanceof OffscreenImage){
+ OffscreenImage oi = (OffscreenImage) image;
+ if((oi.getState() & ImageObserver.ERROR) != 0) {
+ return false;
+ }
+ done = oi.prepareImage(imageObserver);
+ somebits = (oi.getState() & ImageObserver.SOMEBITS) != 0;
+ srcSurf = oi.getImageSurface();
+ }else{
+ done = true;
+ srcSurf = Surface.getImageSurface(image);
+ }
+
+ if(done || somebits) {
+ int w = srcSurf.getWidth();
+ int h = srcSurf.getHeight();
+
+ blitter.blit(0, 0, srcSurf, x, y, dstSurf, w, h, (AffineTransform) transform.clone(),
+ composite, bgcolor, clip);
+ }
+ return done;
+ }
+
+ @Override
+ public boolean drawImage(Image image, int x, int y, ImageObserver imageObserver) {
+ return drawImage(image, x, y, null, imageObserver);
+ }
+
+ @Override
+ public boolean drawImage(Image image, int x, int y, int width, int height,
+ Color bgcolor, ImageObserver imageObserver) {
+
+ if(image == null) {
+ return true;
+ }
+ if(width == 0 || height == 0) {
+ return true;
+ }
+
+ boolean done = false;
+ boolean somebits = false;
+ Surface srcSurf = null;
+
+ if(image instanceof OffscreenImage){
+ OffscreenImage oi = (OffscreenImage) image;
+ if((oi.getState() & ImageObserver.ERROR) != 0) {
+ return false;
+ }
+ done = oi.prepareImage(imageObserver);
+ somebits = (oi.getState() & ImageObserver.SOMEBITS) != 0;
+ srcSurf = oi.getImageSurface();
+ }else{
+ done = true;
+ srcSurf = Surface.getImageSurface(image);
+ }
+
+ if(done || somebits) {
+ int w = srcSurf.getWidth();
+ int h = srcSurf.getHeight();
+ if(w == width && h == height){
+ blitter.blit(0, 0, srcSurf, x, y, dstSurf, w, h,
+ (AffineTransform) transform.clone(),
+ composite, bgcolor, clip);
+ }else{
+ AffineTransform xform = new AffineTransform();
+ xform.setToScale((float)width / w, (float)height / h);
+ blitter.blit(0, 0, srcSurf, x, y, dstSurf, w, h,
+ (AffineTransform) transform.clone(),
+ xform, composite, bgcolor, clip);
+ }
+ }
+ return done;
+ }
+
+ @Override
+ public boolean drawImage(Image image, int x, int y, int width, int height,
+ ImageObserver imageObserver) {
+ return drawImage(image, x, y, width, height, null, imageObserver);
+ }
+
+ @Override
+ public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
+ int sx1, int sy1, int sx2, int sy2, Color bgcolor,
+ ImageObserver imageObserver) {
+
+ if(image == null) {
+ return true;
+ }
+ if(dx1 == dx2 || dy1 == dy2 || sx1 == sx2 || sy1 == sy2) {
+ return true;
+ }
+
+ boolean done = false;
+ boolean somebits = false;
+ Surface srcSurf = null;
+ if(image instanceof OffscreenImage){
+ OffscreenImage oi = (OffscreenImage) image;
+ if((oi.getState() & ImageObserver.ERROR) != 0) {
+ return false;
+ }
+ done = oi.prepareImage(imageObserver);
+ somebits = (oi.getState() & ImageObserver.SOMEBITS) != 0;
+ srcSurf = oi.getImageSurface();
+ }else{
+ done = true;
+ srcSurf = Surface.getImageSurface(image);
+ }
+
+ if(done || somebits) {
+
+ int dstX = dx1;
+ int dstY = dy1;
+ int srcX = sx1;
+ int srcY = sy1;
+
+ int dstW = dx2 - dx1;
+ int dstH = dy2 - dy1;
+ int srcW = sx2 - sx1;
+ int srcH = sy2 - sy1;
+
+ if(srcW == dstW && srcH == dstH){
+ blitter.blit(srcX, srcY, srcSurf, dstX, dstY, dstSurf, srcW, srcH,
+ (AffineTransform) transform.clone(),
+ composite, bgcolor, clip);
+ }else{
+ AffineTransform xform = new AffineTransform();
+ xform.setToScale((float)dstW / srcW, (float)dstH / srcH);
+ blitter.blit(srcX, srcY, srcSurf, dstX, dstY, dstSurf, srcW, srcH,
+ (AffineTransform) transform.clone(),
+ xform, composite, bgcolor, clip);
+ }
+ }
+ return done;
+ }
+
+ @Override
+ public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
+ int sx1, int sy1, int sx2, int sy2, ImageObserver imageObserver) {
+
+ return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null,
+ imageObserver);
+ }
+
+ @Override
+ public void drawImage(BufferedImage bufImage, BufferedImageOp op,
+ int x, int y) {
+
+ if(bufImage == null) {
+ return;
+ }
+
+ if(op == null) {
+ drawImage(bufImage, x, y, null);
+ } else if(op instanceof AffineTransformOp){
+ AffineTransformOp atop = (AffineTransformOp) op;
+ AffineTransform xform = atop.getTransform();
+ Surface srcSurf = Surface.getImageSurface(bufImage);
+ int w = srcSurf.getWidth();
+ int h = srcSurf.getHeight();
+ blitter.blit(0, 0, srcSurf, x, y, dstSurf, w, h,
+ (AffineTransform) transform.clone(), xform,
+ composite, null, clip);
+ } else {
+ bufImage = op.filter(bufImage, null);
+ Surface srcSurf = Surface.getImageSurface(bufImage);
+ int w = srcSurf.getWidth();
+ int h = srcSurf.getHeight();
+ blitter.blit(0, 0, srcSurf, x, y, dstSurf, w, h,
+ (AffineTransform) transform.clone(),
+ composite, null, clip);
+ }
+ }
+
+ @Override
+ public boolean drawImage(Image image, AffineTransform trans,
+ ImageObserver imageObserver) {
+
+ if(image == null) {
+ return true;
+ }
+ if(trans == null || trans.isIdentity()) {
+ return drawImage(image, 0, 0, imageObserver);
+ }
+
+ boolean done = false;
+ boolean somebits = false;
+ Surface srcSurf = null;
+ if(image instanceof OffscreenImage){
+ OffscreenImage oi = (OffscreenImage) image;
+ if((oi.getState() & ImageObserver.ERROR) != 0) {
+ return false;
+ }
+ done = oi.prepareImage(imageObserver);
+ somebits = (oi.getState() & ImageObserver.SOMEBITS) != 0;
+ srcSurf = oi.getImageSurface();
+ }else{
+ done = true;
+ srcSurf = Surface.getImageSurface(image);
+ }
+
+ if(done || somebits) {
+ int w = srcSurf.getWidth();
+ int h = srcSurf.getHeight();
+ AffineTransform xform = (AffineTransform) transform.clone();
+ xform.concatenate(trans);
+ blitter.blit(0, 0, srcSurf, 0, 0, dstSurf, w, h, xform, composite,
+ null, clip);
+ }
+ return done;
+ }
+
+ @Override
+ public void drawLine(int x1, int y1, int x2, int y2) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mC.drawLine(x1, y1, x2, y2, mP);
+ }
+
+ @Override
+ public void drawOval(int x, int y, int width, int height) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mP.setStyle(Paint.Style.STROKE);
+ mC.drawOval(new RectF(x, y, x + width, y + height), mP);
+ }
+
+ @Override
+ public void drawPolygon(int[] xpoints, int[] ypoints, int npoints) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mC.drawLine(xpoints[npoints - 1], ypoints[npoints - 1], xpoints[0],
+ ypoints[0], mP);
+ for (int i = 0; i < npoints - 1; i++) {
+ mC.drawLine(xpoints[i], ypoints[i], xpoints[i + 1],
+ ypoints[i + 1], mP);
+ }
+ }
+
+ @Override
+ public void drawPolyline(int[] xpoints, int[] ypoints, int npoints) {
+ for (int i = 0; i < npoints - 1; i++) {
+ drawLine(xpoints[i], ypoints[i], xpoints[i + 1], ypoints[i + 1]);
+ }
+
+ }
+
+ @Override
+ public void drawRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mC.drawRoundRect(new RectF(x, y, width, height), arcWidth,
+ arcHeight, mP);
+ }
+
+ @Override
+ public void fillArc(int x, int y, int width, int height, int sa, int ea) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+
+ Paint.Style tmp = mP.getStyle();
+ mP.setStyle(Paint.Style.FILL_AND_STROKE);
+ mC.drawArc(new RectF(x, y, x + width, y + height), 360 - (sa + ea),
+ ea, true, mP);
+
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public void fillOval(int x, int y, int width, int height) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mP.setStyle(Paint.Style.FILL);
+ mC.drawOval(new RectF(x, y, x + width, y + height), mP);
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public void fillPolygon(int[] xpoints, int[] ypoints, int npoints) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mC.save(Canvas.CLIP_SAVE_FLAG);
+
+ mP.setStyle(Paint.Style.FILL);
+
+ GeneralPath filledPolygon = new GeneralPath(
+ GeneralPath.WIND_EVEN_ODD, npoints);
+ filledPolygon.moveTo(xpoints[0], ypoints[0]);
+ for (int index = 1; index < xpoints.length; index++) {
+ filledPolygon.lineTo(xpoints[index], ypoints[index]);
+ }
+ filledPolygon.closePath();
+ Path path = getPath(filledPolygon);
+ mC.clipPath(path);
+ mC.drawPath(path, mP);
+
+ mP.setStyle(tmp);
+ mC.restore();
+ }
+
+ @Override
+ public void fillRect(int x, int y, int width, int height) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ Paint.Style tmp = mP.getStyle();
+ mP.setStyle(Paint.Style.FILL);
+ mC.drawRect(new Rect(x, y, x + width, y + height), mP);
+ mP.setStyle(tmp);
+ }
+
+ @Override
+ public void drawRect(int x, int y, int width, int height) {
+ int[] xpoints = { x, x, x + width, x + width };
+ int[] ypoints = { y, y + height, y + height, y };
+ drawPolygon(xpoints, ypoints, 4);
+ }
+
+ @Override
+ public void fillRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mP.setStyle(Paint.Style.FILL);
+ mC.drawRoundRect(new RectF(x, y, x + width, y + height), arcWidth,
+ arcHeight, mP);
+ }
+
+ @Override
+ public Shape getClip() {
+ return mCurrClip;
+ }
+
+ @Override
+ public Rectangle getClipBounds() {
+ Rect r = mC.getClipBounds();
+ return new Rectangle(r.left, r.top, r.width(), r.height());
+ }
+
+ @Override
+ public Color getColor() {
+ if (mP != null) {
+ return new Color(mP.getColor());
+ }
+ return null;
+ }
+
+ @Override
+ public Font getFont() {
+ return mFnt;
+ }
+
+ @Override
+ public FontMetrics getFontMetrics(Font font) {
+ mFm = new FontMetricsImpl(font);
+ return mFm;
+ }
+
+ @Override
+ public void setClip(int x, int y, int width, int height) {
+ int cl[] = {-1, x, y, -2, x, y + width, -2, x + height, y + width, -2, x + height, y};
+ mCurrClip = new Area(createShape(cl));
+ mC.clipRect(x, y, x + width, y + height, Region.Op.REPLACE);
+
+ }
+
+ @Override
+ public void setClip(Shape clip) {
+ mCurrClip = new Area(clip);
+ mC.clipPath(getPath(clip), Region.Op.REPLACE);
+ }
+
+ @Override
+ public void setColor(Color c) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mP.setColor(c.getRGB());
+ }
+
+ /**
+ * Font mapping:
+ *
+ * Family:
+ *
+ * Android AWT
+ * -------------------------------------
+ * serif Serif / TimesRoman
+ * sans-serif SansSerif / Helvetica
+ * monospace Monospaced / Courier
+ *
+ * Style:
+ *
+ * Android AWT
+ * -------------------------------------
+ * normal Plain
+ * bold bold
+ * italic italic
+ *
+ */
+ @Override
+ public void setFont(Font font) {
+ if (font == null) {
+ return;
+ }
+ if (mP == null) {
+ mP = new Paint();
+ }
+
+ mFnt = font;
+ Typeface tf = null;
+ int sty = font.getStyle();
+ String nam = font.getName();
+ String aF = "";
+ if (nam != null) {
+ if (nam.equalsIgnoreCase("Serif")
+ || nam.equalsIgnoreCase("TimesRoman")) {
+ aF = "serif";
+ } else if (nam.equalsIgnoreCase("SansSerif")
+ || nam.equalsIgnoreCase("Helvetica")) {
+ aF = "sans-serif";
+ } else if (nam.equalsIgnoreCase("Monospaced")
+ || nam.equalsIgnoreCase("Courier")) {
+ aF = "monospace";
+ }
+ }
+
+ switch (sty) {
+ case Font.PLAIN:
+ tf = Typeface.create(aF, Typeface.NORMAL);
+ break;
+ case Font.BOLD:
+ tf = Typeface.create(aF, Typeface.BOLD);
+ break;
+ case Font.ITALIC:
+ tf = Typeface.create(aF, Typeface.ITALIC);
+ break;
+ case Font.BOLD | Font.ITALIC:
+ tf = Typeface.create(aF, Typeface.BOLD_ITALIC);
+ break;
+ default:
+ tf = Typeface.DEFAULT;
+ }
+
+ mP.setTextSize(font.getSize());
+ mP.setTypeface(tf);
+ }
+
+ @Override
+ public void drawBytes(byte[] data, int offset, int length, int x, int y) {
+ drawString(new String(data, offset, length), x, y);
+ }
+
+ @Override
+ public void drawPolygon(Polygon p) {
+ drawPolygon(p.xpoints, p.ypoints, p.npoints);
+ }
+
+ @Override
+ public void fillPolygon(Polygon p) {
+ fillPolygon(p.xpoints, p.ypoints, p.npoints);
+ }
+
+ @Override
+ public Rectangle getClipBounds(Rectangle r) {
+ Shape clip = getClip();
+ if (clip != null) {
+ Rectangle b = clip.getBounds();
+ r.x = b.x;
+ r.y = b.y;
+ r.width = b.width;
+ r.height = b.height;
+ }
+ return r;
+ }
+
+ @Override
+ public boolean hitClip(int x, int y, int width, int height) {
+ return getClipBounds().intersects(new Rectangle(x, y, width, height));
+ }
+
+ @Override
+ public void drawChars(char[] data, int offset, int length, int x, int y) {
+ mC.drawText(data, offset, length, x, y, mP);
+ }
+
+ @Override
+ public void setPaintMode() {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mP.setXfermode(null);
+ }
+
+ @Override
+ public void setXORMode(Color color) {
+ if (mP == null) {
+ mP = new Paint();
+ }
+ mP.setXfermode(new PixelXorXfermode(color.getRGB()));
+ }
+
+ @Override
+ public void fill3DRect(int x, int y, int width, int height, boolean raised) {
+ Color color = getColor();
+ Color colorUp, colorDown;
+ if (raised) {
+ colorUp = color.brighter();
+ colorDown = color.darker();
+ setColor(color);
+ } else {
+ colorUp = color.darker();
+ colorDown = color.brighter();
+ setColor(colorUp);
+ }
+
+ width--;
+ height--;
+ fillRect(x+1, y+1, width-1, height-1);
+
+ setColor(colorUp);
+ fillRect(x, y, width, 1);
+ fillRect(x, y+1, 1, height);
+
+ setColor(colorDown);
+ fillRect(x+width, y, 1, height);
+ fillRect(x+1, y+height, width, 1);
+ }
+
+ @Override
+ public void draw3DRect(int x, int y, int width, int height, boolean raised) {
+ Color color = getColor();
+ Color colorUp, colorDown;
+ if (raised) {
+ colorUp = color.brighter();
+ colorDown = color.darker();
+ } else {
+ colorUp = color.darker();
+ colorDown = color.brighter();
+ }
+
+ setColor(colorUp);
+ fillRect(x, y, width, 1);
+ fillRect(x, y+1, 1, height);
+
+ setColor(colorDown);
+ fillRect(x+width, y, 1, height);
+ fillRect(x+1, y+height, width, 1);
+ }
+
+ public void copyArea(Canvas canvas, int sx, int sy, int width, int height, int dx, int dy) {
+ sx += getTransform().getTranslateX();
+ sy += getTransform().getTranslateY();
+
+ NativeUtils.nativeScrollRect(canvas,
+ new Rect(sx, sy, sx + width, sy + height),
+ dx, dy);
+ }
+}
View
96 awt/com/android/internal/awt/AndroidGraphicsConfiguration.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2007, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.awt;
+
+import com.android.internal.awt.AndroidGraphics2D;
+
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.VolatileImage;
+
+import android.graphics.Canvas;
+
+public class AndroidGraphicsConfiguration extends GraphicsConfiguration {
+
+ @Override
+ public BufferedImage createCompatibleImage(int width, int height) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BufferedImage createCompatibleImage(int width, int height,
+ int transparency) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public VolatileImage createCompatibleVolatileImage(int width, int height) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public VolatileImage createCompatibleVolatileImage(int width, int height,
+ int transparency) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Rectangle getBounds() {
+ Canvas c = AndroidGraphics2D.getAndroidCanvas();
+ if(c != null)
+ return new Rectangle(0, 0, c.getWidth(), c.getHeight());
+ return null;
+ }
+
+ @Override
+ public ColorModel getColorModel() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ColorModel getColorModel(int transparency) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public AffineTransform getDefaultTransform() {
+ return new AffineTransform();
+ }
+
+ @Override
+ public GraphicsDevice getDevice() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public AffineTransform getNormalizingTransform() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
View
87 awt/com/android/internal/awt/AndroidGraphicsFactory.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2007, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.awt;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.peer.FontPeer;
+
+import org.apache.harmony.awt.gl.MultiRectArea;
+import org.apache.harmony.awt.gl.font.AndroidFont;
+import org.apache.harmony.awt.gl.font.FontManager;
+import org.apache.harmony.awt.gl.font.FontMetricsImpl;
+import org.apache.harmony.awt.gl.font.AndroidFontManager;
+import org.apache.harmony.awt.wtk.NativeWindow;
+import org.apache.harmony.awt.wtk.WindowFactory;
+import org.apache.harmony.awt.gl.CommonGraphics2DFactory;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.content.Context;
+
+public class AndroidGraphicsFactory extends CommonGraphics2DFactory {
+
+ public GraphicsEnvironment createGraphicsEnvironment(WindowFactory wf) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Font embedFont(String fontFilePath) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FontManager getFontManager() {
+ return AndroidFontManager.inst;
+ }
+
+ public FontMetrics getFontMetrics(Font font) {
+ return</