forked from slyrus/mcclim-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixmap.lisp
93 lines (73 loc) · 3.45 KB
/
pixmap.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
;;; -*- Mode: Lisp; Package: CLIM-INTERNALS -*-
;;; (c) copyright 2001 by Iban HATCHONDO ([email protected])
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Library General Public
;;; License as published by the Free Software Foundation; either
;;; version 2 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Library General Public License for more details.
;;;
;;; You should have received a copy of the GNU Library General Public
;;; License along with this library; if not, write to the
;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;;; Boston, MA 02111-1307 USA.
(in-package :clim-internals)
(defclass pixmap ()
((sheet :initarg :sheet :reader pixmap-sheet)
(width :initarg :width :reader pixmap-width)
(height :initarg :height :reader pixmap-height)
))
(defgeneric pixmap-mirror (mirrored-pixmap))
(defgeneric allocate-pixmap (sheet width height))
(defgeneric deallocate-pixmap (pixmap))
(defgeneric copy-to-pixmap (medium medium-x medium-y width height
&optional pixmap pixmap-x pixmap-y))
(defgeneric copy-from-pixmap (pixmap from-x from-y width height
medium medium-x medium-y))
(defgeneric copy-area (medium from-x from-y width height to-x to-y))
(defgeneric medium-copy-area (from-drawable from-x from-y width height
to-drawable to-x to-y))
(defclass mirrored-pixmap (pixmap)
((port :initform nil :initarg :port :accessor port)
(medium :initform nil :accessor pixmap-medium)
(region :initform nil :accessor sheet-region)
))
; added this. CHECKME -- BTS
(defmethod (setf %sheet-medium) (value (pixmap mirrored-pixmap))
(setf (slot-value pixmap 'medium) value))
(defmethod invalidate-cached-transformations ((sheet mirrored-pixmap))
(values))
(defmethod invalidate-cached-regions ((sheet mirrored-pixmap))
(values))
; BTS stopped adding. ^-- CHECKME
(defmethod initialize-instance :after ((pixmap mirrored-pixmap) &rest args)
(declare (ignore args))
(with-slots (width height region) pixmap
(setf region (make-bounding-rectangle 0 0 width height))))
(defmethod pixmap-mirror ((pixmap mirrored-pixmap))
(port-lookup-mirror (port pixmap) pixmap))
(defmethod allocate-pixmap ((sheet sheet) width height)
(port-allocate-pixmap (port sheet) sheet width height))
(defmethod deallocate-pixmap ((pixmap pixmap))
(port-deallocate-pixmap (port (medium-sheet pixmap)) pixmap))
(defmethod deallocate-pixmap ((pixmap mirrored-pixmap))
(port-deallocate-pixmap (port pixmap) pixmap))
(defmethod sheet-native-transformation ((pixmap mirrored-pixmap))
+identity-transformation+)
(defmethod sheet-native-region ((pixmap mirrored-pixmap))
(make-rectangle* 0 0
(pixmap-width pixmap)
(pixmap-height pixmap)))
(defmethod sheet-device-transformation ((pixmap mirrored-pixmap))
(medium-transformation (pixmap-medium pixmap)))
(defmethod sheet-device-region ((pixmap mirrored-pixmap))
(region-intersection
(sheet-native-region pixmap)
(transform-region
(sheet-device-transformation pixmap)
(medium-clipping-region (pixmap-medium pixmap)))))
(defmethod sheet-direct-mirror ((pixmap mirrored-pixmap))
(port-lookup-mirror (port pixmap) pixmap))