rays 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a66614f6ea052aeafe775d0bd3096b06103ea8dbc08a94ee60c7172f726ff745
4
- data.tar.gz: c6020c9ccf843bbf051660d851ed494d032a9a4db564d774de94ab67d906ad44
3
+ metadata.gz: '08301b38ff9f9f8b19bec9b0e1f992cb518707ec4755546e82babb633c63cecb'
4
+ data.tar.gz: 136b8d6f28ddf9675383d835682c6da199336a47d1d70b849d390dfadf9b785f
5
5
  SHA512:
6
- metadata.gz: a3f366d4930acff032af41d0eb8bd96cc3e57f6e48028a2279b6f40d0cee9773bd6fb596c0a5131cad07abc4f7fe1373fecd9297133c11e3ae889988e291f845
7
- data.tar.gz: 2fd35000dbdb686a54f09653a4a97ed599ac16432b1ab801f0bfb7c07bcfd1d36a19bb39393b78a4c6b09d1fd8c48a81aec2a7f4140816a4f26ffca35ca7365f
6
+ metadata.gz: 90064f04b08bdcb490fa256c716d6c9d9d4da0011d03bb6eb18d092f088339f0fc8aa255255be539c1791394c1445bfb91ddb70b09e703747d98a9eb6113af07
7
+ data.tar.gz: 2942ac5c8c9acb2753d77c05037ce67f99539ddaf92d699d665757483b8d34b74dc46add410906d7251bc9fb1598c62261f16ba3603e17b35210ec4983cfce2c
data/ChangeLog.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # rays ChangeLog
2
2
 
3
3
 
4
+ ## [v0.3.7] - 2025-05-11
5
+
6
+ - Use std::clamp() instead of Xot::clip()
7
+
8
+
9
+ ## [v0.3.6] - 2025-04-08
10
+
11
+ - Update dependencies: xot, rucy
12
+
13
+
4
14
  ## [v0.3.5] - 2025-03-24
5
15
 
6
16
  - Add PULL_REQUEST_TEMPLATE.md
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.7
data/include/rays/color.h CHANGED
@@ -4,7 +4,7 @@
4
4
  #define __RAYS_COLOR_H__
5
5
 
6
6
 
7
- #include <xot/util.h>
7
+ #include <algorithm>
8
8
  #include <rays/defs.h>
9
9
  #include <rays/coord.h>
10
10
 
@@ -53,7 +53,7 @@ namespace Rays
53
53
 
54
54
  static uchar float2uchar (float value)
55
55
  {
56
- return (uchar) Xot::clip(0.f, 255.f, value * 255);
56
+ return (uchar) std::clamp(value * 255, 0.f, 255.f);
57
57
  }
58
58
 
59
59
  static float uchar2float (int value)
data/rays.gemspec CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.platform = Gem::Platform::RUBY
26
26
  s.required_ruby_version = '>= 3.0.0'
27
27
 
28
- s.add_dependency 'xot', '~> 0.3.5', '>= 0.3.5'
29
- s.add_dependency 'rucy', '~> 0.3.5', '>= 0.3.5'
28
+ s.add_dependency 'xot', '~> 0.3.7', '>= 0.3.7'
29
+ s.add_dependency 'rucy', '~> 0.3.7', '>= 0.3.7'
30
30
 
31
31
  s.files = `git ls-files`.split $/
32
32
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
data/src/color.cpp CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  #include <limits.h>
5
- #include <xot/util.h>
5
+ #include <algorithm>
6
6
  #include "rays/exception.h"
7
7
  #include "rays/color_space.h"
8
8
  #include "glm.h"
@@ -171,7 +171,7 @@ namespace Rays
171
171
  static uint
172
172
  to_gray (const float* c, uint max)
173
173
  {
174
- return Xot::clip<uint>(0, max, to_gray(c) * max);
174
+ return std::clamp<uint>(to_gray(c) * max, 0, max);
175
175
  }
176
176
 
177
177
  static void
data/src/ios/bitmap.mm CHANGED
@@ -4,12 +4,12 @@
4
4
 
5
5
  #import <ImageIO/CGImageDestination.h>
6
6
  #import <MobileCoreServices/UTCoreTypes.h>
7
+ #include <xot/util.h>
7
8
  #include "rays/exception.h"
8
9
  #include "../color_space.h"
9
10
  #include "../font.h"
10
11
  #include "../texture.h"
11
12
  #include "../frame_buffer.h"
12
- #include "helper.h"
13
13
 
14
14
 
15
15
  namespace Rays
@@ -261,7 +261,7 @@ namespace Rays
261
261
 
262
262
  std::shared_ptr<CGImageDestination> dest(
263
263
  CGImageDestinationCreateWithURL((CFURLRef) url, type, 1, NULL),
264
- safe_cfrelease);
264
+ Xot::safe_cfrelease);
265
265
  if (!dest)
266
266
  rays_error(__FILE__, __LINE__, "CGImageDestinationCreateWithURL() failed.");
267
267
 
