asposeimagingjava 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/asposeimagingjava.gemspec +27 -0
- data/config/aspose.yml +5 -0
- data/data/aspose.bmp +0 -0
- data/data/bizcard.psd +0 -0
- data/data/demo.djvu +0 -0
- data/data/demo.tif +0 -0
- data/data/multipage.tiff +0 -0
- data/data/sample.djvu +0 -0
- data/data/sample.emf +0 -0
- data/data/sample.gif +0 -0
- data/data/sample.jpg +0 -0
- data/data/sample.png +0 -0
- data/data/sample.tiff +0 -0
- data/data/samples/sample.jpg +0 -0
- data/data/samples/test.jpg +0 -0
- data/data/test.jpg +0 -0
- data/data/test.tiff +0 -0
- data/lib/asposeimagingjava.rb +71 -0
- data/lib/asposeimagingjava/asposeimaging.rb +5 -0
- data/lib/asposeimagingjava/djvu.rb +5 -0
- data/lib/asposeimagingjava/djvu/convertingdjvutopdf.rb +29 -0
- data/lib/asposeimagingjava/djvu/convertingdjvutotiff.rb +23 -0
- data/lib/asposeimagingjava/djvu/convertingrangeofdjvupages.rb +26 -0
- data/lib/asposeimagingjava/djvu/convertingrangeofdjvupagestoseparateimages.rb +30 -0
- data/lib/asposeimagingjava/djvu/convertingspecificportionofdjvupage.rb +32 -0
- data/lib/asposeimagingjava/drawing.rb +6 -0
- data/lib/asposeimagingjava/drawing/drawingarc.rb +37 -0
- data/lib/asposeimagingjava/drawing/drawingellipse.rb +43 -0
- data/lib/asposeimagingjava/drawing/drawingimagesusingcorefunctionality.rb +33 -0
- data/lib/asposeimagingjava/drawing/drawingimagesusinggraphics.rb +34 -0
- data/lib/asposeimagingjava/drawing/drawinglines.rb +53 -0
- data/lib/asposeimagingjava/drawing/drawingrectangle.rb +44 -0
- data/lib/asposeimagingjava/images.rb +20 -0
- data/lib/asposeimagingjava/images/addimagesasseparateframesintiff.rb +57 -0
- data/lib/asposeimagingjava/images/addthumbnailtoexifsegment.rb +25 -0
- data/lib/asposeimagingjava/images/addthumbnailtojfifsegment.rb +25 -0
- data/lib/asposeimagingjava/images/addwatermarktoimage.rb +30 -0
- data/lib/asposeimagingjava/images/adjustingcolors.rb +80 -0
- data/lib/asposeimagingjava/images/autocorrectorientationofjpegimage.rb +19 -0
- data/lib/asposeimagingjava/images/compresspngimage.rb +22 -0
- data/lib/asposeimagingjava/images/concatenatemultipletiffimages.rb +24 -0
- data/lib/asposeimagingjava/images/convertingrasterimages.rb +80 -0
- data/lib/asposeimagingjava/images/createjpegthumbnail.rb +21 -0
- data/lib/asposeimagingjava/images/cropimages.rb +63 -0
- data/lib/asposeimagingjava/images/datarecoverytiffimages.rb +21 -0
- data/lib/asposeimagingjava/images/ditheringimage.rb +19 -0
- data/lib/asposeimagingjava/images/exportimagetodifferentformats.rb +24 -0
- data/lib/asposeimagingjava/images/extracttiffframestootherformat.rb +19 -0
- data/lib/asposeimagingjava/images/readandmodifyjpegexiftags.rb +91 -0
- data/lib/asposeimagingjava/images/resizeimage.rb +63 -0
- data/lib/asposeimagingjava/images/rotateandflipimage.rb +18 -0
- data/lib/asposeimagingjava/images/specifybitdepthforpngimage.rb +25 -0
- data/lib/asposeimagingjava/images/specifytransparencyforpngimage.rb +32 -0
- data/lib/asposeimagingjava/metafiles.rb +2 -0
- data/lib/asposeimagingjava/metafiles/convertmetafiletootherformats.rb +28 -0
- data/lib/asposeimagingjava/metafiles/cropmetafile.rb +22 -0
- data/lib/asposeimagingjava/photoshop/createpsd.rb +42 -0
- data/lib/asposeimagingjava/photoshop/exportimagetopsd.rb +26 -0
- data/lib/asposeimagingjava/psd.rb +2 -0
- data/lib/asposeimagingjava/version.rb +3 -0
- data/samples/djvu.rb +13 -0
- data/samples/drawing.rb +14 -0
- data/samples/images.rb +29 -0
- data/samples/metafiles.rb +10 -0
- data/samples/psd.rb +10 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57084ad98fddfd7e4318607de26f48a3967cbb65
|
4
|
+
data.tar.gz: 398e69ddda908a7acb5e744df57c3f1ceb84b40e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bcc85cb440423984c3c06f44306214b490cbb9abf4e188076e2055f37559d7fc4240d68a35d0b1c5de62182f4c1d9f521fc7fdcc11ee79fda55177de4b715521
|
7
|
+
data.tar.gz: 8ffec2ba94488d5ad2ada87fde0561109a8cf4205d836adfdd13cedf1c48d132b481664c4ba00461d8e6c3391b3b6932500cca4ebe89d52cf697c69a40e719a1
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2001-2015 Aspose Pty Ltd
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Aspose_Imaging_Java_for_Ruby
|
2
|
+
Aspose.Imaging Java for Ruby is a Ruby gem that demonstrates / provides the Aspose.Imaging for Java API usage examples in Ruby by using Rjb - Ruby Java Bridge.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Execute following command.
|
7
|
+
|
8
|
+
$ gem install asposeimagingjava
|
9
|
+
|
10
|
+
To download Aspose.Imaging for Java API to be used with these examples through RJB, Please navigate to:
|
11
|
+
|
12
|
+
http://www.aspose.com/community/files/72/java-components/aspose.imaging-for-java/default.aspx
|
13
|
+
|
14
|
+
Note: Create jars folder at root of the gem folder and copy downloaded Aspose.Imaging for java component into it.
|
15
|
+
|
16
|
+
For most complete documentation of the project, check Aspose.OCR Java for Ruby confluence wiki link:
|
17
|
+
|
18
|
+
http://www.aspose.com/docs/display/imagingjava/1.+Aspose.Imaging+Java+For+Ruby
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
You can export image to different formats using following example code.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require File.dirname(File.dirname(File.dirname(__FILE__))) + '/lib/asposeimagingjava'
|
26
|
+
include Asposeimagingjava
|
27
|
+
include Asposeimagingjava::ExportImageToDifferentFormats
|
28
|
+
initialize_aspose_imaging
|
29
|
+
```
|
30
|
+
Lets understand the above code
|
31
|
+
* The first line makes sure that the Aspose.Imaging is loaded and available
|
32
|
+
* Include the files that are required to access the Aspose.Imaging
|
33
|
+
* Initialize the libraries. The aspose JAVA classes are loaded from the path provided in the aspose.yml file
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'asposeimagingjava/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'asposeimagingjava'
|
8
|
+
spec.version = Asposeimagingjava::VERSION
|
9
|
+
spec.authors = ['Aspose Marketplace']
|
10
|
+
spec.email = ['marketplace@aspose.com']
|
11
|
+
spec.summary = %q{A Ruby gem to work with Aspose.Imaging for Java libraries}
|
12
|
+
spec.description = %q{AsposeImagingJava is a Ruby gem that helps developers create, edit, draw or convert images using Aspose.Imaging for Java libraries}
|
13
|
+
spec.homepage = 'https://github.com/asposeimaging/Aspose_Imaging_Java/tree/master/Plugins/Aspose_Imaging_Java_for_Ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
|
25
|
+
spec.add_dependency 'rjb', '~> 1.5.2'
|
26
|
+
|
27
|
+
end
|
data/config/aspose.yml
ADDED
data/data/aspose.bmp
ADDED
Binary file
|
data/data/bizcard.psd
ADDED
Binary file
|
data/data/demo.djvu
ADDED
Binary file
|
data/data/demo.tif
ADDED
Binary file
|
data/data/multipage.tiff
ADDED
Binary file
|
data/data/sample.djvu
ADDED
Binary file
|
data/data/sample.emf
ADDED
Binary file
|
data/data/sample.gif
ADDED
Binary file
|
data/data/sample.jpg
ADDED
Binary file
|
data/data/sample.png
ADDED
Binary file
|
data/data/sample.tiff
ADDED
Binary file
|
Binary file
|
Binary file
|
data/data/test.jpg
ADDED
Binary file
|
data/data/test.tiff
ADDED
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative 'asposeimagingjava/version'
|
2
|
+
require_relative 'asposeimagingjava/asposeimaging'
|
3
|
+
require 'logger'
|
4
|
+
require 'rjb'
|
5
|
+
|
6
|
+
module Asposeimagingjava
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :aspose_imaging_config
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize_aspose_imaging
|
13
|
+
aspose_jars_dir = Asposeimagingjava.aspose_imaging_config ? Asposeimagingjava.aspose_imaging_config['jar_dir'] : nil
|
14
|
+
aspose_license_path = Asposeimagingjava.aspose_imaging_config ? Asposeimagingjava.aspose_imaging_config['license_path'] : nil
|
15
|
+
jvm_args = Asposeimagingjava.aspose_imaging_config ? Asposeimagingjava.aspose_imaging_config['jvm_args'] : nil
|
16
|
+
|
17
|
+
load_aspose_jars(aspose_jars_dir, jvm_args)
|
18
|
+
load_aspose_license(aspose_license_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def load_aspose_license(aspose_license_path)
|
22
|
+
if aspose_license_path && File.exist?(aspose_license_path)
|
23
|
+
set_license(File.join(aspose_license_path))
|
24
|
+
else
|
25
|
+
logger = Logger.new(STDOUT)
|
26
|
+
logger.level = Logger::WARN
|
27
|
+
logger.warn('Using the non licensed aspose jar. Please specify path to your aspose license directory in config/aspose.yml file!')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_aspose_jars(aspose_jars_dir, jvm_args)
|
32
|
+
if aspose_jars_dir && File.exist?(aspose_jars_dir)
|
33
|
+
jardir = File.join(aspose_jars_dir, '**', '*.jar')
|
34
|
+
else
|
35
|
+
jardir = File.join(File.dirname(File.dirname(__FILE__)), 'jars', '**', '*.jar')
|
36
|
+
end
|
37
|
+
|
38
|
+
if jvm_args
|
39
|
+
args = jvm_args.split(' ') << '-Djava.awt.headless=true'
|
40
|
+
logger = Logger.new(STDOUT)
|
41
|
+
logger.level = Logger::DEBUG
|
42
|
+
logger.debug("JVM args : #{args}")
|
43
|
+
Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=args)
|
44
|
+
else
|
45
|
+
Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=['-Djava.awt.headless=true'])
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def input_file(file)
|
51
|
+
Rjb::import('java.io.FileInputStream').new(file)
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_license(aspose_license_file)
|
55
|
+
begin
|
56
|
+
fstream = input_file(aspose_license_file)
|
57
|
+
license = Rjb::import('com.aspose.api.License').new()
|
58
|
+
license.setLicense(fstream)
|
59
|
+
rescue Exception => ex
|
60
|
+
logger = Logger.new(STDOUT)
|
61
|
+
logger.level = Logger::ERROR
|
62
|
+
logger.error("Could not load the license file : #{ex}")
|
63
|
+
fstream.close() if fstream
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.configure_aspose_imaging config
|
68
|
+
Asposeimagingjava.aspose_imaging_config = config
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
require_relative 'djvu/convertingdjvutopdf'
|
2
|
+
require_relative 'djvu/convertingdjvutotiff'
|
3
|
+
require_relative 'djvu/convertingrangeofdjvupages'
|
4
|
+
require_relative 'djvu/convertingrangeofdjvupagestoseparateimages'
|
5
|
+
require_relative 'djvu/convertingspecificportionofdjvupage'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module ConvertingDjVuToPdf
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Load an existing image (of type bmp) in an instance of Image class
|
7
|
+
image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "demo.djvu")
|
8
|
+
|
9
|
+
# Create an instance of PdfOptions
|
10
|
+
export_options = Rjb::import('com.aspose.imaging.imageoptions.PdfOptions').new
|
11
|
+
|
12
|
+
# Initialize the metadata for Pdf document
|
13
|
+
export_options.setPdfDocumentInfo(Rjb::import('com.aspose.imaging.fileformats.pdf.PdfDocumentInfo').new)
|
14
|
+
|
15
|
+
# Create an instance of IntRange and initialize it with the range of DjVu pages to be exported
|
16
|
+
#range = Rjb::import('com.aspose.imaging.IntRange').new(0, 5) # Export first 5 pages
|
17
|
+
range = Array[0,1,2,3,4]
|
18
|
+
|
19
|
+
# Initialize an instance of DjvuMultiPageOptions with range of DjVu pages to be exported
|
20
|
+
export_options.setMultiPageOptions(Rjb::import('com.aspose.imaging.imageoptions.DjvuMultiPageOptions').new(range))
|
21
|
+
|
22
|
+
# Save the result in PDF format
|
23
|
+
image.save(data_dir + "djvu.pdf", export_options)
|
24
|
+
|
25
|
+
# Display Status.
|
26
|
+
puts "Converted DjVu to PDF successfully!"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module ConvertingDjVuToTiff
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Load an existing image (of type bmp) in an instance of Image class
|
7
|
+
image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "demo.djvu")
|
8
|
+
|
9
|
+
# Create an instance of TiffOptions & use preset options for Black n While with Deflate compression
|
10
|
+
tiff_expected_format = Rjb::import('com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat')
|
11
|
+
export_options = Rjb::import('com.aspose.imaging.imageoptions.TiffOptions').new(tiff_expected_format.TiffDeflateBW)
|
12
|
+
|
13
|
+
# Initialize an instance of DjvuMultiPageOptions
|
14
|
+
export_options.setMultiPageOptions(Rjb::import('com.aspose.imaging.imageoptions.DjvuMultiPageOptions').new)
|
15
|
+
|
16
|
+
# Save the result in PDF format
|
17
|
+
image.save(data_dir + "djvu.tiff", export_options)
|
18
|
+
|
19
|
+
# Display Status.
|
20
|
+
puts "Converted DjVu to Tiff successfully!"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module ConvertingRangeOfDjVuPages
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Load an existing image (of type bmp) in an instance of Image class
|
7
|
+
image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "demo.djvu")
|
8
|
+
|
9
|
+
# Create an instance of TiffOptions & use preset options for Black n While with Deflate compression
|
10
|
+
tiff_expected_format = Rjb::import('com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat')
|
11
|
+
export_options = Rjb::import('com.aspose.imaging.imageoptions.TiffOptions').new(tiff_expected_format.TiffDeflateBW)
|
12
|
+
|
13
|
+
# Create an instance of IntRange and initialize it with range of pages to be exported
|
14
|
+
range = [0, 1] #Export first 2 pages
|
15
|
+
|
16
|
+
# Initialize an instance of DjvuMultiPageOptions
|
17
|
+
export_options.setMultiPageOptions(Rjb::import('com.aspose.imaging.imageoptions.DjvuMultiPageOptions').new(range))
|
18
|
+
|
19
|
+
# Save the result in PDF format
|
20
|
+
image.save(data_dir + "PagesRange.tiff", export_options)
|
21
|
+
|
22
|
+
# Display Status.
|
23
|
+
puts "Converted range of DjVu pages successfully!"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module ConvertingRangeOfDjVuPagesToSeparateImages
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Load an existing image (of type bmp) in an instance of Image class
|
7
|
+
image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "demo.djvu")
|
8
|
+
|
9
|
+
# Create an instance of BmpOptions
|
10
|
+
export_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
|
11
|
+
|
12
|
+
# Set BitsPerPixel for resultant images
|
13
|
+
export_options.setBitsPerPixel(32)
|
14
|
+
|
15
|
+
# Create an instance of IntRange and initialize it with range of pages to be exported
|
16
|
+
range = [0, 1] #Export first 2 pages
|
17
|
+
|
18
|
+
i = 0
|
19
|
+
while i < 2
|
20
|
+
# Save each page in separate file, as BMP do not support layering
|
21
|
+
export_options.setMultiPageOptions(Rjb::import('com.aspose.imaging.imageoptions.DjvuMultiPageOptions').new(i))
|
22
|
+
image.save(data_dir + "djvupages#{i}.bmp", export_options)
|
23
|
+
i +=1
|
24
|
+
end
|
25
|
+
|
26
|
+
# Display Status.
|
27
|
+
puts "Converted range of DjVu pages to separate images successfully!"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module ConvertingSpecificPortionOfDjvuPage
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Load an existing image (of type bmp) in an instance of Image class
|
7
|
+
image = Rjb::import('com.aspose.imaging.Image').load(data_dir + "demo.djvu")
|
8
|
+
|
9
|
+
# Create an instance of PngOptions
|
10
|
+
export_options = Rjb::import('com.aspose.imaging.imageoptions.PngOptions').new
|
11
|
+
|
12
|
+
# Set ColorType to Grayscale
|
13
|
+
export_options.setColorType(Rjb::import('com.aspose.imaging.fileformats.png.PngColorType').Grayscale)
|
14
|
+
|
15
|
+
# Create an instance of Rectangle and specify the portion on DjVu page
|
16
|
+
export_area = Rjb::import('com.aspose.imaging.Rectangle').new(20, 20, 500, 500)
|
17
|
+
|
18
|
+
# Specify the DjVu page index
|
19
|
+
export_page_index = 2
|
20
|
+
|
21
|
+
# Initialize an instance of DjvuMultiPageOptions
|
22
|
+
# while passing index of DjVu page index and instance of Rectangle covering the area to be exported
|
23
|
+
export_options.setMultiPageOptions(Rjb::import('com.aspose.imaging.imageoptions.DjvuMultiPageOptions').new(export_page_index, export_area))
|
24
|
+
|
25
|
+
# Save the result in PDF format
|
26
|
+
image.save(data_dir + "SpecificPagePortion.png", export_options)
|
27
|
+
|
28
|
+
# Display Status.
|
29
|
+
puts "Converted specific page portion DjVu page to image successfully!"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require_relative 'drawing/drawingimagesusingcorefunctionality'
|
2
|
+
require_relative 'drawing/drawingimagesusinggraphics'
|
3
|
+
require_relative 'drawing/drawinglines'
|
4
|
+
require_relative 'drawing/drawingellipse'
|
5
|
+
require_relative 'drawing/drawingrectangle'
|
6
|
+
require_relative 'drawing/drawingarc'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module DrawingArc
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Create an instance of BmpOptions and set its various properties
|
7
|
+
create_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
|
8
|
+
create_options.setBitsPerPixel(32)
|
9
|
+
|
10
|
+
# Define the source property for the instance of BmpOptions
|
11
|
+
create_options.setSource(Rjb::import('com.aspose.imaging.sources.StreamSource').new(Rjb::import('java.io.ByteArrayInputStream').new(Array.new)))
|
12
|
+
|
13
|
+
# Create an instance of Image
|
14
|
+
image = Rjb::import('com.aspose.imaging.Image').create(create_options,100,100)
|
15
|
+
|
16
|
+
# Create an instance of Color
|
17
|
+
color = Rjb::import('com.aspose.imaging.Color')
|
18
|
+
|
19
|
+
# Create an instance of Pen
|
20
|
+
pen = Rjb::import('com.aspose.imaging.Pen')
|
21
|
+
|
22
|
+
# Create and initialize an instance of Graphics class
|
23
|
+
graphic = Rjb::import('com.aspose.imaging.Graphics').new(image)
|
24
|
+
|
25
|
+
# Clear the image surface with Yellow color
|
26
|
+
graphic.clear(color.getYellow())
|
27
|
+
|
28
|
+
# Draw arc to screen.
|
29
|
+
graphic.drawArc(pen.new(color.getBlack()), 0, 0, 100, 200, 45, 270)
|
30
|
+
|
31
|
+
# Save all changes.
|
32
|
+
image.save(data_dir + "DrawArcExample.bmp")
|
33
|
+
|
34
|
+
puts "Arc have been drawn in image successfully!"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Asposeimagingjava
|
2
|
+
module DrawingEllipse
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Create an instance of BmpOptions and set its various properties
|
7
|
+
create_options = Rjb::import('com.aspose.imaging.imageoptions.BmpOptions').new
|
8
|
+
create_options.setBitsPerPixel(32)
|
9
|
+
|
10
|
+
# Define the source property for the instance of BmpOptions
|
11
|
+
create_options.setSource(Rjb::import('com.aspose.imaging.sources.StreamSource').new(Rjb::import('java.io.ByteArrayInputStream').new(Array.new)))
|
12
|
+
|
13
|
+
# Create an instance of Image
|
14
|
+
image = Rjb::import('com.aspose.imaging.Image').create(create_options,100,100)
|
15
|
+
|
16
|
+
# Create an instance of Color
|
17
|
+
color = Rjb::import('com.aspose.imaging.Color')
|
18
|
+
|
19
|
+
# Create an instance of Pen
|
20
|
+
pen = Rjb::import('com.aspose.imaging.Pen')
|
21
|
+
|
22
|
+
# Create and initialize an instance of Graphics class
|
23
|
+
graphic = Rjb::import('com.aspose.imaging.Graphics').new(image)
|
24
|
+
|
25
|
+
# Clear the image surface with Yellow color
|
26
|
+
graphic.clear(color.getYellow())
|
27
|
+
|
28
|
+
solid_brush = Rjb::import('com.aspose.imaging.brushes.SolidBrush')
|
29
|
+
rectangle = Rjb::import('com.aspose.imaging.Rectangle')
|
30
|
+
|
31
|
+
# Draw a dotted ellipse shape by specifying the Pen object having red color and a surrounding Rectangle
|
32
|
+
graphic.drawEllipse(pen.new(color.getRed()), rectangle.new(30, 10, 40, 80))
|
33
|
+
|
34
|
+
# Draw a continuous ellipse shape by specifying the Pen object having solid brush with blue color and a surrounding Rectangle
|
35
|
+
graphic.drawEllipse(pen.new(solid_brush.new(color.getBlue())), rectangle.new(10, 30, 80, 40))
|
36
|
+
|
37
|
+
# Save all changes.
|
38
|
+
image.save(data_dir + "DrawEllipseExample.bmp")
|
39
|
+
|
40
|
+
puts "Ellipse have been drawn in image successfully!"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|