stbimage 0.1.0 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -0
- data/dlls/stbDLL_x64.dll +0 -0
- data/dlls/stbDLL_x86.dll +0 -0
- data/lib/stbimage.rb +10 -7
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32f96cdeb03fd88a7e4b6d29158af7d6ae1a646001b01914d8159d98b1765528
|
4
|
+
data.tar.gz: 1e02ba30e6eace68f587b89914109aa379fe1361830bde57af79a7fdb4c37892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ac1c2781afdd7561d3d890af931a89360db9cc4cdf09ac0754cde72ffb328bd400f44f5b4b39eb5aefdb5dffeb0cb7b421cf0e7e33246f05bcb5eb7ce2a72ea
|
7
|
+
data.tar.gz: c8591f92dfbf67d77a77e6b3980392133a894f6c700d9a9e61c16842cc11571929234afda38e2afe0ee0172bcfcb1d24ec9e4e3d285a93d388d8a17e91c4a2ce
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# stbimage-ruby
|
2
|
+
Binding of stb-image into the ruby programing language.
|
3
|
+
|
4
|
+
# Tutorials
|
5
|
+
|
6
|
+
1. To use this gem first install it with:
|
7
|
+
`gem install stbimage`
|
8
|
+
2. Require it in your project with\
|
9
|
+
`require 'stbimage'`
|
10
|
+
3. Load your dll dynamic libary what is in your projects root folder!!! (Download the dlls: visit my webpage.)\
|
11
|
+
`STBIMAGE.load_lib()`
|
12
|
+
4. Then you can use it :D
|
13
|
+
|
14
|
+
# About the dll libs
|
15
|
+
|
16
|
+
You can find it under [dlls](dlls) folder
|
17
|
+
|
18
|
+
# A full Example:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'stb_image'
|
22
|
+
|
23
|
+
# Note that you need to name your dll file to stbDLL.dll in this case
|
24
|
+
STBIMAGE.load_lib()
|
25
|
+
# Or if you want to specify another name for it, use:
|
26
|
+
# STBIMAGE.load_lib('your_name.dll')
|
27
|
+
|
28
|
+
# But don't forget that ruby searches your dll file in your current directory!
|
29
|
+
|
30
|
+
width = ' ' * 4
|
31
|
+
height = ' ' * 4
|
32
|
+
nr_channels = ' ' * 4
|
33
|
+
|
34
|
+
data = STBIMAGE.stbi_load("blue-poly.jpg", width, height, nr_channels, 0)
|
35
|
+
|
36
|
+
puts data
|
37
|
+
|
38
|
+
puts width.unpack('l')[0]
|
39
|
+
puts height.unpack('l')[0]
|
40
|
+
puts nr_channels.unpack('l')[0]
|
41
|
+
```
|
42
|
+
|
43
|
+
# Credit
|
44
|
+
|
45
|
+
Credit to Vaiorabbit who made the bindings of opengl into ruby! This wrapper is based on his glfw wrapper. :D \
|
46
|
+
His repo: https://github.com/vaiorabbit/ruby-opengl
|
data/dlls/stbDLL_x64.dll
ADDED
Binary file
|
data/dlls/stbDLL_x86.dll
ADDED
Binary file
|
data/lib/stbimage.rb
CHANGED
@@ -31,10 +31,18 @@ module STBIMAGE
|
|
31
31
|
|
32
32
|
@@glfw_import_done = false
|
33
33
|
|
34
|
-
|
34
|
+
=begin
|
35
|
+
Load native dll libary
|
36
|
+
- lib = the name of the file
|
37
|
+
- path = route to the file
|
38
|
+
=end
|
35
39
|
def self.load_lib(lib = nil, path = nil, output_error = false)
|
36
40
|
if lib == nil && path == nil
|
37
|
-
|
41
|
+
if RUBY_PLATFORM == "x64-mswin64_140" || RUBY_PLATFORM == "x64-mingw32"
|
42
|
+
lib, path = 'stbDLL_x64.dll', "#{__dir__}/../dlls"
|
43
|
+
elsif RUBY_PLATFORM == "x86-mingw32"
|
44
|
+
lib, path = 'stbDLL_x86.dll', "#{__dir__}/../dlls"
|
45
|
+
end
|
38
46
|
end
|
39
47
|
|
40
48
|
if path
|
@@ -45,11 +53,6 @@ module STBIMAGE
|
|
45
53
|
import_symbols(output_error) unless @@glfw_import_done
|
46
54
|
end
|
47
55
|
|
48
|
-
def self.load_dll(lib = nil, path = nil)
|
49
|
-
puts "Warning STBIMAGE.load_dll is deprecated, use GLFW.load_lib instead"
|
50
|
-
self.load_lib(lib, path)
|
51
|
-
end
|
52
|
-
|
53
56
|
@@lib_signature = [
|
54
57
|
'void stbi_convert_iphone_png_to_rgb(int)',
|
55
58
|
'const char *stbi_failure_reason(void)',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stbimage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Keresztes
|
@@ -10,16 +10,21 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
15
|
-
|
13
|
+
description: "!Beta Version! Will be developed! So far compatible with: stbi_load,
|
14
|
+
stbi_set_flip_vertically_on_load(). \n Only works with windows so far!!!!! (win32/win64).
|
15
|
+
PLEASE CHECK OUT THE HOMEPAGE FOR MORE INFO AND EXAMPLE. With 0.2.3 and above dlls
|
16
|
+
are included so 'STBIMAGE.load_lib()'\n should be enough for linking shared liaries.
|
17
|
+
So it's worth to upgrade 0.2.3! "
|
16
18
|
email: ''
|
17
19
|
executables: []
|
18
20
|
extensions: []
|
19
21
|
extra_rdoc_files: []
|
20
22
|
files:
|
23
|
+
- README.md
|
24
|
+
- dlls/stbDLL_x64.dll
|
25
|
+
- dlls/stbDLL_x86.dll
|
21
26
|
- lib/stbimage.rb
|
22
|
-
homepage:
|
27
|
+
homepage: https://github.com/fellowchap-samuel/stbimage-ruby
|
23
28
|
licenses:
|
24
29
|
- MIT
|
25
30
|
metadata: {}
|