1
- #-*- coding: utf-8 -*-
2
- #
3
- # this program is free software; you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation; either version 2 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # this program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # if not, write to the Free Software
15
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
- #
17
- # The Graphics Interchange Format(c) is the Copyright property of
18
- # CompuServe Incorporated. GIF(sm) is a Service Mark property of
19
- # CompuServe Incorporated.
20
- #
21
- # The unisys/lzw patent has expired, yes. If anyone puts another patent
22
- # over this code, you must *burn* this file.
23
-
24
-
25
- #TODO issues to fix
26
- #optimize for speed #partially done# a lot of room for improvementd
27
- import struct
28
- from array import array
29
- import math
1
+ '''
2
+ PDF: PDF image loader
3
+ '''
30
4
31
5
from kivy .logger import Logger
32
- from . import ImageLoaderBase , ImageData , ImageLoader
6
+ from kivy . core . image import ImageLoaderBase , ImageLoader
33
7
34
8
Debug = False
35
9
39
13
class ImageLoaderPDF (ImageLoaderBase ):
40
14
'''Image loader for PDF'''
41
15
42
- def __init__ (self , page = 0 , ** kwargs ):
16
+ def __init__ (self , page = 0 , filename = None , ** kwargs ):
43
17
self .page = page
44
- super (ImageLoaderPDF , self ).__init__ (** kwargs )
18
+ super (ImageLoaderPDF , self ).__init__ (filename , ** kwargs )
45
19
46
20
@staticmethod
47
21
def extensions ():
@@ -67,7 +41,6 @@ def load(self, filename):
67
41
#blobpng.data
68
42
69
43
im = PILImage .frombuffer ('rgb' , len (blobpng .data ), blobpng .data )
70
-
71
44
72
45
except :
73
46
Logger .warning ('Image: Unable to load image <%s>' % filename )
@@ -76,3 +49,4 @@ def load(self, filename):
76
49
return list (self ._img_read (im ))
77
50
78
51
ImageLoader .register (ImageLoaderPDF )
52
+ print "PDF loader registered!"
0 commit comments