Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6f1ee205
Kaydet (Commit)
6f1ee205
authored
Eki 04, 1996
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use mac_image (from cmif stuff)
Fixed off-by-four error Keep data around so it won't get reclaimed
üst
30fe363f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
46 deletions
+64
-46
imgbrowse.py
Mac/Demo/imgbrowse/imgbrowse.py
+9
-46
mac_image.py
Mac/Demo/imgbrowse/mac_image.py
+55
-0
No files found.
Mac/Demo/imgbrowse/imgbrowse.py
Dosyayı görüntüle @
6f1ee205
...
@@ -13,6 +13,7 @@ import img
...
@@ -13,6 +13,7 @@ import img
import
imgformat
import
imgformat
import
macfs
import
macfs
import
struct
import
struct
import
mac_image
# Where is the picture window?
# Where is the picture window?
...
@@ -23,44 +24,6 @@ MINHEIGHT=64
...
@@ -23,44 +24,6 @@ MINHEIGHT=64
MAXWIDTH
=
320
MAXWIDTH
=
320
MAXHEIGHT
=
320
MAXHEIGHT
=
320
def
dumppixmap
(
data
):
baseAddr
,
\
rowBytes
,
\
t
,
l
,
b
,
r
,
\
pmVersion
,
\
packType
,
packSize
,
\
hRes
,
vRes
,
\
pixelType
,
pixelSize
,
\
cmpCount
,
cmpSize
,
\
planeBytes
,
pmTable
,
pmReserved
\
=
struct
.
unpack
(
"lhhhhhhhlllhhhhlll"
,
data
)
print
'Base: 0x
%
x'
%
baseAddr
print
'rowBytes:
%
d (0x
%
x)'
%
(
rowBytes
&
0x3fff
,
rowBytes
)
print
'rect:
%
d,
%
d,
%
d,
%
d'
%
(
t
,
l
,
b
,
r
)
print
'pmVersion: 0x
%
x'
%
pmVersion
print
'packing:
%
d
%
d'
%
(
packType
,
packSize
)
print
'resolution:
%
f x
%
f'
%
(
float
(
hRes
)
/
0x10000
,
float
(
vRes
)
/
0x10000
)
print
'pixeltype:
%
d, size
%
d'
%
(
pixelType
,
pixelSize
)
print
'components:
%
d, size
%
d'
%
(
cmpCount
,
cmpSize
)
print
'planeBytes:
%
d (0x
%
x)'
%
(
planeBytes
,
planeBytes
)
print
'pmTable: 0x
%
x'
%
pmTable
print
'pmReserved: 0x
%
x'
%
pmReserved
def
mk16pixmap
(
w
,
h
,
data
):
"""kludge a pixmap together"""
rv
=
struct
.
pack
(
"lhhhhhhhlllhhhhlll"
,
id
(
data
)
+
12
,
w
*
2
+
0x8000
,
0
,
0
,
h
,
w
,
0
,
0
,
0
,
# XXXX?
72
<<
16
,
72
<<
16
,
16
,
16
,
# XXXX
3
,
5
,
0
,
0
,
0
)
print
'Our pixmap, size
%
d:'
%
len
(
rv
)
dumppixmap
(
rv
)
return
Qd
.
RawBitMap
(
rv
)
def
main
():
def
main
():
print
'hello world'
print
'hello world'
...
@@ -98,12 +61,12 @@ class imgbrowse(FrameWork.Application):
...
@@ -98,12 +61,12 @@ class imgbrowse(FrameWork.Application):
bar
.
set
(
10
)
bar
.
set
(
10
)
data
=
rdr
.
read
()
data
=
rdr
.
read
()
del
bar
del
bar
pixmap
=
m
k16pixmap
(
w
,
h
,
data
)
pixmap
=
m
ac_image
.
mkpixmap
(
w
,
h
,
imgformat
.
macrgb16
,
data
)
self
.
showimg
(
w
,
h
,
pixmap
)
self
.
showimg
(
w
,
h
,
pixmap
,
data
)
def
showimg
(
self
,
w
,
h
,
pixmap
):
def
showimg
(
self
,
w
,
h
,
pixmap
,
data
):
win
=
imgwindow
(
self
)
win
=
imgwindow
(
self
)
win
.
open
(
w
,
h
,
pixmap
)
win
.
open
(
w
,
h
,
pixmap
,
data
)
self
.
lastwin
=
win
self
.
lastwin
=
win
def
info
(
self
,
*
args
):
def
info
(
self
,
*
args
):
...
@@ -111,8 +74,9 @@ class imgbrowse(FrameWork.Application):
...
@@ -111,8 +74,9 @@ class imgbrowse(FrameWork.Application):
self
.
lastwin
.
info
()
self
.
lastwin
.
info
()
class
imgwindow
(
FrameWork
.
Window
):
class
imgwindow
(
FrameWork
.
Window
):
def
open
(
self
,
width
,
height
,
pixmap
):
def
open
(
self
,
width
,
height
,
pixmap
,
data
):
self
.
pixmap
=
pixmap
self
.
pixmap
=
pixmap
self
.
data
=
data
self
.
pictrect
=
(
0
,
0
,
width
,
height
)
self
.
pictrect
=
(
0
,
0
,
width
,
height
)
bounds
=
(
LEFT
,
TOP
,
LEFT
+
width
,
TOP
+
height
)
bounds
=
(
LEFT
,
TOP
,
LEFT
+
width
,
TOP
+
height
)
...
@@ -128,8 +92,7 @@ class imgwindow(FrameWork.Window):
...
@@ -128,8 +92,7 @@ class imgwindow(FrameWork.Window):
currect
,
QuickDraw
.
srcCopy
,
None
)
currect
,
QuickDraw
.
srcCopy
,
None
)
self
.
info
()
self
.
info
()
Qd
.
CopyBits
(
self
.
pixmap
,
self
.
wid
.
GetWindowPort
()
.
portBits
,
self
.
pictrect
,
Qd
.
CopyBits
(
self
.
pixmap
,
self
.
wid
.
GetWindowPort
()
.
portBits
,
self
.
pictrect
,
currect
,
QuickDraw
.
srcCopy
+
QuickDraw
.
ditherCopy
,
None
)
currect
,
QuickDraw
.
srcCopy
,
None
)
## Qd.DrawPicture(self.picture, currect)
def
fitrect
(
self
):
def
fitrect
(
self
):
"""Return self.pictrect scaled to fit in window"""
"""Return self.pictrect scaled to fit in window"""
...
@@ -151,6 +114,6 @@ class imgwindow(FrameWork.Window):
...
@@ -151,6 +114,6 @@ class imgwindow(FrameWork.Window):
def
info
(
self
):
def
info
(
self
):
graf
=
self
.
wid
.
GetWindowPort
()
graf
=
self
.
wid
.
GetWindowPort
()
bits
=
graf
.
portBits
bits
=
graf
.
portBits
dumppixmap
(
bits
.
pixmap_data
)
mac_image
.
dumppixmap
(
bits
.
pixmap_data
)
main
()
main
()
Mac/Demo/imgbrowse/mac_image.py
0 → 100644
Dosyayı görüntüle @
6f1ee205
"""mac_image - Helper routines (hacks) for images"""
import
imgformat
import
Qd
import
time
import
struct
_fmt_to_mac
=
{
imgformat
.
macrgb16
:
(
16
,
16
,
3
,
5
),
}
def
mkpixmap
(
w
,
h
,
fmt
,
data
):
"""kludge a pixmap together"""
fmtinfo
=
_fmt_to_mac
[
fmt
]
rv
=
struct
.
pack
(
"lhhhhhhhlllhhhhlll"
,
id
(
data
)
+
16
,
w
*
2
+
0x8000
,
0
,
0
,
h
,
w
,
0
,
0
,
0
,
# XXXX?
72
<<
16
,
72
<<
16
,
fmtinfo
[
0
],
fmtinfo
[
1
],
fmtinfo
[
2
],
fmtinfo
[
3
],
0
,
0
,
0
)
## print 'Our pixmap, size %d:'%len(rv)
## dumppixmap(rv)
return
Qd
.
RawBitMap
(
rv
)
def
dumppixmap
(
data
):
baseAddr
,
\
rowBytes
,
\
t
,
l
,
b
,
r
,
\
pmVersion
,
\
packType
,
packSize
,
\
hRes
,
vRes
,
\
pixelType
,
pixelSize
,
\
cmpCount
,
cmpSize
,
\
planeBytes
,
pmTable
,
pmReserved
\
=
struct
.
unpack
(
"lhhhhhhhlllhhhhlll"
,
data
)
print
'Base: 0x
%
x'
%
baseAddr
print
'rowBytes:
%
d (0x
%
x)'
%
(
rowBytes
&
0x3fff
,
rowBytes
)
print
'rect:
%
d,
%
d,
%
d,
%
d'
%
(
t
,
l
,
b
,
r
)
print
'pmVersion: 0x
%
x'
%
pmVersion
print
'packing:
%
d
%
d'
%
(
packType
,
packSize
)
print
'resolution:
%
f x
%
f'
%
(
float
(
hRes
)
/
0x10000
,
float
(
vRes
)
/
0x10000
)
print
'pixeltype:
%
d, size
%
d'
%
(
pixelType
,
pixelSize
)
print
'components:
%
d, size
%
d'
%
(
cmpCount
,
cmpSize
)
print
'planeBytes:
%
d (0x
%
x)'
%
(
planeBytes
,
planeBytes
)
print
'pmTable: 0x
%
x'
%
pmTable
print
'pmReserved: 0x
%
x'
%
pmReserved
for
i
in
range
(
0
,
len
(
data
),
16
):
for
j
in
range
(
16
):
if
i
+
j
<
len
(
data
):
print
'
%02.2
x'
%
ord
(
data
[
i
+
j
]),
print
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment