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
232f3cd1
Kaydet (Commit)
232f3cd1
authored
Ara 09, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added support for RGB objects (tuples in python)
üst
1e4ce733
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
359 additions
and
2 deletions
+359
-2
Qdmodule.c
Mac/Modules/qd/Qdmodule.c
+261
-0
qdgen.py
Mac/Modules/qd/qdgen.py
+71
-0
qdscan.py
Mac/Modules/qd/qdscan.py
+0
-2
qdsupport.py
Mac/Modules/qd/qdsupport.py
+27
-0
No files found.
Mac/Modules/qd/Qdmodule.c
Dosyayı görüntüle @
232f3cd1
...
@@ -46,6 +46,31 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
...
@@ -46,6 +46,31 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
#define resNotFound -192
/* Can't include <Errors.h> because of Python's "errors.h" */
#define resNotFound -192
/* Can't include <Errors.h> because of Python's "errors.h" */
/*
** Parse/generate RGB records
*/
PyObject
*
QdRGB_New
(
itself
)
RGBColorPtr
itself
;
{
return
Py_BuildValue
(
"lll"
,
(
long
)
itself
->
red
,
(
long
)
itself
->
green
,
(
long
)
itself
->
blue
);
}
QdRGB_Convert
(
v
,
p_itself
)
PyObject
*
v
;
RGBColorPtr
p_itself
;
{
long
red
,
green
,
blue
;
if
(
!
PyArg_ParseTuple
(
v
,
"lll"
,
&
red
,
&
green
,
&
blue
)
)
return
0
;
p_itself
->
red
=
(
unsigned
short
)
red
;
p_itself
->
green
=
(
unsigned
short
)
green
;
p_itself
->
blue
=
(
unsigned
short
)
blue
;
return
1
;
}
static
PyObject
*
Qd_Error
;
static
PyObject
*
Qd_Error
;
/* ---------------------- Object type GrafPort ---------------------- */
/* ---------------------- Object type GrafPort ---------------------- */
...
@@ -2238,6 +2263,24 @@ static PyObject *Qd_GetPixPat(_self, _args)
...
@@ -2238,6 +2263,24 @@ static PyObject *Qd_GetPixPat(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Qd_MakeRGBPat
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
PixPatHandle
pp
;
RGBColor
myColor
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&"
,
ResObj_Convert
,
&
pp
,
QdRGB_Convert
,
&
myColor
))
return
NULL
;
MakeRGBPat
(
pp
,
&
myColor
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
Qd_FillCRect
(
_self
,
_args
)
static
PyObject
*
Qd_FillCRect
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -2358,6 +2401,57 @@ static PyObject *Qd_FillCPoly(_self, _args)
...
@@ -2358,6 +2401,57 @@ static PyObject *Qd_FillCPoly(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Qd_RGBForeColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
QdRGB_Convert
,
&
color
))
return
NULL
;
RGBForeColor
(
&
color
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
Qd_RGBBackColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
QdRGB_Convert
,
&
color
))
return
NULL
;
RGBBackColor
(
&
color
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
Qd_SetCPixel
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
h
;
short
v
;
RGBColor
cPix
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hhO&"
,
&
h
,
&
v
,
QdRGB_Convert
,
&
cPix
))
return
NULL
;
SetCPixel
(
h
,
v
,
&
cPix
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
Qd_SetPortPix
(
_self
,
_args
)
static
PyObject
*
Qd_SetPortPix
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -2373,6 +2467,84 @@ static PyObject *Qd_SetPortPix(_self, _args)
...
@@ -2373,6 +2467,84 @@ static PyObject *Qd_SetPortPix(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Qd_GetCPixel
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
h
;
short
v
;
RGBColor
cPix
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
h
,
&
v
))
return
NULL
;
GetCPixel
(
h
,
v
,
&
cPix
);
_res
=
Py_BuildValue
(
"O&"
,
QdRGB_New
,
&
cPix
);
return
_res
;
}
static
PyObject
*
Qd_GetForeColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
GetForeColor
(
&
color
);
_res
=
Py_BuildValue
(
"O&"
,
QdRGB_New
,
&
color
);
return
_res
;
}
static
PyObject
*
Qd_GetBackColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
GetBackColor
(
&
color
);
_res
=
Py_BuildValue
(
"O&"
,
QdRGB_New
,
&
color
);
return
_res
;
}
static
PyObject
*
Qd_OpColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
QdRGB_Convert
,
&
color
))
return
NULL
;
OpColor
(
&
color
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
Qd_HiliteColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
QdRGB_Convert
,
&
color
))
return
NULL
;
HiliteColor
(
&
color
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
Qd_AllocCursor
(
_self
,
_args
)
static
PyObject
*
Qd_AllocCursor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -2400,6 +2572,69 @@ static PyObject *Qd_GetCTSeed(_self, _args)
...
@@ -2400,6 +2572,69 @@ static PyObject *Qd_GetCTSeed(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Qd_Color2Index
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
long
_rv
;
RGBColor
myColor
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
QdRGB_Convert
,
&
myColor
))
return
NULL
;
_rv
=
Color2Index
(
&
myColor
);
_res
=
Py_BuildValue
(
"l"
,
_rv
);
return
_res
;
}
static
PyObject
*
Qd_Index2Color
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
long
index
;
RGBColor
aColor
;
if
(
!
PyArg_ParseTuple
(
_args
,
"l"
,
&
index
))
return
NULL
;
Index2Color
(
index
,
&
aColor
);
_res
=
Py_BuildValue
(
"O&"
,
QdRGB_New
,
&
aColor
);
return
_res
;
}
static
PyObject
*
Qd_InvertColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
RGBColor
myColor
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
InvertColor
(
&
myColor
);
_res
=
Py_BuildValue
(
"O&"
,
QdRGB_New
,
&
myColor
);
return
_res
;
}
static
PyObject
*
Qd_RealColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
RGBColor
color
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
QdRGB_Convert
,
&
color
))
return
NULL
;
_rv
=
RealColor
(
&
color
);
_res
=
Py_BuildValue
(
"b"
,
_rv
);
return
_res
;
}
static
PyObject
*
Qd_SetClientID
(
_self
,
_args
)
static
PyObject
*
Qd_SetClientID
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -3067,6 +3302,8 @@ static PyMethodDef Qd_methods[] = {
...
@@ -3067,6 +3302,8 @@ static PyMethodDef Qd_methods[] = {
"(PixPatHandle pp) -> None"
},
"(PixPatHandle pp) -> None"
},
{
"GetPixPat"
,
(
PyCFunction
)
Qd_GetPixPat
,
1
,
{
"GetPixPat"
,
(
PyCFunction
)
Qd_GetPixPat
,
1
,
"(short patID) -> (PixPatHandle _rv)"
},
"(short patID) -> (PixPatHandle _rv)"
},
{
"MakeRGBPat"
,
(
PyCFunction
)
Qd_MakeRGBPat
,
1
,
"(PixPatHandle pp, RGBColor myColor) -> None"
},
{
"FillCRect"
,
(
PyCFunction
)
Qd_FillCRect
,
1
,
{
"FillCRect"
,
(
PyCFunction
)
Qd_FillCRect
,
1
,
"(Rect r, PixPatHandle pp) -> None"
},
"(Rect r, PixPatHandle pp) -> None"
},
{
"FillCOval"
,
(
PyCFunction
)
Qd_FillCOval
,
1
,
{
"FillCOval"
,
(
PyCFunction
)
Qd_FillCOval
,
1
,
...
@@ -3079,12 +3316,36 @@ static PyMethodDef Qd_methods[] = {
...
@@ -3079,12 +3316,36 @@ static PyMethodDef Qd_methods[] = {
"(RgnHandle rgn, PixPatHandle pp) -> None"
},
"(RgnHandle rgn, PixPatHandle pp) -> None"
},
{
"FillCPoly"
,
(
PyCFunction
)
Qd_FillCPoly
,
1
,
{
"FillCPoly"
,
(
PyCFunction
)
Qd_FillCPoly
,
1
,
"(PolyHandle poly, PixPatHandle pp) -> None"
},
"(PolyHandle poly, PixPatHandle pp) -> None"
},
{
"RGBForeColor"
,
(
PyCFunction
)
Qd_RGBForeColor
,
1
,
"(RGBColor color) -> None"
},
{
"RGBBackColor"
,
(
PyCFunction
)
Qd_RGBBackColor
,
1
,
"(RGBColor color) -> None"
},
{
"SetCPixel"
,
(
PyCFunction
)
Qd_SetCPixel
,
1
,
"(short h, short v, RGBColor cPix) -> None"
},
{
"SetPortPix"
,
(
PyCFunction
)
Qd_SetPortPix
,
1
,
{
"SetPortPix"
,
(
PyCFunction
)
Qd_SetPortPix
,
1
,
"(PixMapHandle pm) -> None"
},
"(PixMapHandle pm) -> None"
},
{
"GetCPixel"
,
(
PyCFunction
)
Qd_GetCPixel
,
1
,
"(short h, short v) -> (RGBColor cPix)"
},
{
"GetForeColor"
,
(
PyCFunction
)
Qd_GetForeColor
,
1
,
"() -> (RGBColor color)"
},
{
"GetBackColor"
,
(
PyCFunction
)
Qd_GetBackColor
,
1
,
"() -> (RGBColor color)"
},
{
"OpColor"
,
(
PyCFunction
)
Qd_OpColor
,
1
,
"(RGBColor color) -> None"
},
{
"HiliteColor"
,
(
PyCFunction
)
Qd_HiliteColor
,
1
,
"(RGBColor color) -> None"
},
{
"AllocCursor"
,
(
PyCFunction
)
Qd_AllocCursor
,
1
,
{
"AllocCursor"
,
(
PyCFunction
)
Qd_AllocCursor
,
1
,
"() -> None"
},
"() -> None"
},
{
"GetCTSeed"
,
(
PyCFunction
)
Qd_GetCTSeed
,
1
,
{
"GetCTSeed"
,
(
PyCFunction
)
Qd_GetCTSeed
,
1
,
"() -> (long _rv)"
},
"() -> (long _rv)"
},
{
"Color2Index"
,
(
PyCFunction
)
Qd_Color2Index
,
1
,
"(RGBColor myColor) -> (long _rv)"
},
{
"Index2Color"
,
(
PyCFunction
)
Qd_Index2Color
,
1
,
"(long index) -> (RGBColor aColor)"
},
{
"InvertColor"
,
(
PyCFunction
)
Qd_InvertColor
,
1
,
"() -> (RGBColor myColor)"
},
{
"RealColor"
,
(
PyCFunction
)
Qd_RealColor
,
1
,
"(RGBColor color) -> (Boolean _rv)"
},
{
"SetClientID"
,
(
PyCFunction
)
Qd_SetClientID
,
1
,
{
"SetClientID"
,
(
PyCFunction
)
Qd_SetClientID
,
1
,
"(short id) -> None"
},
"(short id) -> None"
},
{
"ProtectEntry"
,
(
PyCFunction
)
Qd_ProtectEntry
,
1
,
{
"ProtectEntry"
,
(
PyCFunction
)
Qd_ProtectEntry
,
1
,
...
...
Mac/Modules/qd/qdgen.py
Dosyayı görüntüle @
232f3cd1
...
@@ -664,6 +664,12 @@ f = Function(PixPatHandle, 'GetPixPat',
...
@@ -664,6 +664,12 @@ f = Function(PixPatHandle, 'GetPixPat',
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'MakeRGBPat'
,
(
PixPatHandle
,
'pp'
,
InMode
),
(
RGBColor_ptr
,
'myColor'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'FillCRect'
,
f
=
Function
(
void
,
'FillCRect'
,
(
Rect_ptr
,
'r'
,
InMode
),
(
Rect_ptr
,
'r'
,
InMode
),
(
PixPatHandle
,
'pp'
,
InMode
),
(
PixPatHandle
,
'pp'
,
InMode
),
...
@@ -704,11 +710,55 @@ f = Function(void, 'FillCPoly',
...
@@ -704,11 +710,55 @@ f = Function(void, 'FillCPoly',
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'RGBForeColor'
,
(
RGBColor_ptr
,
'color'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'RGBBackColor'
,
(
RGBColor_ptr
,
'color'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'SetCPixel'
,
(
short
,
'h'
,
InMode
),
(
short
,
'v'
,
InMode
),
(
RGBColor_ptr
,
'cPix'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'SetPortPix'
,
f
=
Function
(
void
,
'SetPortPix'
,
(
PixMapHandle
,
'pm'
,
InMode
),
(
PixMapHandle
,
'pm'
,
InMode
),
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'GetCPixel'
,
(
short
,
'h'
,
InMode
),
(
short
,
'v'
,
InMode
),
(
RGBColor
,
'cPix'
,
OutMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'GetForeColor'
,
(
RGBColor
,
'color'
,
OutMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'GetBackColor'
,
(
RGBColor
,
'color'
,
OutMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'OpColor'
,
(
RGBColor_ptr
,
'color'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'HiliteColor'
,
(
RGBColor_ptr
,
'color'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'AllocCursor'
,
f
=
Function
(
void
,
'AllocCursor'
,
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
...
@@ -717,6 +767,27 @@ f = Function(long, 'GetCTSeed',
...
@@ -717,6 +767,27 @@ f = Function(long, 'GetCTSeed',
)
)
functions
.
append
(
f
)
functions
.
append
(
f
)
f
=
Function
(
long
,
'Color2Index'
,
(
RGBColor_ptr
,
'myColor'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'Index2Color'
,
(
long
,
'index'
,
InMode
),
(
RGBColor
,
'aColor'
,
OutMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'InvertColor'
,
(
RGBColor
,
'myColor'
,
OutMode
),
)
functions
.
append
(
f
)
f
=
Function
(
Boolean
,
'RealColor'
,
(
RGBColor_ptr
,
'color'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Function
(
void
,
'SetClientID'
,
f
=
Function
(
void
,
'SetClientID'
,
(
short
,
'id'
,
InMode
),
(
short
,
'id'
,
InMode
),
)
)
...
...
Mac/Modules/qd/qdscan.py
Dosyayı görüntüle @
232f3cd1
...
@@ -98,8 +98,6 @@ class MyScanner(Scanner):
...
@@ -98,8 +98,6 @@ class MyScanner(Scanner):
'PenState_ptr'
,
'PenState_ptr'
,
'Ptr'
,
'Ptr'
,
'QDProcs'
,
'QDProcs'
,
'RGBColor'
,
'RGBColor_ptr'
,
'ReqListRec'
,
'ReqListRec'
,
'void_ptr'
,
'void_ptr'
,
]
]
...
...
Mac/Modules/qd/qdsupport.py
Dosyayı görüntüle @
232f3cd1
...
@@ -42,12 +42,39 @@ CursHandle = OpaqueByValueType("CursHandle", "ResObj")
...
@@ -42,12 +42,39 @@ CursHandle = OpaqueByValueType("CursHandle", "ResObj")
CGrafPtr
=
OpaqueByValueType
(
"CGrafPtr"
,
"GrafObj"
)
CGrafPtr
=
OpaqueByValueType
(
"CGrafPtr"
,
"GrafObj"
)
GrafPtr
=
OpaqueByValueType
(
"GrafPtr"
,
"GrafObj"
)
GrafPtr
=
OpaqueByValueType
(
"GrafPtr"
,
"GrafObj"
)
BitMap_ptr
=
OpaqueByValueType
(
"BitMapPtr"
,
"BMObj"
)
BitMap_ptr
=
OpaqueByValueType
(
"BitMapPtr"
,
"BMObj"
)
RGBColor
=
OpaqueType
(
'RGBColor'
,
'QdRGB'
)
RGBColor_ptr
=
RGBColor
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
#include <
%
s>"""
%
MACHEADERFILE
+
"""
#include <
%
s>"""
%
MACHEADERFILE
+
"""
#include <Desk.h>
#include <Desk.h>
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
/*
** Parse/generate RGB records
*/
PyObject *QdRGB_New(itself)
RGBColorPtr itself;
{
return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
}
QdRGB_Convert(v, p_itself)
PyObject *v;
RGBColorPtr p_itself;
{
long red, green, blue;
if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
return 0;
p_itself->red = (unsigned short)red;
p_itself->green = (unsigned short)green;
p_itself->blue = (unsigned short)blue;
return 1;
}
"""
"""
## not yet...
## not yet...
##
##
...
...
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