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
41058c0d
Kaydet (Commit)
41058c0d
authored
Kas 16, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
BitMap object support (only lightly tested)
üst
135fb714
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
1 deletion
+117
-1
Qdmodule.c
Mac/Modules/qd/Qdmodule.c
+0
-0
qdgen.py
Mac/Modules/qd/qdgen.py
+52
-0
qdscan.py
Mac/Modules/qd/qdscan.py
+1
-1
qdsupport.py
Mac/Modules/qd/qdsupport.py
+64
-0
No files found.
Mac/Modules/qd/Qdmodule.c
Dosyayı görüntüle @
41058c0d
This diff is collapsed.
Click to expand it.
Mac/Modules/qd/qdgen.py
Dosyayı görüntüle @
41058c0d
...
...
@@ -15,6 +15,11 @@ f = Function(void, 'GrafDevice',
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'SetPortBits'
,
(
BitMap_ptr
,
'bm'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'PortSize'
,
(
short
,
'width'
,
InMode
),
(
short
,
'height'
,
InMode
),
...
...
@@ -288,6 +293,12 @@ f = Function(void, 'CloseRgn',
)
functions
.
append
(
f
)
f
=
Function
(
OSErr
,
'BitMapToRegion'
,
(
RgnHandle
,
'region'
,
InMode
),
(
BitMap_ptr
,
'bMap'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'DisposeRgn'
,
(
RgnHandle
,
'rgn'
,
InMode
),
)
...
...
@@ -406,6 +417,26 @@ f = Function(void, 'ScrollRect',
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'CopyBits'
,
(
BitMap_ptr
,
'srcBits'
,
InMode
),
(
BitMap_ptr
,
'dstBits'
,
InMode
),
(
Rect_ptr
,
'srcRect'
,
InMode
),
(
Rect_ptr
,
'dstRect'
,
InMode
),
(
short
,
'mode'
,
InMode
),
(
RgnHandle
,
'maskRgn'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'CopyMask'
,
(
BitMap_ptr
,
'srcBits'
,
InMode
),
(
BitMap_ptr
,
'maskBits'
,
InMode
),
(
BitMap_ptr
,
'dstBits'
,
InMode
),
(
Rect_ptr
,
'srcRect'
,
InMode
),
(
Rect_ptr
,
'maskRect'
,
InMode
),
(
Rect_ptr
,
'dstRect'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
PicHandle
,
'OpenPicture'
,
(
Rect_ptr
,
'picFrame'
,
InMode
),
)
...
...
@@ -535,6 +566,15 @@ f = Function(void, 'MapPoly',
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'StdBits'
,
(
BitMap_ptr
,
'srcBits'
,
InMode
),
(
Rect_ptr
,
'srcRect'
,
InMode
),
(
Rect_ptr
,
'dstRect'
,
InMode
),
(
short
,
'mode'
,
InMode
),
(
RgnHandle
,
'maskRgn'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'AddPt'
,
(
Point
,
'src'
,
InMode
),
(
Point
,
'dst'
,
InOutMode
),
...
...
@@ -698,6 +738,18 @@ f = Function(short, 'QDError',
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'CopyDeepMask'
,
(
BitMap_ptr
,
'srcBits'
,
InMode
),
(
BitMap_ptr
,
'maskBits'
,
InMode
),
(
BitMap_ptr
,
'dstBits'
,
InMode
),
(
Rect_ptr
,
'srcRect'
,
InMode
),
(
Rect_ptr
,
'maskRect'
,
InMode
),
(
Rect_ptr
,
'dstRect'
,
InMode
),
(
short
,
'mode'
,
InMode
),
(
RgnHandle
,
'maskRgn'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
PatHandle
,
'GetPattern'
,
(
short
,
'patternID'
,
InMode
),
)
...
...
Mac/Modules/qd/qdscan.py
Dosyayı görüntüle @
41058c0d
...
...
@@ -70,11 +70,11 @@ class MyScanner(Scanner):
'OpenCPort'
,
'InitCPort'
,
'CloseCPort'
,
'BitMapToRegionGlue'
,
]
def
makeblacklisttypes
(
self
):
return
[
'BitMap_ptr'
,
'CCrsrHandle'
,
'CIconHandle'
,
'CQDProcs'
,
...
...
Mac/Modules/qd/qdsupport.py
Dosyayı görüntüle @
41058c0d
...
...
@@ -41,6 +41,7 @@ PatHandle = OpaqueByValueType("PatHandle", "ResObj")
CursHandle
=
OpaqueByValueType
(
"CursHandle"
,
"ResObj"
)
CGrafPtr
=
OpaqueByValueType
(
"CGrafPtr"
,
"GrafObj"
)
GrafPtr
=
OpaqueByValueType
(
"GrafPtr"
,
"GrafObj"
)
BitMap_ptr
=
OpaqueByValueType
(
"BitMapPtr"
,
"BMObj"
)
includestuff
=
includestuff
+
"""
#include <
%
s>"""
%
MACHEADERFILE
+
"""
...
...
@@ -73,11 +74,39 @@ class MyGRObjectDefinition(GlobalObjectDefinition):
def
outputGetattrHook
(
self
):
Output
(
"""if ( strcmp(name, "device") == 0 )
return PyInt_FromLong((long)self->ob_itself->device);
if ( strcmp(name, "portBits") == 0 )
return BMObj_New(&self->ob_itself->portBits);
if ( strcmp(name, "portRect") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
/* XXXX Add more, as needed */
"""
)
class
MyBMObjectDefinition
(
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
Output
(
"if (itself == NULL) return PyMac_Error(resNotFound);"
)
def
outputStructMembers
(
self
):
# We need to more items: a pointer to privately allocated data
# and a python object we're referring to.
Output
(
"
%
s ob_itself;"
,
self
.
itselftype
)
Output
(
"PyObject *referred_object;"
)
Output
(
"BitMap *referred_bitmap;"
)
def
outputInitStructMembers
(
self
):
Output
(
"it->ob_itself =
%
sitself;"
,
self
.
argref
)
Output
(
"it->referred_object = NULL;"
)
Output
(
"it->referred_bitmap = NULL;"
)
def
outputCleanupStructMembers
(
self
):
Output
(
"Py_XDECREF(self->referred_object);"
)
Output
(
"if (self->referred_bitmap) free(self->referred_bitmap);"
)
def
outputGetattrHook
(
self
):
Output
(
"""if ( strcmp(name, "baseAddr") == 0 )
return PyInt_FromLong((long)self->ob_itself->baseAddr);
if ( strcmp(name, "rowBytes") == 0 )
return PyInt_FromLong((long)self->ob_itself->rowBytes);
if ( strcmp(name, "bounds") == 0 )
return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
/* XXXX Add more, as needed */
"""
)
# Create the generator groups and link them
module
=
MacModule
(
MODNAME
,
MODPREFIX
,
includestuff
,
finalstuff
,
initstuff
)
##r_object = Region_ObjectDefinition('Region', 'QdRgn', 'RgnHandle')
...
...
@@ -86,6 +115,8 @@ module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
##module.addobject(po_object)
gr_object
=
MyGRObjectDefinition
(
"GrafPort"
,
"GrafObj"
,
"GrafPtr"
)
module
.
addobject
(
gr_object
)
bm_object
=
MyBMObjectDefinition
(
"BitMap"
,
"BMObj"
,
"BitMapPtr"
)
module
.
addobject
(
bm_object
)
# Create the generator classes used to populate the lists
...
...
@@ -104,6 +135,39 @@ for f in functions: module.add(f)
##for f in r_methods: r_object.add(f)
##for f in po_methods: po_object.add(f)
#
# We manually generate a routine to create a BitMap from python data.
#
BitMap_body
=
"""
BitMap *ptr;
PyObject *source;
Rect bounds;
int rowbytes;
char *data;
if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
&bounds) )
return NULL;
data = PyString_AsString(source);
if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
return PyErr_NoMemory();
ptr->baseAddr = (Ptr)data;
ptr->rowBytes = rowbytes;
ptr->bounds = bounds;
if ( (_res = BMObj_New(ptr)) == NULL ) {
free(ptr);
return NULL;
}
((BitMapObject *)_res)->referred_object = source;
Py_INCREF(source);
((BitMapObject *)_res)->referred_bitmap = ptr;
return _res;
"""
f
=
ManualGenerator
(
"BitMap"
,
BitMap_body
)
f
.
docstring
=
lambda
:
"""Take (string, int, Rect) argument and create BitMap"""
module
.
add
(
f
)
# generate output (open the output file as late as possible)
SetOutputFileName
(
OUTPUTFILE
)
module
.
generate
()
...
...
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