1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Defines abstract display classes
22 # Any class with a size
24 fun width
: Int is abstract
25 fun height
: Int is abstract
28 # General image class, will be specialized for each classes
31 fun destroy
is abstract
33 #var scale: Float is abstract
34 # Scale this image when blit
35 fun scale
: Float is abstract
36 fun scale
=( v
: Float ) is abstract
38 #var blended: Bool is abstract
39 # Use blending on this image?
40 fun blended
: Bool is abstract
41 fun blended
=( v
: Bool ) is abstract
43 # Get another image from this one
44 fun subimage
( x
, y
, w
, h
: Int ): Image is abstract
47 # General class for everything drawable to
48 # Is used by drawable images and display
52 # Call to prepare for drawing
55 # Call when drawing is finished
56 fun finish
is abstract
58 # Set viewport for drawing
59 fun set_viewport
( x
, y
, w
, h
: Int ) is abstract
61 # Draw image on self, for top left position
62 fun blit
( image
: I
, x
, y
: Int ) is abstract
64 # Draw image on self, for top left position but scaled
65 # the width and height of the target rectangle is specified
66 fun blit_scaled
(image
: Image, x
, y
, w
, h
: Int)
72 blit_stretched
(image
, fx
, fy
, fx
, fy2
, fx2
, fy2
, fx2
, fy
)
75 # Draw image, centered at position
76 fun blit_centered
( image
: I
, x
, y
: Int ) is abstract
78 # Draw image, centered at position but rotated
79 fun blit_rotated
( image
: I
, x
, y
, angle
: Float ) is abstract
81 # Draw image, centered, rotated and scaled
82 fun blit_rotated_scaled
( image
: I
, x
, y
, angle
, scale
: Float ) is abstract
84 # Draw image by specifying the positon of each image corners
85 # Corners are in counter-clockwise order stating top left
86 # a is top left, b is bottom left, c is bottom right and d is top right
92 fun blit_stretched
( image
: I
, ax
, ay
, bx
, by
, cx
, cy
, dx
, dy
: Float )
95 # Clear entire window with given color
96 fun clear
( r
, g
, b
: Float ) is abstract
99 # General display class, is sized and drawable
105 # General drawable display image
106 interface DrawableImage