/[mcclim]/mcclim/pixmap.lisp
ViewVC logotype

Contents of /mcclim/pixmap.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Sun Oct 14 15:35:08 2001 UTC (12 years, 6 months ago) by rouanet
Branch: MAIN
Changes since 1.2: +16 -5 lines
Implemented the {native,device}-{transformation,region} code for
pixmaps, which allows the drawing functions to work with pixmaps.
1 ;;; -*- Mode: Lisp; Package: CLIM-INTERNALS -*-
2
3 ;;; (c) copyright 2001 by Iban HATCHONDO (hatchond@mei.u-bordeaux.fr)
4
5 ;;; This library is free software; you can redistribute it and/or
6 ;;; modify it under the terms of the GNU Library General Public
7 ;;; License as published by the Free Software Foundation; either
8 ;;; version 2 of the License, or (at your option) any later version.
9 ;;;
10 ;;; This library is distributed in the hope that it will be useful,
11 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;; Library General Public License for more details.
14 ;;;
15 ;;; You should have received a copy of the GNU Library General Public
16 ;;; License along with this library; if not, write to the
17 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 ;;; Boston, MA 02111-1307 USA.
19
20 (in-package :CLIM-INTERNALS)
21
22 (defclass pixmap ()
23 ((sheet :initarg :sheet :reader pixmap-sheet)
24 (width :initarg :width :reader pixmap-width)
25 (height :initarg :height :reader pixmap-height)
26 ))
27
28 (defgeneric pixmap-mirror (mirrored-pixmap))
29 (defgeneric allocate-pixmap (sheet width height))
30 (defgeneric deallocate-pixmap (pixmap))
31 (defgeneric copy-to-pixmap (medium medium-x medium-y width height
32 &optional pixmap (pixmap-x 0) (pixmap-y 0)))
33 (defgeneric copy-from-pixmap (pixmap from-x from-y width height
34 medium medium-x medium-y))
35 (defgeneric copy-area (medium from-x from-y width height to-x to-y))
36 (defgeneric medium-copy-area (from-drawable from-x from-y width height
37 to-drawable to-x to-y))
38
39 (defclass mirrored-pixmap (pixmap)
40 ((port :initform nil :initarg :port :accessor port)
41 (medium :initform nil :accessor pixmap-medium)
42 (region :initform nil :accessor sheet-region)
43 ))
44
45 (defmethod initialize-instance :after ((pixmap mirrored-pixmap) &rest args)
46 (declare (ignore args))
47 (with-slots (width height region) pixmap
48 (setf region (make-bounding-rectangle 0 0 width height))))
49
50 (defmethod pixmap-mirror ((pixmap mirrored-pixmap))
51 (port-lookup-mirror (port pixmap) pixmap))
52
53 (defmethod allocate-pixmap ((sheet sheet) width height)
54 (port-allocate-pixmap (port sheet) sheet width height))
55
56 (defmethod deallocate-pixmap ((pixmap pixmap))
57 (port-deallocate-pixmap (port (pixmap-sheet pixmap)) pixmap))
58
59 (defmethod sheet-native-transformation ((pixmap mirrored-pixmap))
60 +identity-transformation+)
61
62 (defmethod sheet-native-region ((pixmap mirrored-pixmap))
63 (make-rectangle* 0 0
64 (pixmap-width pixmap)
65 (pixmap-height pixmap)))
66
67 (defmethod sheet-device-transformation ((pixmap mirrored-pixmap))
68 (medium-transformation (pixmap-medium pixmap)))
69
70 (defmethod sheet-device-region ((pixmap mirrored-pixmap))
71 (region-intersection
72 (sheet-native-region pixmap)
73 (transform-region
74 (sheet-device-transformation pixmap)
75 (medium-clipping-region (pixmap-medium pixmap)))))

  ViewVC Help
Powered by ViewVC 1.1.5