data/src/ios/font.mm CHANGED
@@ -5,8 +5,9 @@
5
5
  #include <memory>
6
6
  #import <CoreGraphics/CGContext.h>
7
7
  #import <CoreText/CoreText.h>
8
+ #include <xot/string.h>
9
+ #include <xot/util.h>
8
10
  #include "rays/exception.h"
9
- #include "helper.h"
10
11
 
11
12
 
12
13
  namespace Rays
@@ -66,7 +67,7 @@ namespace Rays
66
67
  CFRelease);
67
68
 
68
69
  CFAttributedStringPtr attrstr(
69
- CFAttributedStringCreate(NULL, cfstring(str).get(), attr.get()),
70
+ CFAttributedStringCreate(NULL, Xot::cfstring(str).get(), attr.get()),
70
71
  CFRelease);
71
72
 
72
73
  return CTLinePtr(
@@ -128,7 +129,7 @@ namespace Rays
128
129
  RawFont::RawFont (const char* name, coord size)
129
130
  {
130
131
  self->font = name
131
- ? CTFontCreateWithName(cfstring(name).get(), size, NULL)
132
+ ? CTFontCreateWithName(Xot::cfstring(name).get(), size, NULL)
132
133
  : CTFontCreateUIFontForLanguage(kCTFontSystemFontType, size, NULL);
133
134
  }
134
135
 
@@ -138,7 +139,7 @@ namespace Rays
138
139
  if (path)
139
140
  *this = RawFont_load(path, size);
140
141
  else
141
- self->font = CTFontCreateWithName(cfstring(obj.name()).get(), size, NULL);
142
+ self->font = CTFontCreateWithName(Xot::cfstring(obj.name()).get(), size, NULL);
142
143
  }
143
144
 
144
145
  RawFont::~RawFont ()
@@ -189,14 +190,8 @@ namespace Rays
189
190
  {
190
191
  if (!*this) return "";
191
192
 
192
- CFStringPtr str(CTFontCopyFullName(self->font), CFRelease);
193
-
194
- enum {BUFSIZE = 2048};
195
- char buf[BUFSIZE + 1];
196
- if (!CFStringGetCString(str.get(), buf, BUFSIZE, kCFStringEncodingUTF8))
197
- buf[0] = '\0';
198
-
199
- return buf;
193
+ Xot::CFStringPtr str(CTFontCopyFullName(self->font), CFRelease);
194
+ return Xot::to_s(str);
200
195
  }
201
196
 
202
197
  coord
data/src/osx/bitmap.mm CHANGED
@@ -3,12 +3,12 @@
3
3
 
4
4
 
5
5
  #import <Cocoa/Cocoa.h>
6
+ #include <xot/util.h>
6
7
  #include "rays/exception.h"
7
8
  #include "../color_space.h"
8
9
  #include "../font.h"
9
10
  #include "../texture.h"
10
11
  #include "../frame_buffer.h"
11
- #include "helper.h"
12
12
 
13
13
 
14
14
  namespace Rays
@@ -260,7 +260,7 @@ namespace Rays
260
260
 
261
261
  std::shared_ptr<CGImageDestination> dest(
262
262
  CGImageDestinationCreateWithURL((CFURLRef) url, type, 1, NULL),
263
- safe_cfrelease);
263
+ Xot::safe_cfrelease);
264
264
  if (!dest)
265
265
  rays_error(__FILE__, __LINE__, "CGImageDestinationCreateWithURL() failed.");
266
266
 
data/src/osx/font.mm CHANGED
@@ -5,8 +5,8 @@
5
5
  #include <memory>
6
6
  #import <ApplicationServices/ApplicationServices.h>
7
7
  #import <AppKit/AppKit.h>
8
+ #include <xot/string.h>
8
9
  #include "rays/exception.h"
9
- #include "helper.h"
10
10
 
11
11
 
12
12
  namespace Rays
@@ -66,7 +66,7 @@ namespace Rays
66
66
  CFRelease);
67
67
 
68
68
  CFAttributedStringPtr attrstr(
69
- CFAttributedStringCreate(NULL, cfstring(str).get(), attr.get()),
69
+ CFAttributedStringCreate(NULL, Xot::cfstring(str).get(), attr.get()),
70
70
  CFRelease);
71
71
 
72
72
  return CTLinePtr(
@@ -130,7 +130,7 @@ namespace Rays
130
130
  RawFont::RawFont (const char* name, coord size)
131
131
  {
132
132
  self->font = name
133
- ? CTFontCreateWithName(cfstring(name).get(), size, NULL)
133
+ ? CTFontCreateWithName(Xot::cfstring(name).get(), size, NULL)
134
134
  : CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, size, NULL);
135
135
  }
136
136
 
@@ -140,7 +140,7 @@ namespace Rays
140
140
  if (path)
141
141
  *this = RawFont_load(path, size);
142
142
  else
143
- self->font = CTFontCreateWithName(cfstring(obj.name()).get(), size, NULL);
143
+ self->font = CTFontCreateWithName(Xot::cfstring(obj.name()).get(), size, NULL);
144
144
  }
