rhodes 3.3.3.beta.4 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -5
- data/CREDITS +2215 -0
- data/Rakefile +225 -59
- data/bin/c2dm.rb +0 -0
- data/bin/get-rhodes-info.bat +0 -0
- data/bin/migrate-rhodes-app +0 -0
- data/bin/migrate-rhodes-app.bat +0 -0
- data/bin/rhodes +0 -0
- data/bin/rhodes-setup +0 -0
- data/bin/rhodes-setup.bat +0 -0
- data/bin/rhogen +0 -0
- data/bin/rhogen.bat +0 -0
- data/bin/set-rhodes-sdk +0 -0
- data/bin/set-rhodes-sdk.bat +0 -0
- data/bin/upgrade-rhodes-app +0 -0
- data/bin/upgrade-rhodes-app.bat +0 -0
- data/doc/build.txt +20 -9
- data/doc/configuration.txt +8 -8
- data/doc/connect-to-web-services.txt +1 -1
- data/doc/device-caps.txt +63 -26
- data/doc/extensions.txt +14 -2
- data/doc/install.txt +28 -19
- data/doc/introduction.txt +6 -3
- data/doc/jqt-jqm-transition.txt +10 -9
- data/doc/release.txt +5 -1
- data/doc/rhodes-command-line.txt +130 -0
- data/doc/rhom.txt +16 -11
- data/doc/rhostudio-eclipse.txt +3 -3
- data/doc/simulator.txt +28 -31
- data/doc/syncengine-ajax-api.txt +246 -0
- data/doc/synchronization.txt +21 -3
- data/doc/test-log-debug.txt +3 -1
- data/doc/ui.txt +16 -16
- data/ext/extconf.rb +8 -0
- data/lib/build/jake.rb +5 -5
- data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +9 -9
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +81 -1
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/CaptureActivityHandler.java +6 -13
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/DecodeHandler.java +2 -6
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +12 -1
- data/lib/extensions/barcode/ext/barcode/platform/bb/run.bat +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.h +2 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +36 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.h +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +15 -5
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +64 -1
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode.i +35 -1
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +126 -2
- data/lib/extensions/barcode/ext/barcode/shared/src/zbar.c +18 -1
- data/lib/extensions/barcode/ext/build +0 -0
- data/lib/extensions/barcode/ext/build.bat +0 -0
- data/lib/extensions/digest-md5/ext/Rakefile +12 -10
- data/lib/extensions/digest-md5/ext/build +0 -0
- data/lib/extensions/digest-md5/ext/build.bat +0 -0
- data/lib/extensions/digest-md5/ext/digest-md5.sln +2 -2
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +41 -28
- data/lib/extensions/digest-sha1/ext/Rakefile +11 -10
- data/lib/extensions/digest-sha1/ext/build +0 -0
- data/lib/extensions/digest-sha1/ext/build.bat +0 -0
- data/lib/extensions/digest-sha1/ext/digest-sha1.sln +2 -2
- data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +41 -28
- data/lib/extensions/digest/ext/Rakefile +12 -11
- data/lib/extensions/digest/ext/build +0 -0
- data/lib/extensions/digest/ext/build.bat +0 -0
- data/lib/extensions/digest/ext/digest.sln +44 -0
- data/lib/extensions/digest/ext/digest.vcproj +40 -27
- data/lib/extensions/esri/ext/build +0 -0
- data/lib/extensions/esri/ext/build.bat +0 -0
- data/lib/extensions/fcntl/ext/Rakefile +10 -9
- data/lib/extensions/fcntl/ext/build +0 -0
- data/lib/extensions/fcntl/ext/build.bat +0 -0
- data/lib/extensions/fcntl/ext/fcntl.vcproj +1 -1
- data/lib/extensions/nfc/ext/build +0 -0
- data/lib/extensions/nfc/ext/build.bat +0 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +11 -11
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +0 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +12 -10
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +16 -9
- data/lib/extensions/pdf-writer/color.rb +145 -0
- data/lib/extensions/pdf-writer/color/cmyk.rb +279 -0
- data/lib/extensions/pdf-writer/color/css.rb +28 -0
- data/lib/extensions/pdf-writer/color/grayscale.rb +212 -0
- data/lib/extensions/pdf-writer/color/hsl.rb +221 -0
- data/lib/extensions/pdf-writer/color/palette.rb +16 -0
- data/lib/extensions/pdf-writer/color/palette/adobecolor.rb +272 -0
- data/lib/extensions/pdf-writer/color/palette/gimp.rb +116 -0
- data/lib/extensions/pdf-writer/color/palette/monocontrast.rb +180 -0
- data/lib/extensions/pdf-writer/color/rgb-colors.rb +355 -0
- data/lib/extensions/pdf-writer/color/rgb.rb +453 -0
- data/lib/extensions/pdf-writer/color/rgb/metallic.rb +43 -0
- data/lib/extensions/pdf-writer/color/yiq.rb +84 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/color/Licence.txt +27 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/color/README.txt +32 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/pdf-writer/LICENCE +131 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/pdf-writer/README +33 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/transaction-simple/Licence.txt +25 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/transaction-simple/Readme.txt +204 -0
- data/lib/extensions/pdf-writer/pdf/charts.rb +13 -0
- data/lib/extensions/pdf-writer/pdf/charts/stddev.rb +430 -0
- data/lib/extensions/pdf-writer/pdf/math.rb +108 -0
- data/lib/extensions/pdf-writer/pdf/quickref.rb +332 -0
- data/lib/extensions/pdf-writer/pdf/simpletable.rb +947 -0
- data/lib/extensions/pdf-writer/pdf/techbook.rb +901 -0
- data/lib/extensions/pdf-writer/pdf/writer.rb +2729 -0
- data/lib/extensions/pdf-writer/pdf/writer/arc4.rb +63 -0
- data/lib/extensions/pdf-writer/pdf/writer/fontmetrics.rb +203 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier-Bold.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier-BoldOblique.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier-Oblique.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica-Bold.afm +2827 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica-BoldOblique.afm +2827 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica-Oblique.afm +3051 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica.afm +3051 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/MustRead.html +19 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Symbol.afm +213 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-Bold.afm +2588 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-BoldItalic.afm +2384 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-Italic.afm +2667 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-Roman.afm +2419 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/ZapfDingbats.afm +225 -0
- data/lib/extensions/pdf-writer/pdf/writer/graphics.rb +813 -0
- data/lib/extensions/pdf-writer/pdf/writer/graphics/imageinfo.rb +365 -0
- data/lib/extensions/pdf-writer/pdf/writer/lang.rb +43 -0
- data/lib/extensions/pdf-writer/pdf/writer/lang/en.rb +99 -0
- data/lib/extensions/pdf-writer/pdf/writer/object.rb +23 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/action.rb +35 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/annotation.rb +42 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/catalog.rb +39 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/contents.rb +65 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/destination.rb +40 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/encryption.rb +53 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/font.rb +72 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/fontdescriptor.rb +34 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/fontencoding.rb +40 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/image.rb +304 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/info.rb +51 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/outline.rb +30 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/outlines.rb +30 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/page.rb +195 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/pages.rb +115 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/procset.rb +46 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/viewerpreferences.rb +74 -0
- data/lib/extensions/pdf-writer/pdf/writer/ohash.rb +58 -0
- data/lib/extensions/pdf-writer/pdf/writer/oreader.rb +25 -0
- data/lib/extensions/pdf-writer/pdf/writer/state.rb +48 -0
- data/lib/extensions/pdf-writer/pdf/writer/strokestyle.rb +138 -0
- data/lib/extensions/pdf-writer/transaction/simple.rb +486 -0
- data/lib/extensions/pdf-writer/transaction/simple/group.rb +146 -0
- data/lib/extensions/pdf-writer/transaction/simple/threadsafe.rb +68 -0
- data/lib/extensions/pdf-writer/transaction/simple/threadsafe/group.rb +36 -0
- data/lib/framework/builtinME.rb +0 -0
- data/lib/framework/dateOrig.rb +8 -2
- data/lib/framework/rational.rb +0 -0
- data/lib/framework/res/esri.wm.png +0 -0
- data/lib/framework/rho/rho.rb +6 -0
- data/lib/framework/rho/rhobluetooth.rb +0 -0
- data/lib/framework/rho/rhofsconnector.rb +0 -0
- data/lib/framework/rho/rhonativeviewmanager.rb +0 -0
- data/lib/framework/rhofsconnector.rb +0 -0
- data/lib/framework/rhom/rhom_object_factory.rb +8 -0
- data/lib/framework/rhomotoapi.rb +3 -2
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +9 -1
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +26 -2
- data/platform/android/Rhodes/jni/src/callbacks.cpp +0 -5
- data/platform/android/Rhodes/jni/src/camera.cpp +1 -1
- data/platform/android/Rhodes/jni/src/fileapi.cpp +39 -19
- data/platform/android/Rhodes/jni/src/geolocation.cpp +3 -3
- data/platform/android/Rhodes/jni/src/mapview.cpp +206 -64
- data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +13 -0
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +20 -0
- data/platform/android/Rhodes/jni/src/rhodessystem.cpp +36 -3
- data/platform/android/Rhodes/jni/src/signature.cpp +22 -2
- data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
- data/platform/android/Rhodes/res/drawable/esri.png +0 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +17 -16
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Logger.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/MemoryInfoCollector.java +67 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +139 -114
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +106 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +11 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +71 -16
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +22 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/Config.java +243 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +19 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +9 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/{RhodesActivityListener.java → extmanager/IRhoListener.java} +16 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +63 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +239 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhodesStartupListeners.java +9 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/WebkitExtension.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +27 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +124 -62
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +49 -137
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +84 -114
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +75 -82
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +3 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Callout.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapBitmapManager.java +124 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +232 -43
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Request.java +193 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/IRhoCustomView.java +13 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +32 -23
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoVideoView.java +74 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +6 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +37 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality03.java +14 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality05.java +51 -38
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality07.java +9 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality08.java +48 -31
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +15 -16
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +52 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +20 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +77 -34
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/IRhoWebView.java +9 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebChromeClient.java +105 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +1 -1
- data/platform/android/build/RhodesSRC_build.files +8 -7
- data/platform/android/build/android.rake +326 -216
- data/platform/android/build/androidcommon.rb +27 -13
- data/platform/bb/RubyVM/src/com/rho/file/SimpleFile.java +27 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +104 -38
- data/platform/bb/build/bb.rake +1 -0
- data/platform/bb/build/runRAPC.bat +0 -0
- data/platform/bb/rhodes/resources/background.png +0 -0
- data/platform/bb/rhodes/resources/esri.png +0 -0
- data/platform/bb/rhodes/resources/mappin.png +0 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +5 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +2 -2
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +0 -0
- data/platform/iphone/Classes/AppManager/AppManager.m +7 -1
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +9 -0
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +75 -4
- data/platform/iphone/Classes/GeoLocation/LocationController.h +8 -2
- data/platform/iphone/Classes/GeoLocation/LocationController.m +74 -76
- data/platform/iphone/Classes/InitMemoryInfoCollector.h +33 -0
- data/platform/iphone/Classes/InitMemoryInfoCollector.mm +52 -0
- data/platform/iphone/Classes/NativeView/NVViewController.h +0 -0
- data/platform/iphone/Classes/NativeView/NVViewController.m +34 -2
- data/platform/iphone/Classes/Rhodes.m +22 -2
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +19 -0
- data/platform/iphone/Classes/Signature/SignatureViewController.h +0 -0
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -0
- data/platform/iphone/Classes/SimpleMainView.h +0 -0
- data/platform/iphone/Classes/SimpleMainView.m +3 -3
- data/platform/iphone/ESRI/BluePushpin.png +0 -0
- data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
- data/platform/iphone/ESRI/esri.png +0 -0
- data/platform/iphone/ESRI/esri@2x.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +75 -7
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +13 -4
- data/platform/linux/target/compiler/rubylinux +0 -0
- data/platform/mac/target/compiler/RubyMac +0 -0
- data/platform/osx/Rhodes Launcher/rhorunner.app/rhorunner b/data/platform/osx/Rhodes → Launcher/rhorunner.app/rhorunner +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtWebKit.framework/Versions/4/QtWebKit +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqgenericbearer.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqcncodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqjpcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqkrcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqtwcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/graphicssystems/libqtracegraphicssystem.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqgif.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqico.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqjpeg.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqmng.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtga.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtiff.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_inspector.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_tcp.dylib +0 -0
- data/platform/osx/build/osx.rake +6 -8
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +165 -33
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +10 -1
- data/platform/shared/common/BundleManager.cpp +27 -16
- data/platform/shared/common/ExtManager.h +15 -2
- data/platform/shared/common/RhoConf.cpp +17 -2
- data/platform/shared/common/RhoConf.h +3 -1
- data/platform/shared/common/RhoDefs.h +6 -6
- data/platform/shared/common/RhoFatalError.h +1 -1
- data/platform/shared/common/RhoFile.cpp +9 -9
- data/platform/shared/common/RhoFilePath.h +7 -3
- data/platform/shared/common/RhoPort.h +3 -3
- data/platform/shared/common/RhoSystem.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +426 -26
- data/platform/shared/common/RhodesApp.h +11 -3
- data/platform/shared/common/RhodesAppBase.cpp +4 -1
- data/platform/shared/common/StringConverter.h +3 -3
- data/platform/shared/common/app_build_capabilities.h +8 -0
- data/platform/shared/common/map/BaseMapEngine.cpp +302 -21
- data/platform/shared/common/map/BaseMapEngine.h +132 -6
- data/platform/shared/common/map/ESRIMapEngine.cpp +2 -1
- data/platform/shared/common/map/GeocodingMapEngine.cpp +22 -4
- data/platform/shared/common/map/GeocodingMapEngine.h +40 -0
- data/platform/shared/common/map/GoogleMapEngine.cpp +13 -1
- data/platform/shared/common/map/MapEngine.h +7 -0
- data/platform/shared/common/map/OSMMapEngine.cpp +12 -1
- data/platform/shared/json/JSONIterator.cpp +1 -1
- data/platform/shared/json/RJSONTokener.c +2 -0
- data/platform/shared/json/config.h +3 -3
- data/platform/shared/logging/RhoLog.cpp +12 -3
- data/platform/shared/logging/RhoLog.h +2 -1
- data/platform/shared/logging/RhoLogConf.cpp +147 -11
- data/platform/shared/logging/RhoLogConf.h +39 -1
- data/platform/shared/logging/RhoLogSink.cpp +1 -1
- data/platform/shared/net/HttpServer.cpp +8 -4
- data/platform/shared/net/INetRequest.cpp +7 -0
- data/platform/shared/net/INetRequest.h +2 -0
- data/platform/shared/net/RawSocket.cpp +1 -1
- data/platform/shared/qt/pbxproj2pro.pl +0 -0
- data/platform/shared/qt/pro_vcproj_diff.pl +0 -0
- data/platform/shared/qt/rhodes/QtMainWindow.cpp +1 -1
- data/platform/shared/qt/rhodes/impl/RhoClassFactoryImpl.h +2 -2
- data/platform/shared/qt/rhodes/impl/RhoThreadImpl.cpp +2 -2
- data/platform/shared/qt/rhodes/impl/SystemImpl.cpp +11 -1
- data/platform/shared/qt/rhodes/main.cpp +5 -5
- data/platform/shared/ruby/ext/alert/alert_wrap.c +8 -8
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +0 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +16 -9
- data/platform/shared/ruby/ext/camera/camera.i +2 -2
- data/platform/shared/ruby/ext/camera/camera_wrap.c +18 -3
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +37 -8
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +8 -8
- data/platform/shared/ruby/ext/mapview/mapview_wrap.c +16 -9
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +16 -9
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +0 -0
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +16 -9
- data/platform/shared/ruby/ext/phonebook/phonebook_wrap.c +8 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +7 -1
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +16 -9
- data/platform/shared/ruby/ext/signature/signature.i +0 -0
- data/platform/shared/ruby/ext/signature/signature_wrap.c +9 -9
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +16 -9
- data/platform/shared/ruby/ext/system/system_wrap.c +16 -9
- data/platform/shared/ruby/ext/webview/webview_wrap.c +16 -9
- data/platform/shared/ruby/gc.c +1 -0
- data/platform/shared/ruby/regint.h +6 -4
- data/platform/shared/ruby/vm.c +1 -0
- data/platform/shared/ruby/wince/wince.h +1 -1
- data/platform/shared/rubyext/System.cpp +1 -1
- data/platform/shared/shttpd/src/rdispatcher.c +3 -3
- data/platform/shared/shttpd/src/std_includes.h +1 -1
- data/platform/shared/sqlite/sqlite3.c +1 -0
- data/platform/shared/statistic/test/TestProfiling.cpp +1 -1
- data/platform/shared/stlport/build/lib/configure +0 -0
- data/platform/shared/stlport/build/lib/configure.bat +0 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -12
- data/platform/shared/sync/SyncNotify.cpp +36 -3
- data/platform/shared/sync/SyncNotify.h +11 -4
- data/platform/shared/sync/SyncSource.cpp +32 -16
- data/platform/shared/sync/SyncSource.h +2 -3
- data/platform/shared/sync/SyncThread.cpp +13 -4
- data/platform/shared/sync/SyncThread.h +4 -0
- data/platform/shared/tcmalloc/page_heap.h +1 -1
- data/platform/shared/tcmalloc/rhomem.h +1 -1
- data/platform/shared/tcmalloc/windows/port.cpp +12 -3
- data/platform/shared/test/Tests.cpp +4 -4
- data/platform/shared/test/test_helper.cpp +4 -4
- data/platform/symbian/sqlite3/src/sqlite3.h +1 -1
- data/platform/win32/RhoSimulator/Microsoft.VC90.CRT.manifest +6 -0
- data/platform/win32/RhoSimulator/Microsoft.VC90.OpenMP.manifest +6 -0
- data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
- data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
- data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
- data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
- data/platform/win32/RhoSimulator/libeay32.dll +0 -0
- data/platform/win32/RhoSimulator/msvcm90.dll +0 -0
- data/platform/win32/RhoSimulator/msvcp90.dll +0 -0
- data/platform/win32/RhoSimulator/msvcr90.dll +0 -0
- data/platform/win32/RhoSimulator/phonon4.dll +0 -0
- data/platform/win32/RhoSimulator/ssleay32.dll +0 -0
- data/platform/win32/RhoSimulator/vcomp90.dll +0 -0
- data/platform/win32/target/replaceicon/replaceicon.exe +0 -0
- data/platform/win32/target/updateresstring/updateresstring.exe +0 -0
- data/platform/wm/RhoLib/RhoLib.vcproj +394 -69
- data/platform/wm/build/build_inf.js +83 -23
- data/platform/wm/build/wm.rake +127 -81
- data/platform/wm/rhodes.sln +6 -6
- data/platform/wm/rhodes/DateTimePicker.h +2 -2
- data/platform/wm/rhodes/IBrowserEngine.h +3 -0
- data/platform/wm/rhodes/IEBrowserEngine.cpp +34 -2
- data/platform/wm/rhodes/IEBrowserEngine.h +4 -1
- data/platform/wm/rhodes/LicenseStub.cpp +73 -0
- data/platform/{android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java → wm/rhodes/LogMemory.cpp} +32 -20
- data/platform/{android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettings.java → wm/rhodes/LogMemory.h} +11 -8
- data/platform/wm/rhodes/LogOptionsDlg.h +1 -1
- data/platform/wm/rhodes/LogView.cpp +10 -10
- data/platform/wm/rhodes/LogView.h +10 -10
- data/platform/wm/rhodes/MainWindow.cpp +431 -173
- data/platform/wm/rhodes/MainWindow.h +37 -19
- data/platform/wm/rhodes/MapView/MapViewManager.h +1 -1
- data/platform/wm/rhodes/OkCancelModalDialog.h +1 -1
- data/platform/wm/rhodes/Rhodes.cpp +210 -47
- data/platform/wm/rhodes/Rhodes.rc +38 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +2 -2
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +3 -3
- data/platform/wm/rhodes/camera/Camera.cpp +2 -1
- data/platform/wm/rhodes/camera/Camera.h +1 -1
- data/platform/wm/rhodes/resource.h +1 -1
- data/platform/wm/rhodes/rho/common/ExtManager.cpp +93 -5
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +2 -2
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +2 -2
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +13 -7
- data/platform/wm/rhodes/rhodes.vcproj +1409 -1008
- data/platform/wm/rhodes/simulator/MainWindowQt.h +1 -1
- data/platform/wm/rhodes/stdafx.h +2 -2
- data/platform/wm/rhoelements.sln +7 -9
- data/platform/wm/rubylib/rubylib.vcproj +62 -1
- data/platform/wm/sqlite3/sqlite3.vcproj +62 -1
- data/platform/wm/syncengine/syncengine.vcproj +62 -1
- data/platform/wm/tcmalloc/tcmalloc.vcproj +72 -53
- data/platform/wm/tools/detool/detool.cpp +1435 -1357
- data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +0 -0
- data/platform/wp7/RhoRubyLib/common/RhoLicense.cs +105 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +23 -5
- data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +5 -0
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +22 -3
- data/platform/wp7/build/wp.rake +1 -0
- data/platform/wp7/rhodes/MainPage.xaml.cs +11 -0
- data/rakefile.rb +225 -59
- data/res/build-tools/7za.exe +0 -0
- data/res/build-tools/RhoAppRunner.exe +0 -0
- data/res/build-tools/RhoLogServer.exe +0 -0
- data/res/build-tools/RhoRuby.exe +0 -0
- data/res/build-tools/RubyMac +0 -0
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +1 -1
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim_43 +0 -0
- data/res/build-tools/license_rc.dll +0 -0
- data/res/build-tools/make.exe +0 -0
- data/res/build-tools/rubylinux +0 -0
- data/res/build-tools/swig_patch/Lib/typemaps/fragments.swg +235 -0
- data/res/build-tools/wmdc_connect.exe +0 -0
- data/res/build-tools/wp7explorer.exe +0 -0
- data/res/generators/rhogen.rb +2 -2
- data/res/generators/templates/application/app/Settings/controller.rb +1 -1
- data/res/generators/templates/application/app/layout.erb +1 -1
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/public/css/re_webkit.css +736 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +0 -0
- data/res/generators/templates/application/public/images/listArrow.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/ajax-loader.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
- data/res/generators/templates/application/public/js/syncengine.js +409 -52
- data/res/generators/templates/extension/extensions/montana/ext/build +0 -0
- data/res/generators/templates/extension/extensions/montana/ext/build.bat +0 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/Rakefile +10 -10
- data/res/generators/templates/spec/app/SpecRunner/controller.rb +2 -0
- data/res/libs/motorolalicence/android/MotorolaLicence.h +13 -0
- data/res/libs/motorolalicence/android/libMotorolaLicence.a +0 -0
- data/res/libs/motorolalicence/iphone/MotorolaLicence.h +13 -0
- data/res/libs/motorolalicence/iphone/libMotorolaLicence.a +0 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/SpecRunner/controller.rb +2 -0
- data/spec/phone_spec/app/SpecRunner/controller.rb +2 -0
- data/version +1 -1
- metadata +487 -412
- data/Manifest.txt +0 -7960
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityStartupListeners.java +0 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +0 -52
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsOld.java +0 -62
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/phonon.framework/Versions/4/phonon +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/phonon_backend/libphonon_qt7.dylib +0 -0
- data/platform/win32/RhoSimulator/Microsoft.VC80.CRT.manifest +0 -8
- data/platform/win32/RhoSimulator/Microsoft.VC80.OpenMP.manifest +0 -7
- data/platform/win32/RhoSimulator/msvcm80.dll +0 -0
- data/platform/win32/RhoSimulator/msvcp80.dll +0 -0
- data/platform/win32/RhoSimulator/msvcr80.dll +0 -0
- data/platform/win32/RhoSimulator/vcomp.dll +0 -0
- data/rhomobile-debug-1.0.6.gem +0 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
#--
|
2
|
+
# Color
|
3
|
+
# Colour management with Ruby
|
4
|
+
# http://rubyforge.org/projects/color
|
5
|
+
# Version 1.4.1
|
6
|
+
#
|
7
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
+
# distribution for full licensing information.
|
9
|
+
#
|
10
|
+
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
+
#++
|
12
|
+
|
13
|
+
require 'color'
|
14
|
+
|
15
|
+
# This namespace contains some CSS colour names.
|
16
|
+
module Color::CSS
|
17
|
+
# Returns the RGB colour for name or +nil+ if the name is not valid.
|
18
|
+
def self.[](name)
|
19
|
+
@colors[name.to_s.downcase.to_sym]
|
20
|
+
end
|
21
|
+
|
22
|
+
@colors = {}
|
23
|
+
Color::RGB.constants.each do |const|
|
24
|
+
next if const == "PDF_FORMAT_STR"
|
25
|
+
next if const == "Metallic"
|
26
|
+
@colors[const.downcase.to_sym] ||= Color::RGB.const_get(const)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
#--
|
2
|
+
# Color
|
3
|
+
# Colour management with Ruby
|
4
|
+
# http://rubyforge.org/projects/color
|
5
|
+
# Version 1.4.1
|
6
|
+
#
|
7
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
+
# distribution for full licensing information.
|
9
|
+
#
|
10
|
+
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
+
#++
|
12
|
+
|
13
|
+
# A colour object representing shades of grey. Used primarily in PDF
|
14
|
+
# document creation.
|
15
|
+
class Color::GrayScale
|
16
|
+
# The format of a DeviceGrey colour for PDF. In color-tools 2.0 this will
|
17
|
+
# be removed from this package and added back as a modification by the
|
18
|
+
# PDF::Writer package.
|
19
|
+
PDF_FORMAT_STR = "%.3f %s"
|
20
|
+
|
21
|
+
# Creates a greyscale colour object from fractional values 0..1.
|
22
|
+
#
|
23
|
+
# Color::GreyScale.from_fraction(0.5)
|
24
|
+
def self.from_fraction(g = 0)
|
25
|
+
color = Color::GrayScale.new
|
26
|
+
color.g = g
|
27
|
+
color
|
28
|
+
end
|
29
|
+
|
30
|
+
# Creates a greyscale colour object from percentages 0..100.
|
31
|
+
#
|
32
|
+
# Color::GrayScale.from_percent(50)
|
33
|
+
def self.from_percent(g = 0)
|
34
|
+
Color::GrayScale.new(g)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates a greyscale colour object from percentages 0..100.
|
38
|
+
#
|
39
|
+
# Color::GrayScale.new(50)
|
40
|
+
def initialize(g = 0)
|
41
|
+
@g = g / 100.0
|
42
|
+
end
|
43
|
+
|
44
|
+
# Compares the other colour to this one. The other colour will be
|
45
|
+
# converted to GreyScale before comparison, so the comparison between a
|
46
|
+
# GreyScale colour and a non-GreyScale colour will be approximate and
|
47
|
+
# based on the other colour's #to_greyscale conversion. If there is no
|
48
|
+
# #to_greyscale conversion, this will raise an exception. This will report
|
49
|
+
# that two GreyScale values are equivalent if they are within
|
50
|
+
# COLOR_TOLERANCE of each other.
|
51
|
+
def ==(other)
|
52
|
+
other = other.to_grayscale
|
53
|
+
other.kind_of?(Color::GrayScale) and
|
54
|
+
((@g - other.g).abs <= Color::COLOR_TOLERANCE)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Present the colour as a DeviceGrey fill colour string for PDF. This will
|
58
|
+
# be removed from the default package in color-tools 2.0.
|
59
|
+
def pdf_fill
|
60
|
+
PDF_FORMAT_STR % [ @g, "g" ]
|
61
|
+
end
|
62
|
+
|
63
|
+
# Present the colour as a DeviceGrey stroke colour string for PDF. This
|
64
|
+
# will be removed from the default package in color-tools 2.0.
|
65
|
+
def pdf_stroke
|
66
|
+
PDF_FORMAT_STR % [ @g, "G" ]
|
67
|
+
end
|
68
|
+
|
69
|
+
def to_255
|
70
|
+
[(@g * 255).round, 255].min
|
71
|
+
end
|
72
|
+
private :to_255
|
73
|
+
|
74
|
+
# Present the colour as an HTML/CSS colour string.
|
75
|
+
def html
|
76
|
+
gs = "%02x" % to_255
|
77
|
+
"##{gs * 3}"
|
78
|
+
end
|
79
|
+
|
80
|
+
# Present the colour as an RGB HTML/CSS colour string (e.g., "rgb(0%, 50%,
|
81
|
+
# 100%)").
|
82
|
+
def css_rgb
|
83
|
+
"rgb(%3.2f%%, %3.2f%%, %3.2f%%)" % [ gray, gray, gray ]
|
84
|
+
end
|
85
|
+
|
86
|
+
# Present the colour as an RGBA (with alpha) HTML/CSS colour string (e.g.,
|
87
|
+
# "rgb(0%, 50%, 100%, 1)").
|
88
|
+
def css_rgba
|
89
|
+
"rgba(%3.2f%%, %3.2f%%, %3.2f%%, %1.2f)" % [ gray, gray, gray, 1 ]
|
90
|
+
end
|
91
|
+
|
92
|
+
# Present the colour as an HSL HTML/CSS colour string (e.g., "hsl(180,
|
93
|
+
# 25%, 35%)"). Note that this will perform a #to_hsl operation.
|
94
|
+
def css_hsl
|
95
|
+
to_hsl.css_hsl
|
96
|
+
end
|
97
|
+
|
98
|
+
# Present the colour as an HSLA (with alpha) HTML/CSS colour string (e.g.,
|
99
|
+
# "hsla(180, 25%, 35%, 1)"). Note that this will perform a #to_hsl
|
100
|
+
# operation.
|
101
|
+
def css_hsla
|
102
|
+
to_hsl.css_hsla
|
103
|
+
end
|
104
|
+
|
105
|
+
# Convert the greyscale colour to CMYK.
|
106
|
+
def to_cmyk
|
107
|
+
k = 1.0 - @g.to_f
|
108
|
+
Color::CMYK.from_fraction(0, 0, 0, k)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Convert the greyscale colour to RGB.
|
112
|
+
def to_rgb(ignored = true)
|
113
|
+
Color::RGB.from_fraction(g, g, g)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Reflexive conversion.
|
117
|
+
def to_grayscale
|
118
|
+
self
|
119
|
+
end
|
120
|
+
alias to_greyscale to_grayscale
|
121
|
+
|
122
|
+
# Lightens the greyscale colour by the stated percent.
|
123
|
+
def lighten_by(percent)
|
124
|
+
g = [@g + (@g * (percent / 100.0)), 1.0].min
|
125
|
+
Color::GrayScale.from_fraction(g)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Darken the greyscale colour by the stated percent.
|
129
|
+
def darken_by(percent)
|
130
|
+
g = [@g - (@g * (percent / 100.0)), 0.0].max
|
131
|
+
Color::GrayScale.from_fraction(g)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Returns the YIQ (NTSC) colour encoding of the greyscale value. This is
|
135
|
+
# an approximation, as the values for I and Q are calculated by treating
|
136
|
+
# the greyscale value as an RGB value. The Y (intensity or brightness)
|
137
|
+
# value is the same as the greyscale value.
|
138
|
+
def to_yiq
|
139
|
+
y = @g
|
140
|
+
i = (@g * 0.596) + (@g * -0.275) + (@g * -0.321)
|
141
|
+
q = (@g * 0.212) + (@g * -0.523) + (@g * 0.311)
|
142
|
+
Color::YIQ.from_fraction(y, i, q)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the HSL colour encoding of the greyscale value.
|
146
|
+
def to_hsl
|
147
|
+
Color::HSL.from_fraction(0, 0, @g)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Returns the brightness value for this greyscale value; this is the
|
151
|
+
# greyscale value itself.
|
152
|
+
def brightness
|
153
|
+
@g
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns the grayscale value as a percentage of white (100% gray is
|
157
|
+
# white).
|
158
|
+
def gray
|
159
|
+
@g * 100.0
|
160
|
+
end
|
161
|
+
alias grey gray
|
162
|
+
# Returns the grayscale value as a fractional value of white in the range
|
163
|
+
# 0.0 .. 1.0.
|
164
|
+
def g
|
165
|
+
@g
|
166
|
+
end
|
167
|
+
# Sets the grayscale value as a percentage of white.
|
168
|
+
def gray=(gg)
|
169
|
+
@g = Color.normalize(gg / 100.0)
|
170
|
+
end
|
171
|
+
alias grey= gray= ;
|
172
|
+
# Returns the grayscale value as a fractional value of white in the range
|
173
|
+
# 0.0 .. 1.0.
|
174
|
+
def g=(gg)
|
175
|
+
@g = Color.normalize(gg)
|
176
|
+
end
|
177
|
+
|
178
|
+
# Adds another colour to the current colour. The other colour will be
|
179
|
+
# converted to grayscale before addition. This conversion depends upon a
|
180
|
+
# #to_grayscale method on the other colour.
|
181
|
+
#
|
182
|
+
# The addition is done using the grayscale accessor methods to ensure a
|
183
|
+
# valid colour in the result.
|
184
|
+
def +(other)
|
185
|
+
other = other.to_grayscale
|
186
|
+
ng = self.dup
|
187
|
+
ng.g += other.g
|
188
|
+
ng
|
189
|
+
end
|
190
|
+
|
191
|
+
# Subtracts another colour to the current colour. The other colour will be
|
192
|
+
# converted to grayscale before subtraction. This conversion depends upon
|
193
|
+
# a #to_grayscale method on the other colour.
|
194
|
+
#
|
195
|
+
# The subtraction is done using the grayscale accessor methods to ensure a
|
196
|
+
# valid colour in the result.
|
197
|
+
def -(other)
|
198
|
+
other = other.to_grayscale
|
199
|
+
ng = self.dup
|
200
|
+
ng.g -= other.g
|
201
|
+
ng
|
202
|
+
end
|
203
|
+
|
204
|
+
def inspect
|
205
|
+
"Gray [%.2f%%]" % [ gray ]
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
module Color
|
210
|
+
# A synonym for Color::GrayScale.
|
211
|
+
GreyScale = GrayScale
|
212
|
+
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
#--
|
2
|
+
# Color
|
3
|
+
# Colour management with Ruby
|
4
|
+
# http://rubyforge.org/projects/color
|
5
|
+
# Version 1.4.1
|
6
|
+
#
|
7
|
+
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
+
# distribution for full licensing information.
|
9
|
+
#
|
10
|
+
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
+
#++
|
12
|
+
|
13
|
+
# An HSL colour object. Internally, the hue (#h), saturation (#s), and
|
14
|
+
# luminosity/lightness (#l) values are dealt with as fractional values in
|
15
|
+
# the range 0..1.
|
16
|
+
class Color::HSL
|
17
|
+
class << self
|
18
|
+
# Creates an HSL colour object from fractional values 0..1.
|
19
|
+
def from_fraction(h = 0.0, s = 0.0, l = 0.0)
|
20
|
+
colour = Color::HSL.new
|
21
|
+
colour.h = h
|
22
|
+
colour.s = s
|
23
|
+
colour.l = l
|
24
|
+
colour
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Compares the other colour to this one. The other colour will be
|
29
|
+
# converted to HSL before comparison, so the comparison between a HSL
|
30
|
+
# colour and a non-HSL colour will be approximate and based on the other
|
31
|
+
# colour's #to_hsl conversion. If there is no #to_hsl conversion, this
|
32
|
+
# will raise an exception. This will report that two HSL values are
|
33
|
+
# equivalent if all component values are within Color::COLOR_TOLERANCE of
|
34
|
+
# each other.
|
35
|
+
def ==(other)
|
36
|
+
other = other.to_hsl
|
37
|
+
other.kind_of?(Color::HSL) and
|
38
|
+
((@h - other.h).abs <= Color::COLOR_TOLERANCE) and
|
39
|
+
((@s - other.s).abs <= Color::COLOR_TOLERANCE) and
|
40
|
+
((@l - other.l).abs <= Color::COLOR_TOLERANCE)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Creates an HSL colour object from the standard values of degrees and
|
44
|
+
# percentages (e.g., 145 deg, 30%, 50%).
|
45
|
+
def initialize(h = 0, s = 0, l = 0)
|
46
|
+
@h = h / 360.0
|
47
|
+
@s = s / 100.0
|
48
|
+
@l = l / 100.0
|
49
|
+
end
|
50
|
+
|
51
|
+
# Present the colour as an HTML/CSS colour string.
|
52
|
+
def html
|
53
|
+
to_rgb.html
|
54
|
+
end
|
55
|
+
|
56
|
+
# Present the colour as an RGB HTML/CSS colour string (e.g., "rgb(0%, 50%,
|
57
|
+
# 100%)"). Note that this will perform a #to_rgb operation using the
|
58
|
+
# default conversion formula.
|
59
|
+
def css_rgb
|
60
|
+
to_rgb.css_rgb
|
61
|
+
end
|
62
|
+
|
63
|
+
# Present the colour as an RGBA (with alpha) HTML/CSS colour string (e.g.,
|
64
|
+
# "rgb(0%, 50%, 100%, 1)"). Note that this will perform a #to_rgb
|
65
|
+
# operation using the default conversion formula.
|
66
|
+
def css_rgba
|
67
|
+
to_rgb.css_rgba
|
68
|
+
end
|
69
|
+
|
70
|
+
# Present the colour as an HSL HTML/CSS colour string (e.g., "hsl(180,
|
71
|
+
# 25%, 35%)").
|
72
|
+
def css_hsl
|
73
|
+
"hsl(%3.2f, %3.2f%%, %3.2f%%)" % [ hue, saturation, luminosity ]
|
74
|
+
end
|
75
|
+
|
76
|
+
# Present the colour as an HSLA (with alpha) HTML/CSS colour string (e.g.,
|
77
|
+
# "hsla(180, 25%, 35%, 1)").
|
78
|
+
def css_hsla
|
79
|
+
"hsla(%3.2f, %3.2f%%, %3.2f%%, %3.2f)" % [ hue, saturation, luminosity, 1 ]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Converting to HSL as adapted from Foley and Van-Dam from
|
83
|
+
# http://www.bobpowell.net/RGBHSB.htm.
|
84
|
+
#
|
85
|
+
# NOTE:
|
86
|
+
# * If the colour's luminosity is near zero, the colour is always black.
|
87
|
+
# * If the colour's luminosity is near one, the colour is always white.
|
88
|
+
# * If the colour's saturation is near zero, the colour is always a shade
|
89
|
+
# of grey and is based only on the luminosity of the colour.
|
90
|
+
#
|
91
|
+
def to_rgb(ignored = nil)
|
92
|
+
return Color::RGB.new if Color.near_zero_or_less?(@l)
|
93
|
+
return Color::RGB.new(0xff, 0xff, 0xff) if Color.near_one_or_more?(@l)
|
94
|
+
return Color::RGB.from_fraction(@l, @l, @l) if Color.near_zero?(@s)
|
95
|
+
|
96
|
+
# Is the value less than 0.5?
|
97
|
+
if Color.near_zero_or_less?(@l - 0.5)
|
98
|
+
tmp2 = @l * (1.0 + @s.to_f)
|
99
|
+
else
|
100
|
+
tmp2 = @l + @s - (@l * @s.to_f)
|
101
|
+
end
|
102
|
+
tmp1 = 2.0 * @l - tmp2
|
103
|
+
|
104
|
+
tmp3 = [ @h + (1.0 / 3.0), @h, @h - (1.0 / 3.0) ]
|
105
|
+
|
106
|
+
rgb = tmp3.map { |hue|
|
107
|
+
hue += 1.0 if Color.near_zero_or_less?(hue)
|
108
|
+
hue -= 1.0 if Color.near_one_or_more?(hue)
|
109
|
+
|
110
|
+
if Color.near_zero_or_less?((6.0 * hue) - 1.0)
|
111
|
+
tmp1 + ((tmp2 - tmp1) * hue * 6.0)
|
112
|
+
elsif Color.near_zero_or_less?((2.0 * hue) - 1.0)
|
113
|
+
tmp2
|
114
|
+
elsif Color.near_zero_or_less?((3.0 * hue) - 2.0)
|
115
|
+
tmp1 + (tmp2 - tmp1) * ((2 / 3.0) - hue) * 6.0
|
116
|
+
else
|
117
|
+
tmp1
|
118
|
+
end
|
119
|
+
}
|
120
|
+
|
121
|
+
Color::RGB.from_fraction(*rgb)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Converts to RGB then YIQ.
|
125
|
+
def to_yiq
|
126
|
+
to_rgb.to_yiq
|
127
|
+
end
|
128
|
+
|
129
|
+
# Converts to RGB then CMYK.
|
130
|
+
def to_cmyk
|
131
|
+
to_rgb.to_cmyk
|
132
|
+
end
|
133
|
+
|
134
|
+
# Returns the luminosity (#l) of the colour.
|
135
|
+
def brightness
|
136
|
+
@l
|
137
|
+
end
|
138
|
+
def to_greyscale
|
139
|
+
Color::GrayScale.from_fraction(@l)
|
140
|
+
end
|
141
|
+
alias to_grayscale to_greyscale
|
142
|
+
|
143
|
+
# Returns the hue of the colour in degrees.
|
144
|
+
def hue
|
145
|
+
@h * 360.0
|
146
|
+
end
|
147
|
+
# Returns the hue of the colour in the range 0.0 .. 1.0.
|
148
|
+
def h
|
149
|
+
@h
|
150
|
+
end
|
151
|
+
# Sets the hue of the colour in degrees. Colour is perceived as a wheel,
|
152
|
+
# so values should be set properly even with negative degree values.
|
153
|
+
def hue=(hh)
|
154
|
+
hh = hh / 360.0
|
155
|
+
|
156
|
+
hh += 1.0 if hh < 0.0
|
157
|
+
hh -= 1.0 if hh > 1.0
|
158
|
+
|
159
|
+
@h = Color.normalize(hh)
|
160
|
+
end
|
161
|
+
# Sets the hue of the colour in the range 0.0 .. 1.0.
|
162
|
+
def h=(hh)
|
163
|
+
@h = Color.normalize(hh)
|
164
|
+
end
|
165
|
+
# Returns the percentage of saturation of the colour.
|
166
|
+
def saturation
|
167
|
+
@s * 100.0
|
168
|
+
end
|
169
|
+
# Returns the saturation of the colour in the range 0.0 .. 1.0.
|
170
|
+
def s
|
171
|
+
@s
|
172
|
+
end
|
173
|
+
# Sets the percentage of saturation of the colour.
|
174
|
+
def saturation=(ss)
|
175
|
+
@s = Color.normalize(ss / 100.0)
|
176
|
+
end
|
177
|
+
# Sets the saturation of the colour in the ragne 0.0 .. 1.0.
|
178
|
+
def s=(ss)
|
179
|
+
@s = Color.normalize(ss)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the percentage of luminosity of the colour.
|
183
|
+
def luminosity
|
184
|
+
@l * 100.0
|
185
|
+
end
|
186
|
+
alias lightness luminosity
|
187
|
+
# Returns the luminosity of the colour in the range 0.0 .. 1.0.
|
188
|
+
def l
|
189
|
+
@l
|
190
|
+
end
|
191
|
+
# Sets the percentage of luminosity of the colour.
|
192
|
+
def luminosity=(ll)
|
193
|
+
@l = Color.normalize(ll / 100.0)
|
194
|
+
end
|
195
|
+
alias lightness= luminosity= ;
|
196
|
+
# Sets the luminosity of the colour in the ragne 0.0 .. 1.0.
|
197
|
+
def l=(ll)
|
198
|
+
@l = Color.normalize(ll)
|
199
|
+
end
|
200
|
+
|
201
|
+
def to_hsl
|
202
|
+
self
|
203
|
+
end
|
204
|
+
|
205
|
+
def inspect
|
206
|
+
"HSL [%.2f deg, %.2f%%, %.2f%%]" % [ hue, saturation, luminosity ]
|
207
|
+
end
|
208
|
+
|
209
|
+
# Mix the mask colour (which will be converted to an HSL colour) with the
|
210
|
+
# current colour at the stated mix percentage as a decimal value.
|
211
|
+
#
|
212
|
+
# NOTE:: This differs from Color::RGB#mix_with.
|
213
|
+
def mix_with(color, mix_percent = 0.5)
|
214
|
+
color = color.to_hsl
|
215
|
+
_h = ((color.h - self.h) * mix_percent) + self.h
|
216
|
+
_s = ((color.s - self.s) * mix_percent) + self.s
|
217
|
+
_l = ((color.l - self.l) * mix_percent) + self.l
|
218
|
+
|
219
|
+
self.class.from_fraction(_h, _s, _l)
|
220
|
+
end
|
221
|
+
end
|