pyglet 2.1.3__py3-none-any.whl → 2.1.4__py3-none-any.whl

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.
Files changed (61) hide show
  1. pyglet/__init__.py +21 -9
  2. pyglet/__init__.pyi +3 -1
  3. pyglet/app/cocoa.py +6 -3
  4. pyglet/display/win32.py +14 -15
  5. pyglet/display/xlib_vidmoderestore.py +1 -1
  6. pyglet/extlibs/earcut.py +2 -2
  7. pyglet/font/__init__.py +3 -3
  8. pyglet/font/base.py +118 -51
  9. pyglet/font/dwrite/__init__.py +1381 -0
  10. pyglet/font/dwrite/d2d1_lib.py +637 -0
  11. pyglet/font/dwrite/d2d1_types_lib.py +60 -0
  12. pyglet/font/dwrite/dwrite_lib.py +1577 -0
  13. pyglet/font/fontconfig.py +79 -16
  14. pyglet/font/freetype.py +252 -77
  15. pyglet/font/freetype_lib.py +234 -125
  16. pyglet/font/harfbuzz/__init__.py +275 -0
  17. pyglet/font/harfbuzz/harfbuzz_lib.py +212 -0
  18. pyglet/font/quartz.py +432 -112
  19. pyglet/font/user.py +18 -11
  20. pyglet/font/win32.py +9 -1
  21. pyglet/gl/wgl.py +94 -87
  22. pyglet/gl/wglext_arb.py +472 -218
  23. pyglet/gl/wglext_nv.py +410 -188
  24. pyglet/gui/widgets.py +6 -1
  25. pyglet/image/codecs/bmp.py +3 -5
  26. pyglet/image/codecs/gdiplus.py +28 -9
  27. pyglet/image/codecs/wic.py +198 -489
  28. pyglet/image/codecs/wincodec_lib.py +413 -0
  29. pyglet/input/base.py +3 -2
  30. pyglet/input/macos/darwin_hid.py +28 -2
  31. pyglet/input/win32/directinput.py +2 -1
  32. pyglet/input/win32/xinput.py +10 -9
  33. pyglet/lib.py +14 -2
  34. pyglet/libs/darwin/cocoapy/cocoalibs.py +74 -3
  35. pyglet/libs/darwin/coreaudio.py +0 -2
  36. pyglet/libs/win32/__init__.py +4 -2
  37. pyglet/libs/win32/com.py +65 -12
  38. pyglet/libs/win32/constants.py +1 -0
  39. pyglet/libs/win32/dinput.py +1 -9
  40. pyglet/libs/win32/types.py +72 -8
  41. pyglet/media/codecs/coreaudio.py +1 -0
  42. pyglet/media/codecs/wmf.py +93 -72
  43. pyglet/media/devices/win32.py +5 -4
  44. pyglet/media/drivers/directsound/lib_dsound.py +4 -4
  45. pyglet/media/drivers/xaudio2/interface.py +21 -17
  46. pyglet/media/drivers/xaudio2/lib_xaudio2.py +42 -25
  47. pyglet/shapes.py +1 -1
  48. pyglet/text/document.py +7 -53
  49. pyglet/text/formats/attributed.py +3 -1
  50. pyglet/text/formats/plaintext.py +1 -1
  51. pyglet/text/formats/structured.py +1 -1
  52. pyglet/text/layout/base.py +76 -68
  53. pyglet/text/layout/incremental.py +38 -8
  54. pyglet/text/layout/scrolling.py +1 -1
  55. pyglet/text/runlist.py +2 -114
  56. pyglet/window/win32/__init__.py +1 -3
  57. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/METADATA +1 -1
  58. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/RECORD +60 -54
  59. pyglet/font/directwrite.py +0 -2798
  60. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/LICENSE +0 -0
  61. {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/WHEEL +0 -0
pyglet/gui/widgets.py CHANGED
@@ -370,7 +370,12 @@ class Slider(WidgetBase):
370
370
 
371
371
  def _update_position(self) -> None:
372
372
  self._base_spr.position = self._x, self._y, 0
373
- self._knob_spr.position = self._x + self._edge, self._y + self._base_img.height / 2, 0
373
+ self._min_knob_x = self._x + self._edge
374
+ self._max_knob_x = self._x + self._base_img.width - self._knob_img.width - self._edge
375
+ x = (self._max_knob_x - self._min_knob_x) * self._value / 100 + self._min_knob_x + self._half_knob_width
376
+ x = max(self._min_knob_x, min(x - self._half_knob_width, self._max_knob_x))
377
+ y = self._y + self._base_img.height / 2
378
+ self._knob_spr.position = x, y, 0
374
379
 
375
380
  @property
376
381
  def value(self) -> float:
@@ -11,14 +11,12 @@ encoding. Alpha channel is supported for 32-bit BI_RGB only.
11
11
  # http://www.fileformat.info/format/bmp/egff.htm
12
12
 
13
13
  import ctypes
14
+ from ctypes.wintypes import DWORD, LONG, WORD
14
15
 
15
16
  from pyglet.image import ImageData
16
- from pyglet.image.codecs import ImageDecoder, ImageDecodeException
17
+ from pyglet.image.codecs import ImageDecodeException, ImageDecoder
18
+ from pyglet.libs.win32.types import BYTE
17
19
 
18
- BYTE = ctypes.c_ubyte
19
- WORD = ctypes.c_uint16
20
- DWORD = ctypes.c_uint32
21
- LONG = ctypes.c_int32
22
20
  FXPT2DOT30 = ctypes.c_uint32
23
21
 
24
22
  BI_RGB = 0
@@ -1,11 +1,30 @@
1
- from pyglet.libs.win32.com import pIUnknown
2
- from pyglet.image import *
3
- from pyglet.image.codecs import *
4
- from pyglet.libs.win32.constants import *
5
- from pyglet.libs.win32.types import *
1
+ from ctypes import (
2
+ POINTER,
3
+ Structure,
4
+ c_buffer,
5
+ c_byte,
6
+ c_float,
7
+ c_long,
8
+ c_short,
9
+ c_uint32,
10
+ c_ulong,
11
+ c_void_p,
12
+ c_wchar,
13
+ c_wchar_p,
14
+ cast,
15
+ create_string_buffer,
16
+ memmove,
17
+ windll,
18
+ )
19
+ from ctypes.wintypes import BOOL, BYTE, INT, UINT, ULONG
20
+
21
+ from pyglet.image import Animation, AnimationFrame, ImageData, byref, c_int, c_uint, sizeof
22
+ from pyglet.image.codecs import ImageDecodeException, ImageDecoder
6
23
  from pyglet.libs.win32 import _kernel32 as kernel32
7
24
  from pyglet.libs.win32 import _ole32 as ole32
8
-
25
+ from pyglet.libs.win32.com import pIUnknown
26
+ from pyglet.libs.win32.constants import GMEM_MOVEABLE
27
+ from pyglet.libs.win32.types import LONG_PTR
9
28
 
10
29
  gdiplus = windll.gdiplus
11
30
 
@@ -248,13 +267,13 @@ class GDIPlusDecoder(ImageDecoder):
248
267
  if not file:
249
268
  file = open(filename, 'rb')
250
269
  bitmap = self._load_bitmap(filename, file)
251
-
270
+
252
271
  dimension_count = c_uint()
253
272
  gdiplus.GdipImageGetFrameDimensionsCount(bitmap, byref(dimension_count))
254
273
  if dimension_count.value < 1:
255
274
  self._delete_bitmap(bitmap)
256
275
  raise ImageDecodeException('Image has no frame dimensions')
257
-
276
+
258
277
  # XXX Make sure this dimension is time?
259
278
  dimensions = (c_void_p * dimension_count.value)()
260
279
  gdiplus.GdipImageGetFrameDimensionsList(bitmap, dimensions, dimension_count.value)
@@ -274,7 +293,7 @@ class GDIPlusDecoder(ImageDecoder):
274
293
  delays = cast(prop_item.value, POINTER(c_long * n_delays)).contents
275
294
 
276
295
  frames = []
277
-
296
+
278
297
  for i in range(frame_count.value):
279
298
  gdiplus.GdipImageSelectActiveFrame(bitmap, dimensions, i)
280
299
  image = self._get_image(bitmap)