145
145
 
146
146
  RawFont::~RawFont ()
@@ -189,14 +189,8 @@ namespace Rays
189
189
  {
190
190
  if (!*this) return "";
191
191
 
192
- CFStringPtr str(CTFontCopyFullName(self->font), CFRelease);
193
-
194
- enum {BUFSIZE = 2048};
195
- char buf[BUFSIZE + 1];
196
- if (!CFStringGetCString(str.get(), buf, BUFSIZE, kCFStringEncodingUTF8))
197
- buf[0] = '\0';
198
-
199
- return buf;
192
+ Xot::CFStringPtr str(CTFontCopyFullName(self->font), CFRelease);
193
+ return Xot::to_s(str);
200
194
  }
201
195
 
202
196
  coord
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rays
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-23 00:00:00.000000000 Z
11
+ date: 2025-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xot
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.5
19
+ version: 0.3.7
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.3.5
22
+ version: 0.3.7
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 0.3.5
29
+ version: 0.3.7
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.3.5
32
+ version: 0.3.7
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rucy
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.3.5
39
+ version: 0.3.7
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.3.5
42
+ version: 0.3.7
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 0.3.5
49
+ version: 0.3.7
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.3.5
52
+ version: 0.3.7
53
53
  description: This library helps you to develop graphics application with OpenGL.
54
54
  email: xordog@gmail.com
55
55
  executables: []
@@ -200,8 +200,6 @@ files:
200
200
  - src/ios/bitmap.mm
201
201
  - src/ios/camera.mm
202
202
  - src/ios/font.mm
203
- - src/ios/helper.h
204
- - src/ios/helper.mm
205
203
  - src/ios/opengl.mm
206
204
  - src/ios/rays.mm
207
205
  - src/matrix.cpp
@@ -212,8 +210,6 @@ files:
212
210
  - src/osx/bitmap.mm
213
211
  - src/osx/camera.mm
214
212
  - src/osx/font.mm
215
- - src/osx/helper.h
216
- - src/osx/helper.mm
217
213
  - src/osx/opengl.mm
218
214
  - src/osx/rays.mm
219
215
  - src/painter.cpp
data/src/ios/helper.h DELETED
@@ -1,26 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RAYS_SRC_IOS_HELPER_H__
4
- #define __RAYS_SRC_IOS_HELPER_H__
5
-
6
-
7
- #include <memory>
8
- #include <CoreFoundation/CoreFoundation.h>
9
-
10
-
11
- namespace Rays
12
- {
13
-
14
-
15
- void safe_cfrelease (CFTypeRef ref);
16
-
17
-
18
- typedef std::shared_ptr<const __CFString> CFStringPtr;
19
-
20
- CFStringPtr cfstring (const char* str);
21
-
22
-
23
- }// Rays
24
-
25
-
26
- #endif//EOH
data/src/ios/helper.mm DELETED
@@ -1,25 +0,0 @@
1
- // -*- objc -*-
2
- #include "helper.h"
3
-
4
-
5
- namespace Rays
6
- {
7
-
8
-
9
- void
10
- safe_cfrelease (CFTypeRef ref)
11
- {
12
- if (ref) CFRelease(ref);
13
- }
14
-
15
-
16
- CFStringPtr
17
- cfstring (const char* str)
18
- {
19
- CFStringRef ref = CFStringCreateWithCString(
20
- kCFAllocatorDefault, str, kCFStringEncodingUTF8);
21
- return CFStringPtr(ref, safe_cfrelease);
22
- }
23
-
24
-
25
- }// Rays
data/src/osx/helper.h DELETED
@@ -1,26 +0,0 @@
1
- // -*- c++ -*-
2
- #pragma once
3
- #ifndef __RAYS_SRC_OSX_HELPER_H__
4
- #define __RAYS_SRC_OSX_HELPER_H__
5
-
6
-
7
- #include <memory>
8
- #include <CoreFoundation/CoreFoundation.h>
9
-
10
-
11
- namespace Rays
12
- {
13
-
14
-
15
- void safe_cfrelease (CFTypeRef ref);
16
-
17
-
18
- typedef std::shared_ptr<const __CFString> CFStringPtr;
19
-
20
- CFStringPtr cfstring (const char* str);
21
-
22
-
23
- }// Rays
24
-
25
-
26
- #endif//EOH
data/src/osx/helper.mm DELETED
@@ -1,25 +0,0 @@
1
- // -*- objc -*-
2
- #include "helper.h"
3
-
4
-
5
- namespace Rays
6
- {
7
-
8
-
9
- void
10
- safe_cfrelease (CFTypeRef ref)
11
- {
12
- if (ref) CFRelease(ref);
13
- }
14
-
15
-
16
- CFStringPtr
17
- cfstring (const char* str)
18
- {
19
- CFStringRef ref = CFStringCreateWithCString(
20
- kCFAllocatorDefault, str, kCFStringEncodingUTF8);
21
- return CFStringPtr(ref, safe_cfrelease);
22
- }
23
-
24
-
25
- }// Rays