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,355 @@
|
|
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
|
+
class Color::RGB
|
14
|
+
AliceBlue = Color::RGB.new(0xf0, 0xf8, 0xff)
|
15
|
+
AntiqueWhite = Color::RGB.new(0xfa, 0xeb, 0xd7)
|
16
|
+
Aqua = Color::RGB.new(0x00, 0xff, 0xff)
|
17
|
+
Aquamarine = Color::RGB.new(0x7f, 0xff, 0xd4)
|
18
|
+
Azure = Color::RGB.new(0xf0, 0xff, 0xff)
|
19
|
+
Beige = Color::RGB.new(0xf5, 0xf5, 0xdc)
|
20
|
+
Bisque = Color::RGB.new(0xff, 0xe4, 0xc4)
|
21
|
+
Black = Color::RGB.new(0, 0, 0)
|
22
|
+
BlanchedAlmond = Color::RGB.new(0xff, 0xeb, 0xcd)
|
23
|
+
Blue = Color::RGB.new(0x00, 0x00, 0xff)
|
24
|
+
BlueViolet = Color::RGB.new(0x8a, 0x2b, 0xe2)
|
25
|
+
Brown = Color::RGB.new(0xa5, 0x2a, 0x2a)
|
26
|
+
BurlyWood = Color::RGB.new(0xde, 0xb8, 0x87)
|
27
|
+
Burlywood = BurlyWood
|
28
|
+
CadetBlue = Color::RGB.new(0x5f, 0x9e, 0xa0)
|
29
|
+
Carnation = Color::RGB.new(0xff, 0x5e, 0xd0)
|
30
|
+
Cayenne = Color::RGB.new(0x8d, 0x00, 0x00)
|
31
|
+
Chartreuse = Color::RGB.new(0x7f, 0xff, 0x00)
|
32
|
+
Chocolate = Color::RGB.new(0xd2, 0x69, 0x1e)
|
33
|
+
Coral = Color::RGB.new(0xff, 0x7f, 0x50)
|
34
|
+
CornflowerBlue = Color::RGB.new(0x64, 0x95, 0xed)
|
35
|
+
Cornsilk = Color::RGB.new(0xff, 0xf8, 0xdc)
|
36
|
+
Crimson = Color::RGB.new(0xdc, 0x14, 0x3c)
|
37
|
+
Cyan = Color::RGB.new(0x00, 0xff, 0xff)
|
38
|
+
DarkBlue = Color::RGB.new(0x00, 0x00, 0x8b)
|
39
|
+
DarkCyan = Color::RGB.new(0x00, 0x8b, 0x8b)
|
40
|
+
DarkGoldenRod = Color::RGB.new(0xb8, 0x86, 0x0b)
|
41
|
+
DarkGoldenrod = DarkGoldenRod
|
42
|
+
DarkGray = Color::RGB.new(0xa9, 0xa9, 0xa9)
|
43
|
+
DarkGreen = Color::RGB.new(0x00, 0x64, 0x00)
|
44
|
+
DarkGrey = DarkGray
|
45
|
+
DarkKhaki = Color::RGB.new(0xbd, 0xb7, 0x6b)
|
46
|
+
DarkMagenta = Color::RGB.new(0x8b, 0x00, 0x8b)
|
47
|
+
DarkOliveGreen = Color::RGB.new(0x55, 0x6b, 0x2f)
|
48
|
+
DarkOrange = Color::RGB.new(0xff, 0x8c, 0x00)
|
49
|
+
DarkOrchid = Color::RGB.new(0x99, 0x32, 0xcc)
|
50
|
+
DarkRed = Color::RGB.new(0x8b, 0x00, 0x00)
|
51
|
+
DarkSalmon = Color::RGB.new(0xe9, 0x96, 0x7a)
|
52
|
+
DarkSeaGreen = Color::RGB.new(0x8f, 0xbc, 0x8f)
|
53
|
+
DarkSlateBlue = Color::RGB.new(0x48, 0x3d, 0x8b)
|
54
|
+
DarkSlateGray = Color::RGB.new(0x2f, 0x4f, 0x4f)
|
55
|
+
DarkSlateGrey = DarkSlateGray
|
56
|
+
DarkTurquoise = Color::RGB.new(0x00, 0xce, 0xd1)
|
57
|
+
DarkViolet = Color::RGB.new(0x94, 0x00, 0xd3)
|
58
|
+
DarkoliveGreen = DarkOliveGreen
|
59
|
+
Darkorange = Color::RGB.new(0xff, 0x8c, 0x00)
|
60
|
+
Darksalmon = DarkSalmon
|
61
|
+
DeepPink = Color::RGB.new(0xff, 0x14, 0x93)
|
62
|
+
DeepSkyBlue = Color::RGB.new(0x00, 0xbf, 0xbf)
|
63
|
+
DimGray = Color::RGB.new(0x69, 0x69, 0x69)
|
64
|
+
DimGrey = DimGray
|
65
|
+
DodgerBlue = Color::RGB.new(0x1e, 0x90, 0xff)
|
66
|
+
Feldspar = Color::RGB.new(0xd1, 0x92, 0x75)
|
67
|
+
FireBrick = Color::RGB.new(0xb2, 0x22, 0x22)
|
68
|
+
Firebrick = FireBrick
|
69
|
+
FloralWhite = Color::RGB.new(0xff, 0xfa, 0xf0)
|
70
|
+
ForestGreen = Color::RGB.new(0x22, 0x8b, 0x22)
|
71
|
+
Fuchsia = Color::RGB.new(0xff, 0x00, 0xff)
|
72
|
+
Gainsboro = Color::RGB.new(0xdc, 0xdc, 0xdc)
|
73
|
+
GhostWhite = Color::RGB.new(0xf8, 0xf8, 0xff)
|
74
|
+
Gold = Color::RGB.new(0xff, 0xd7, 0x00)
|
75
|
+
GoldenRod = Color::RGB.new(0xda, 0xa5, 0x20)
|
76
|
+
Goldenrod = GoldenRod
|
77
|
+
Gray = Color::RGB.new(0x80, 0x80, 0x80)
|
78
|
+
Gray10 = Color::RGB.from_percentage(10, 10, 10)
|
79
|
+
Gray20 = Color::RGB.from_percentage(20, 20, 20)
|
80
|
+
Gray30 = Color::RGB.from_percentage(30, 30, 30)
|
81
|
+
Gray40 = Color::RGB.from_percentage(40, 40, 40)
|
82
|
+
Gray50 = Color::RGB.from_percentage(50, 50, 50)
|
83
|
+
Gray60 = Color::RGB.from_percentage(60, 60, 60)
|
84
|
+
Gray70 = Color::RGB.from_percentage(70, 70, 70)
|
85
|
+
Gray80 = Color::RGB.from_percentage(80, 80, 80)
|
86
|
+
Gray90 = Color::RGB.from_percentage(90, 90, 90)
|
87
|
+
Green = Color::RGB.new(0x00, 0x80, 0x00)
|
88
|
+
GreenYellow = Color::RGB.new(0xad, 0xff, 0x2f)
|
89
|
+
Grey = Gray
|
90
|
+
Grey10 = Gray10
|
91
|
+
Grey20 = Gray20
|
92
|
+
Grey30 = Gray30
|
93
|
+
Grey40 = Gray40
|
94
|
+
Grey50 = Gray50
|
95
|
+
Grey60 = Gray60
|
96
|
+
Grey70 = Gray70
|
97
|
+
Grey80 = Gray80
|
98
|
+
Grey90 = Gray90
|
99
|
+
HoneyDew = Color::RGB.new(0xf0, 0xff, 0xf0)
|
100
|
+
Honeydew = HoneyDew
|
101
|
+
HotPink = Color::RGB.new(0xff, 0x69, 0xb4)
|
102
|
+
IndianRed = Color::RGB.new(0xcd, 0x5c, 0x5c)
|
103
|
+
Indigo = Color::RGB.new(0x4b, 0x00, 0x82)
|
104
|
+
Ivory = Color::RGB.new(0xff, 0xff, 0xf0)
|
105
|
+
Khaki = Color::RGB.new(0xf0, 0xe6, 0x8c)
|
106
|
+
Lavender = Color::RGB.new(0xe6, 0xe6, 0xfa)
|
107
|
+
LavenderBlush = Color::RGB.new(0xff, 0xf0, 0xf5)
|
108
|
+
LawnGreen = Color::RGB.new(0x7c, 0xfc, 0x00)
|
109
|
+
LemonChiffon = Color::RGB.new(0xff, 0xfa, 0xcd)
|
110
|
+
LightBlue = Color::RGB.new(0xad, 0xd8, 0xe6)
|
111
|
+
LightCoral = Color::RGB.new(0xf0, 0x80, 0x80)
|
112
|
+
LightCyan = Color::RGB.new(0xe0, 0xff, 0xff)
|
113
|
+
LightGoldenRodYellow = Color::RGB.new(0xfa, 0xfa, 0xd2)
|
114
|
+
LightGoldenrodYellow = LightGoldenRodYellow
|
115
|
+
LightGray = Color::RGB.new(0xd3, 0xd3, 0xd3)
|
116
|
+
LightGreen = Color::RGB.new(0x90, 0xee, 0x90)
|
117
|
+
LightGrey = LightGray
|
118
|
+
LightPink = Color::RGB.new(0xff, 0xb6, 0xc1)
|
119
|
+
LightSalmon = Color::RGB.new(0xff, 0xa0, 0x7a)
|
120
|
+
LightSeaGreen = Color::RGB.new(0x20, 0xb2, 0xaa)
|
121
|
+
LightSkyBlue = Color::RGB.new(0x87, 0xce, 0xfa)
|
122
|
+
LightSlateBlue = Color::RGB.new(0x84, 0x70, 0xff)
|
123
|
+
LightSlateGray = Color::RGB.new(0x77, 0x88, 0x99)
|
124
|
+
LightSlateGrey = LightSlateGray
|
125
|
+
LightSteelBlue = Color::RGB.new(0xb0, 0xc4, 0xde)
|
126
|
+
LightYellow = Color::RGB.new(0xff, 0xff, 0xe0)
|
127
|
+
Lightsalmon = LightSalmon
|
128
|
+
LightsteelBlue = LightSteelBlue
|
129
|
+
Lime = Color::RGB.new(0x00, 0xff, 0x00)
|
130
|
+
LimeGreen = Color::RGB.new(0x32, 0xcd, 0x32)
|
131
|
+
Linen = Color::RGB.new(0xfa, 0xf0, 0xe6)
|
132
|
+
Magenta = Color::RGB.new(0xff, 0x00, 0xff)
|
133
|
+
Maroon = Color::RGB.new(0x80, 0x00, 0x00)
|
134
|
+
MediumAquaMarine = Color::RGB.new(0x66, 0xcd, 0xaa)
|
135
|
+
MediumAquamarine = MediumAquaMarine
|
136
|
+
MediumBlue = Color::RGB.new(0x00, 0x00, 0xcd)
|
137
|
+
MediumOrchid = Color::RGB.new(0xba, 0x55, 0xd3)
|
138
|
+
MediumPurple = Color::RGB.new(0x93, 0x70, 0xdb)
|
139
|
+
MediumSeaGreen = Color::RGB.new(0x3c, 0xb3, 0x71)
|
140
|
+
MediumSlateBlue = Color::RGB.new(0x7b, 0x68, 0xee)
|
141
|
+
MediumSpringGreen = Color::RGB.new(0x00, 0xfa, 0x9a)
|
142
|
+
MediumTurquoise = Color::RGB.new(0x48, 0xd1, 0xcc)
|
143
|
+
MediumVioletRed = Color::RGB.new(0xc7, 0x15, 0x85)
|
144
|
+
MidnightBlue = Color::RGB.new(0x19, 0x19, 0x70)
|
145
|
+
MintCream = Color::RGB.new(0xf5, 0xff, 0xfa)
|
146
|
+
MistyRose = Color::RGB.new(0xff, 0xe4, 0xe1)
|
147
|
+
Moccasin = Color::RGB.new(0xff, 0xe4, 0xb5)
|
148
|
+
NavajoWhite = Color::RGB.new(0xff, 0xde, 0xad)
|
149
|
+
Navy = Color::RGB.new(0x00, 0x00, 0x80)
|
150
|
+
OldLace = Color::RGB.new(0xfd, 0xf5, 0xe6)
|
151
|
+
Olive = Color::RGB.new(0x80, 0x80, 0x00)
|
152
|
+
OliveDrab = Color::RGB.new(0x6b, 0x8e, 0x23)
|
153
|
+
Olivedrab = OliveDrab
|
154
|
+
Orange = Color::RGB.new(0xff, 0xa5, 0x00)
|
155
|
+
OrangeRed = Color::RGB.new(0xff, 0x45, 0x00)
|
156
|
+
Orchid = Color::RGB.new(0xda, 0x70, 0xd6)
|
157
|
+
PaleGoldenRod = Color::RGB.new(0xee, 0xe8, 0xaa)
|
158
|
+
PaleGoldenrod = PaleGoldenRod
|
159
|
+
PaleGreen = Color::RGB.new(0x98, 0xfb, 0x98)
|
160
|
+
PaleTurquoise = Color::RGB.new(0xaf, 0xee, 0xee)
|
161
|
+
PaleVioletRed = Color::RGB.new(0xdb, 0x70, 0x93)
|
162
|
+
PapayaWhip = Color::RGB.new(0xff, 0xef, 0xd5)
|
163
|
+
PeachPuff = Color::RGB.new(0xff, 0xda, 0xb9)
|
164
|
+
Peachpuff = PeachPuff
|
165
|
+
Peru = Color::RGB.new(0xcd, 0x85, 0x3f)
|
166
|
+
Pink = Color::RGB.new(0xff, 0xc0, 0xcb)
|
167
|
+
Plum = Color::RGB.new(0xdd, 0xa0, 0xdd)
|
168
|
+
PowderBlue = Color::RGB.new(0xb0, 0xe0, 0xe6)
|
169
|
+
Purple = Color::RGB.new(0x80, 0x00, 0x80)
|
170
|
+
Red = Color::RGB.new(0xff, 0x00, 0x00)
|
171
|
+
RosyBrown = Color::RGB.new(0xbc, 0x8f, 0x8f)
|
172
|
+
RoyalBlue = Color::RGB.new(0x41, 0x69, 0xe1)
|
173
|
+
SaddleBrown = Color::RGB.new(0x8b, 0x45, 0x13)
|
174
|
+
Salmon = Color::RGB.new(0xfa, 0x80, 0x72)
|
175
|
+
SandyBrown = Color::RGB.new(0xf4, 0xa4, 0x60)
|
176
|
+
SeaGreen = Color::RGB.new(0x2e, 0x8b, 0x57)
|
177
|
+
SeaShell = Color::RGB.new(0xff, 0xf5, 0xee)
|
178
|
+
Seashell = SeaShell
|
179
|
+
Sienna = Color::RGB.new(0xa0, 0x52, 0x2d)
|
180
|
+
Silver = Color::RGB.new(0xc0, 0xc0, 0xc0)
|
181
|
+
SkyBlue = Color::RGB.new(0x87, 0xce, 0xeb)
|
182
|
+
SlateBlue = Color::RGB.new(0x6a, 0x5a, 0xcd)
|
183
|
+
SlateGray = Color::RGB.new(0x70, 0x80, 0x90)
|
184
|
+
SlateGrey = SlateGray
|
185
|
+
Snow = Color::RGB.new(0xff, 0xfa, 0xfa)
|
186
|
+
SpringGreen = Color::RGB.new(0x00, 0xff, 0x7f)
|
187
|
+
SteelBlue = Color::RGB.new(0x46, 0x82, 0xb4)
|
188
|
+
Tan = Color::RGB.new(0xd2, 0xb4, 0x8c)
|
189
|
+
Teal = Color::RGB.new(0x00, 0x80, 0x80)
|
190
|
+
Thistle = Color::RGB.new(0xd8, 0xbf, 0xd8)
|
191
|
+
Tomato = Color::RGB.new(0xff, 0x63, 0x47)
|
192
|
+
Turquoise = Color::RGB.new(0x40, 0xe0, 0xd0)
|
193
|
+
Violet = Color::RGB.new(0xee, 0x82, 0xee)
|
194
|
+
VioletRed = Color::RGB.new(0xd0, 0x20, 0x90)
|
195
|
+
Wheat = Color::RGB.new(0xf5, 0xde, 0xb3)
|
196
|
+
White = Color::RGB.new(0xff, 0xff, 0xff)
|
197
|
+
WhiteSmoke = Color::RGB.new(0xf5, 0xf5, 0xf5)
|
198
|
+
Yellow = Color::RGB.new(0xff, 0xff, 0x00)
|
199
|
+
YellowGreen = Color::RGB.new(0x9a, 0xcd, 0x32)
|
200
|
+
|
201
|
+
AliceBlue.freeze
|
202
|
+
AntiqueWhite.freeze
|
203
|
+
Aqua.freeze
|
204
|
+
Aquamarine.freeze
|
205
|
+
Azure.freeze
|
206
|
+
Beige.freeze
|
207
|
+
Bisque.freeze
|
208
|
+
Black.freeze
|
209
|
+
BlanchedAlmond.freeze
|
210
|
+
Blue.freeze
|
211
|
+
BlueViolet.freeze
|
212
|
+
Brown.freeze
|
213
|
+
Burlywood.freeze
|
214
|
+
CadetBlue.freeze
|
215
|
+
Cayenne.freeze
|
216
|
+
Carnation.freeze
|
217
|
+
Chartreuse.freeze
|
218
|
+
Chocolate.freeze
|
219
|
+
Coral.freeze
|
220
|
+
CornflowerBlue.freeze
|
221
|
+
Cornsilk.freeze
|
222
|
+
Crimson.freeze
|
223
|
+
Cyan.freeze
|
224
|
+
DarkBlue.freeze
|
225
|
+
DarkCyan.freeze
|
226
|
+
DarkGoldenrod.freeze
|
227
|
+
DarkGray.freeze
|
228
|
+
DarkGreen.freeze
|
229
|
+
DarkKhaki.freeze
|
230
|
+
DarkMagenta.freeze
|
231
|
+
DarkoliveGreen.freeze
|
232
|
+
Darkorange.freeze
|
233
|
+
DarkOrchid.freeze
|
234
|
+
DarkRed.freeze
|
235
|
+
Darksalmon.freeze
|
236
|
+
DarkSeaGreen.freeze
|
237
|
+
DarkSlateBlue.freeze
|
238
|
+
DarkSlateGray.freeze
|
239
|
+
DarkTurquoise.freeze
|
240
|
+
DarkViolet.freeze
|
241
|
+
DeepPink.freeze
|
242
|
+
DeepSkyBlue.freeze
|
243
|
+
DimGray.freeze
|
244
|
+
DodgerBlue.freeze
|
245
|
+
Feldspar.freeze
|
246
|
+
Firebrick.freeze
|
247
|
+
FloralWhite.freeze
|
248
|
+
ForestGreen.freeze
|
249
|
+
Fuchsia.freeze
|
250
|
+
Gainsboro.freeze
|
251
|
+
GhostWhite.freeze
|
252
|
+
Gold.freeze
|
253
|
+
Goldenrod.freeze
|
254
|
+
Gray.freeze
|
255
|
+
Green.freeze
|
256
|
+
GreenYellow.freeze
|
257
|
+
Honeydew.freeze
|
258
|
+
HotPink.freeze
|
259
|
+
IndianRed.freeze
|
260
|
+
Indigo.freeze
|
261
|
+
Ivory.freeze
|
262
|
+
Khaki.freeze
|
263
|
+
Lavender.freeze
|
264
|
+
LavenderBlush.freeze
|
265
|
+
LawnGreen.freeze
|
266
|
+
LemonChiffon.freeze
|
267
|
+
LightBlue.freeze
|
268
|
+
LightCoral.freeze
|
269
|
+
LightCyan.freeze
|
270
|
+
LightGoldenrodYellow.freeze
|
271
|
+
LightGray.freeze
|
272
|
+
LightGreen.freeze
|
273
|
+
LightPink.freeze
|
274
|
+
Lightsalmon.freeze
|
275
|
+
LightSeaGreen.freeze
|
276
|
+
LightSkyBlue.freeze
|
277
|
+
LightSlateBlue.freeze
|
278
|
+
LightSlateGray.freeze
|
279
|
+
LightsteelBlue.freeze
|
280
|
+
LightYellow.freeze
|
281
|
+
Lime.freeze
|
282
|
+
LimeGreen.freeze
|
283
|
+
Linen.freeze
|
284
|
+
Magenta.freeze
|
285
|
+
Maroon.freeze
|
286
|
+
MediumAquamarine.freeze
|
287
|
+
MediumBlue.freeze
|
288
|
+
MediumOrchid.freeze
|
289
|
+
MediumPurple.freeze
|
290
|
+
MediumSeaGreen.freeze
|
291
|
+
MediumSlateBlue.freeze
|
292
|
+
MediumSpringGreen.freeze
|
293
|
+
MediumTurquoise.freeze
|
294
|
+
MediumVioletRed.freeze
|
295
|
+
MidnightBlue.freeze
|
296
|
+
MintCream.freeze
|
297
|
+
MistyRose.freeze
|
298
|
+
Moccasin.freeze
|
299
|
+
NavajoWhite.freeze
|
300
|
+
Navy.freeze
|
301
|
+
OldLace.freeze
|
302
|
+
Olive.freeze
|
303
|
+
Olivedrab.freeze
|
304
|
+
Orange.freeze
|
305
|
+
OrangeRed.freeze
|
306
|
+
Orchid.freeze
|
307
|
+
PaleGoldenrod.freeze
|
308
|
+
PaleGreen.freeze
|
309
|
+
PaleTurquoise.freeze
|
310
|
+
PaleVioletRed.freeze
|
311
|
+
PapayaWhip.freeze
|
312
|
+
Peachpuff.freeze
|
313
|
+
Peru.freeze
|
314
|
+
Pink.freeze
|
315
|
+
Plum.freeze
|
316
|
+
PowderBlue.freeze
|
317
|
+
Purple.freeze
|
318
|
+
Red.freeze
|
319
|
+
RosyBrown.freeze
|
320
|
+
RoyalBlue.freeze
|
321
|
+
SaddleBrown.freeze
|
322
|
+
Salmon.freeze
|
323
|
+
SandyBrown.freeze
|
324
|
+
SeaGreen.freeze
|
325
|
+
Seashell.freeze
|
326
|
+
Sienna.freeze
|
327
|
+
Silver.freeze
|
328
|
+
SkyBlue.freeze
|
329
|
+
SlateBlue.freeze
|
330
|
+
SlateGray.freeze
|
331
|
+
Snow.freeze
|
332
|
+
SpringGreen.freeze
|
333
|
+
SteelBlue.freeze
|
334
|
+
Tan.freeze
|
335
|
+
Teal.freeze
|
336
|
+
Thistle.freeze
|
337
|
+
Tomato.freeze
|
338
|
+
Turquoise.freeze
|
339
|
+
Violet.freeze
|
340
|
+
VioletRed.freeze
|
341
|
+
Wheat.freeze
|
342
|
+
White.freeze
|
343
|
+
WhiteSmoke.freeze
|
344
|
+
Yellow.freeze
|
345
|
+
YellowGreen.freeze
|
346
|
+
Gray10.freeze
|
347
|
+
Gray20.freeze
|
348
|
+
Gray30.freeze
|
349
|
+
Gray40.freeze
|
350
|
+
Gray50.freeze
|
351
|
+
Gray60.freeze
|
352
|
+
Gray70.freeze
|
353
|
+
Gray80.freeze
|
354
|
+
Gray90.freeze
|
355
|
+
end
|
@@ -0,0 +1,453 @@
|
|
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 RGB colour object.
|
14
|
+
class Color::RGB
|
15
|
+
# The format of a DeviceRGB colour for PDF. In color-tools 2.0 this will
|
16
|
+
# be removed from this package and added back as a modification by the
|
17
|
+
# PDF::Writer package.
|
18
|
+
PDF_FORMAT_STR = "%.3f %.3f %.3f %s"
|
19
|
+
|
20
|
+
class << self
|
21
|
+
# Creates an RGB colour object from percentages 0..100.
|
22
|
+
#
|
23
|
+
# Color::RGB.from_percentage(10, 20 30)
|
24
|
+
def from_percentage(r = 0, g = 0, b = 0)
|
25
|
+
from_fraction(r / 100.0, g / 100.0, b / 100.0)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Creates an RGB colour object from fractional values 0..1.
|
29
|
+
#
|
30
|
+
# Color::RGB.from_fraction(.3, .2, .1)
|
31
|
+
def from_fraction(r = 0.0, g = 0.0, b = 0.0)
|
32
|
+
colour = Color::RGB.new
|
33
|
+
colour.r = r
|
34
|
+
colour.g = g
|
35
|
+
colour.b = b
|
36
|
+
colour
|
37
|
+
end
|
38
|
+
|
39
|
+
# Creates an RGB colour object from an HTML colour descriptor (e.g.,
|
40
|
+
# <tt>"fed"</tt> or <tt>"#cabbed;"</tt>.
|
41
|
+
#
|
42
|
+
# Color::RGB.from_html("fed")
|
43
|
+
# Color::RGB.from_html("#fed")
|
44
|
+
# Color::RGB.from_html("#cabbed")
|
45
|
+
# Color::RGB.from_html("cabbed")
|
46
|
+
def from_html(html_colour)
|
47
|
+
html_colour = html_colour.gsub(%r{[#;]}, '')
|
48
|
+
case html_colour.size
|
49
|
+
when 3
|
50
|
+
colours = html_colour.scan(%r{[0-9A-Fa-f]}).map { |el| (el * 2).to_i(16) }
|
51
|
+
when 6
|
52
|
+
colours = html_colour.scan(%r<[0-9A-Fa-f]{2}>).map { |el| el.to_i(16) }
|
53
|
+
else
|
54
|
+
raise ArgumentError
|
55
|
+
end
|
56
|
+
|
57
|
+
Color::RGB.new(*colours)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Compares the other colour to this one. The other colour will be
|
62
|
+
# converted to RGB before comparison, so the comparison between a RGB
|
63
|
+
# colour and a non-RGB colour will be approximate and based on the other
|
64
|
+
# colour's default #to_rgb conversion. If there is no #to_rgb conversion,
|
65
|
+
# this will raise an exception. This will report that two RGB colours are
|
66
|
+
# equivalent if all component values are within COLOR_TOLERANCE of each
|
67
|
+
# other.
|
68
|
+
def ==(other)
|
69
|
+
other = other.to_rgb
|
70
|
+
other.kind_of?(Color::RGB) and
|
71
|
+
((@r - other.r).abs <= Color::COLOR_TOLERANCE) and
|
72
|
+
((@g - other.g).abs <= Color::COLOR_TOLERANCE) and
|
73
|
+
((@b - other.b).abs <= Color::COLOR_TOLERANCE)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Creates an RGB colour object from the standard range 0..255.
|
77
|
+
#
|
78
|
+
# Color::RGB.new(32, 64, 128)
|
79
|
+
# Color::RGB.new(0x20, 0x40, 0x80)
|
80
|
+
def initialize(r = 0, g = 0, b = 0)
|
81
|
+
@r = r / 255.0
|
82
|
+
@g = g / 255.0
|
83
|
+
@b = b / 255.0
|
84
|
+
end
|
85
|
+
|
86
|
+
# Present the colour as a DeviceRGB fill colour string for PDF. This will
|
87
|
+
# be removed from the default package in color-tools 2.0.
|
88
|
+
def pdf_fill
|
89
|
+
PDF_FORMAT_STR % [ @r, @g, @b, "rg" ]
|
90
|
+
end
|
91
|
+
|
92
|
+
# Present the colour as a DeviceRGB stroke colour string for PDF. This
|
93
|
+
# will be removed from the default package in color-tools 2.0.
|
94
|
+
def pdf_stroke
|
95
|
+
PDF_FORMAT_STR % [ @r, @g, @b, "RG" ]
|
96
|
+
end
|
97
|
+
|
98
|
+
# Present the colour as an HTML/CSS colour string.
|
99
|
+
def html
|
100
|
+
r = (@r * 255).round
|
101
|
+
r = 255 if r > 255
|
102
|
+
|
103
|
+
g = (@g * 255).round
|
104
|
+
g = 255 if g > 255
|
105
|
+
|
106
|
+
b = (@b * 255).round
|
107
|
+
b = 255 if b > 255
|
108
|
+
|
109
|
+
"#%02x%02x%02x" % [ r, g, b ]
|
110
|
+
end
|
111
|
+
|
112
|
+
# Present the colour as an RGB HTML/CSS colour string (e.g., "rgb(0%, 50%,
|
113
|
+
# 100%)"). Note that this will perform a #to_rgb operation using the
|
114
|
+
# default conversion formula.
|
115
|
+
def css_rgb
|
116
|
+
"rgb(%3.2f%%, %3.2f%%, %3.2f%%)" % [ red_p, green_p, blue_p ]
|
117
|
+
end
|
118
|
+
|
119
|
+
# Present the colour as an RGBA (with alpha) HTML/CSS colour string (e.g.,
|
120
|
+
# "rgb(0%, 50%, 100%, 1)"). Note that this will perform a #to_rgb
|
121
|
+
# operation using the default conversion formula.
|
122
|
+
def css_rgba
|
123
|
+
"rgba(%3.2f%%, %3.2f%%, %3.2f%%, %3.2f)" % [ red_p, green_p, blue_p, 1 ]
|
124
|
+
end
|
125
|
+
|
126
|
+
# Present the colour as an HSL HTML/CSS colour string (e.g., "hsl(180,
|
127
|
+
# 25%, 35%)"). Note that this will perform a #to_hsl operation using the
|
128
|
+
# default conversion formula.
|
129
|
+
def css_hsl
|
130
|
+
to_hsl.css_hsl
|
131
|
+
end
|
132
|
+
|
133
|
+
# Present the colour as an HSLA (with alpha) HTML/CSS colour string (e.g.,
|
134
|
+
# "hsla(180, 25%, 35%, 1)"). Note that this will perform a #to_hsl
|
135
|
+
# operation using the default conversion formula.
|
136
|
+
def css_hsla
|
137
|
+
to_hsl.css_hsla
|
138
|
+
end
|
139
|
+
|
140
|
+
# Converts the RGB colour to CMYK. Most colour experts strongly suggest
|
141
|
+
# that this is not a good idea (some even suggesting that it's a very bad
|
142
|
+
# idea). CMYK represents additive percentages of inks on white paper,
|
143
|
+
# whereas RGB represents mixed colour intensities on a black screen.
|
144
|
+
#
|
145
|
+
# However, the colour conversion can be done. The basic method is
|
146
|
+
# multi-step:
|
147
|
+
#
|
148
|
+
# 1. Convert the R, G, and B components to C, M, and Y components.
|
149
|
+
# c = 1.0 - r
|
150
|
+
# m = 1.0 - g
|
151
|
+
# y = 1.0 - b
|
152
|
+
# 2. Compute the minimum amount of black (K) required to smooth the colour
|
153
|
+
# in inks.
|
154
|
+
# k = min(c, m, y)
|
155
|
+
# 3. Perform undercolour removal on the C, M, and Y components of the
|
156
|
+
# colours because less of each colour is needed for each bit of black.
|
157
|
+
# Also, regenerate the black (K) based on the undercolour removal so
|
158
|
+
# that the colour is more accurately represented in ink.
|
159
|
+
# c = min(1.0, max(0.0, c - UCR(k)))
|
160
|
+
# m = min(1.0, max(0.0, m - UCR(k)))
|
161
|
+
# y = min(1.0, max(0.0, y - UCR(k)))
|
162
|
+
# k = min(1.0, max(0.0, BG(k)))
|
163
|
+
#
|
164
|
+
# The undercolour removal function and the black generation functions
|
165
|
+
# return a value based on the brightness of the RGB colour.
|
166
|
+
def to_cmyk
|
167
|
+
c = 1.0 - @r.to_f
|
168
|
+
m = 1.0 - @g.to_f
|
169
|
+
y = 1.0 - @b.to_f
|
170
|
+
|
171
|
+
k = [c, m, y].min
|
172
|
+
k = k - (k * brightness)
|
173
|
+
|
174
|
+
c = [1.0, [0.0, c - k].max].min
|
175
|
+
m = [1.0, [0.0, m - k].max].min
|
176
|
+
y = [1.0, [0.0, y - k].max].min
|
177
|
+
k = [1.0, [0.0, k].max].min
|
178
|
+
|
179
|
+
Color::CMYK.from_fraction(c, m, y, k)
|
180
|
+
end
|
181
|
+
|
182
|
+
def to_rgb(ignored = nil)
|
183
|
+
self
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the YIQ (NTSC) colour encoding of the RGB value.
|
187
|
+
def to_yiq
|
188
|
+
y = (@r * 0.299) + (@g * 0.587) + (@b * 0.114)
|
189
|
+
i = (@r * 0.596) + (@g * -0.275) + (@b * -0.321)
|
190
|
+
q = (@r * 0.212) + (@g * -0.523) + (@b * 0.311)
|
191
|
+
Color::YIQ.from_fraction(y, i, q)
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the HSL colour encoding of the RGB value. The conversions here
|
195
|
+
# are based on forumlas from http://www.easyrgb.com/math.php and
|
196
|
+
# elsewhere.
|
197
|
+
def to_hsl
|
198
|
+
min = [ @r, @g, @b ].min
|
199
|
+
max = [ @r, @g, @b ].max
|
200
|
+
delta = (max - min).to_f
|
201
|
+
|
202
|
+
lum = (max + min) / 2.0
|
203
|
+
|
204
|
+
if Color.near_zero?(delta) # close to 0.0, so it's a grey
|
205
|
+
hue = 0
|
206
|
+
sat = 0
|
207
|
+
else
|
208
|
+
if Color.near_zero_or_less?(lum - 0.5)
|
209
|
+
sat = delta / (max + min).to_f
|
210
|
+
else
|
211
|
+
sat = delta / (2 - max - min).to_f
|
212
|
+
end
|
213
|
+
|
214
|
+
# This is based on the conversion algorithm from
|
215
|
+
# http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_RGB_to_HSL_or_HSV
|
216
|
+
# Contributed by Adam Johnson
|
217
|
+
sixth = 1 / 6.0
|
218
|
+
if @r == max # Color.near_zero_or_less?(@r - max)
|
219
|
+
hue = (sixth * ((@g - @b) / delta))
|
220
|
+
hue += 1.0 if @g < @b
|
221
|
+
elsif @g == max # Color.near_zero_or_less(@g - max)
|
222
|
+
hue = (sixth * ((@b - @r) / delta)) + (1.0 / 3.0)
|
223
|
+
elsif @b == max # Color.near_zero_or_less?(@b - max)
|
224
|
+
hue = (sixth * ((@r - @g) / delta)) + (2.0 / 3.0)
|
225
|
+
end
|
226
|
+
|
227
|
+
hue += 1 if hue < 0
|
228
|
+
hue -= 1 if hue > 1
|
229
|
+
end
|
230
|
+
Color::HSL.from_fraction(hue, sat, lum)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Mix the RGB hue with White so that the RGB hue is the specified
|
234
|
+
# percentage of the resulting colour. Strictly speaking, this isn't a
|
235
|
+
# darken_by operation.
|
236
|
+
def lighten_by(percent)
|
237
|
+
mix_with(White, percent)
|
238
|
+
end
|
239
|
+
|
240
|
+
# Mix the RGB hue with Black so that the RGB hue is the specified
|
241
|
+
# percentage of the resulting colour. Strictly speaking, this isn't a
|
242
|
+
# darken_by operation.
|
243
|
+
def darken_by(percent)
|
244
|
+
mix_with(Black, percent)
|
245
|
+
end
|
246
|
+
|
247
|
+
# Mix the mask colour (which must be an RGB object) with the current
|
248
|
+
# colour at the stated opacity percentage (0..100).
|
249
|
+
def mix_with(mask, opacity)
|
250
|
+
opacity /= 100.0
|
251
|
+
rgb = self.dup
|
252
|
+
|
253
|
+
rgb.r = (@r * opacity) + (mask.r * (1 - opacity))
|
254
|
+
rgb.g = (@g * opacity) + (mask.g * (1 - opacity))
|
255
|
+
rgb.b = (@b * opacity) + (mask.b * (1 - opacity))
|
256
|
+
|
257
|
+
rgb
|
258
|
+
end
|
259
|
+
|
260
|
+
# Returns the brightness value for a colour, a number between 0..1. Based
|
261
|
+
# on the Y value of YIQ encoding, representing luminosity, or perceived
|
262
|
+
# brightness.
|
263
|
+
#
|
264
|
+
# This may be modified in a future version of color-tools to use the
|
265
|
+
# luminosity value of HSL.
|
266
|
+
def brightness
|
267
|
+
to_yiq.y
|
268
|
+
end
|
269
|
+
# Convert to grayscale.
|
270
|
+
def to_grayscale
|
271
|
+
Color::GrayScale.from_fraction(to_hsl.l)
|
272
|
+
end
|
273
|
+
alias to_greyscale to_grayscale
|
274
|
+
|
275
|
+
# Returns a new colour with the brightness adjusted by the specified
|
276
|
+
# percentage. Negative percentages will darken the colour; positive
|
277
|
+
# percentages will brighten the colour.
|
278
|
+
#
|
279
|
+
# Color::RGB::DarkBlue.adjust_brightness(10)
|
280
|
+
# Color::RGB::DarkBlue.adjust_brightness(-10)
|
281
|
+
def adjust_brightness(percent)
|
282
|
+
percent /= 100.0
|
283
|
+
percent += 1.0
|
284
|
+
percent = [ percent, 2.0 ].min
|
285
|
+
percent = [ 0.0, percent ].max
|
286
|
+
|
287
|
+
hsl = to_hsl
|
288
|
+
hsl.l *= percent
|
289
|
+
hsl.to_rgb
|
290
|
+
end
|
291
|
+
|
292
|
+
# Returns a new colour with the saturation adjusted by the specified
|
293
|
+
# percentage. Negative percentages will reduce the saturation; positive
|
294
|
+
# percentages will increase the saturation.
|
295
|
+
#
|
296
|
+
# Color::RGB::DarkBlue.adjust_saturation(10)
|
297
|
+
# Color::RGB::DarkBlue.adjust_saturation(-10)
|
298
|
+
def adjust_saturation(percent)
|
299
|
+
percent /= 100.0
|
300
|
+
percent += 1.0
|
301
|
+
percent = [ percent, 2.0 ].min
|
302
|
+
percent = [ 0.0, percent ].max
|
303
|
+
|
304
|
+
hsl = to_hsl
|
305
|
+
hsl.s *= percent
|
306
|
+
hsl.to_rgb
|
307
|
+
end
|
308
|
+
|
309
|
+
# Returns a new colour with the hue adjusted by the specified percentage.
|
310
|
+
# Negative percentages will reduce the hue; positive percentages will
|
311
|
+
# increase the hue.
|
312
|
+
#
|
313
|
+
# Color::RGB::DarkBlue.adjust_hue(10)
|
314
|
+
# Color::RGB::DarkBlue.adjust_hue(-10)
|
315
|
+
def adjust_hue(percent)
|
316
|
+
percent /= 100.0
|
317
|
+
percent += 1.0
|
318
|
+
percent = [ percent, 2.0 ].min
|
319
|
+
percent = [ 0.0, percent ].max
|
320
|
+
|
321
|
+
hsl = to_hsl
|
322
|
+
hsl.h *= percent
|
323
|
+
hsl.to_rgb
|
324
|
+
end
|
325
|
+
|
326
|
+
# Returns the red component of the colour in the normal 0 .. 255 range.
|
327
|
+
def red
|
328
|
+
@r * 255.0
|
329
|
+
end
|
330
|
+
# Returns the red component of the colour as a percentage.
|
331
|
+
def red_p
|
332
|
+
@r * 100.0
|
333
|
+
end
|
334
|
+
# Returns the red component of the colour as a fraction in the range 0.0
|
335
|
+
# .. 1.0.
|
336
|
+
def r
|
337
|
+
@r
|
338
|
+
end
|
339
|
+
# Sets the red component of the colour in the normal 0 .. 255 range.
|
340
|
+
def red=(rr)
|
341
|
+
@r = Color.normalize(rr / 255.0)
|
342
|
+
end
|
343
|
+
# Sets the red component of the colour as a percentage.
|
344
|
+
def red_p=(rr)
|
345
|
+
@r = Color.normalize(rr / 100.0)
|
346
|
+
end
|
347
|
+
# Sets the red component of the colour as a fraction in the range 0.0 ..
|
348
|
+
# 1.0.
|
349
|
+
def r=(rr)
|
350
|
+
@r = Color.normalize(rr)
|
351
|
+
end
|
352
|
+
|
353
|
+
# Returns the green component of the colour in the normal 0 .. 255 range.
|
354
|
+
def green
|
355
|
+
@g * 255.0
|
356
|
+
end
|
357
|
+
# Returns the green component of the colour as a percentage.
|
358
|
+
def green_p
|
359
|
+
@g * 100.0
|
360
|
+
end
|
361
|
+
# Returns the green component of the colour as a fraction in the range 0.0
|
362
|
+
# .. 1.0.
|
363
|
+
def g
|
364
|
+
@g
|
365
|
+
end
|
366
|
+
# Sets the green component of the colour in the normal 0 .. 255 range.
|
367
|
+
def green=(gg)
|
368
|
+
@g = Color.normalize(gg / 255.0)
|
369
|
+
end
|
370
|
+
# Sets the green component of the colour as a percentage.
|
371
|
+
def green_p=(gg)
|
372
|
+
@g = Color.normalize(gg / 100.0)
|
373
|
+
end
|
374
|
+
# Sets the green component of the colour as a fraction in the range 0.0 ..
|
375
|
+
# 1.0.
|
376
|
+
def g=(gg)
|
377
|
+
@g = Color.normalize(gg)
|
378
|
+
end
|
379
|
+
|
380
|
+
# Returns the blue component of the colour in the normal 0 .. 255 range.
|
381
|
+
def blue
|
382
|
+
@b * 255.0
|
383
|
+
end
|
384
|
+
# Returns the blue component of the colour as a percentage.
|
385
|
+
def blue_p
|
386
|
+
@b * 100.0
|
387
|
+
end
|
388
|
+
# Returns the blue component of the colour as a fraction in the range 0.0
|
389
|
+
# .. 1.0.
|
390
|
+
def b
|
391
|
+
@b
|
392
|
+
end
|
393
|
+
# Sets the blue component of the colour in the normal 0 .. 255 range.
|
394
|
+
def blue=(bb)
|
395
|
+
@b = Color.normalize(bb / 255.0)
|
396
|
+
end
|
397
|
+
# Sets the blue component of the colour as a percentage.
|
398
|
+
def blue_p=(bb)
|
399
|
+
@b = Color.normalize(bb / 100.0)
|
400
|
+
end
|
401
|
+
# Sets the blue component of the colour as a fraction in the range 0.0 ..
|
402
|
+
# 1.0.
|
403
|
+
def b=(bb)
|
404
|
+
@b = Color.normalize(bb)
|
405
|
+
end
|
406
|
+
|
407
|
+
# Adds another colour to the current colour. The other colour will be
|
408
|
+
# converted to RGB before addition. This conversion depends upon a #to_rgb
|
409
|
+
# method on the other colour.
|
410
|
+
#
|
411
|
+
# The addition is done using the RGB Accessor methods to ensure a valid
|
412
|
+
# colour in the result.
|
413
|
+
def +(other)
|
414
|
+
other = other.to_rgb
|
415
|
+
rgb = self.dup
|
416
|
+
|
417
|
+
rgb.r += other.r
|
418
|
+
rgb.g += other.g
|
419
|
+
rgb.b += other.b
|
420
|
+
|
421
|
+
rgb
|
422
|
+
end
|
423
|
+
|
424
|
+
# Subtracts another colour to the current colour. The other colour will be
|
425
|
+
# converted to RGB before subtraction. This conversion depends upon a
|
426
|
+
# #to_rgb method on the other colour.
|
427
|
+
#
|
428
|
+
# The subtraction is done using the RGB Accessor methods to ensure a valid
|
429
|
+
# colour in the result.
|
430
|
+
def -(other)
|
431
|
+
other = other.to_rgb
|
432
|
+
rgb = self.dup
|
433
|
+
|
434
|
+
rgb.r -= other.r
|
435
|
+
rgb.g -= other.g
|
436
|
+
rgb.b -= other.b
|
437
|
+
|
438
|
+
rgb
|
439
|
+
end
|
440
|
+
|
441
|
+
# Retrieve the maxmum RGB value from the current colour as a GrayScale
|
442
|
+
# colour
|
443
|
+
def max_rgb_as_grayscale
|
444
|
+
Color::GrayScale.from_fraction([@r, @g, @b].max)
|
445
|
+
end
|
446
|
+
alias max_rgb_as_greyscale max_rgb_as_grayscale
|
447
|
+
|
448
|
+
def inspect
|
449
|
+
"RGB [#{html}]"
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
require 'color/rgb-colors'
|