This file is indexed.

/usr/lib/perl5/pods/SDL/Surface.pod is in libsdl-perl 2.540-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
=pod

=head1 NAME

SDL::Surface - Graphic surface structure

=head1 CATEGORY

Core, Video, Structure

=head1 SYNOPSIS

 use SDL;
 use SDL::Video;
 use SDL::Surface;

 # Create the main surface (display)
 SDL::init(SDL_INIT_VIDEO);
 my $display = SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);

 # Create other surfaces attached to the $display.
 my $surface  = SDL::Surface->new(SDL_ASYNCBLIT | SDL_HWSURFACE, 640, 480, 16, 0, 0, 0, 0);
 my $surface2 = SDL::Surface->new_from($surface, 100, 100, 8, 0, 0, 0, 0);

=head1 DESCRIPTION

An C<SDL_Surface> defines a surfaceangular area of pixels.

=head1 CONSTANTS

The constants for SDL::Surface belong to SDL::Video, under the export tag of C<':surface'>.

=over 4

=item SDL_ASYNCBLIT

Use asynchronous blit if possible

=item SDL_SWSURFACE

Store in system memory

=item SDL_HWSURFACE

Store in video memory

=back

=head1 METHODS

=head2 new

 my $surface = SDL::Surface->new(
     $flags, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask
 );

The constructor creates a new surface with the specified parameter values.

The four mask values are the bits that the channel will ignore.
For example, an Rmask of C<0xFF> will ignore that channel completely, making everything on the surface more green/blue.

=head2 new_from

 my $surface = SDL::Surface->new_from(
     $surface, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask
 );

The constructor creates a new surface with the specified parameter values.
The flags are taken from the specified C<$surface>.

=head2 w

 my $w = $surface->w;

Returns the width of the surface.
SDL::Surface width is defined at construction so this is read-only.

=head2 h

 my $h = $surface->h;

Returns the height of the surface.
SDL::Surface height is defined at construction so this is read-only.

=head2 format

 my $format = $surface->format;

The format of the pixels stored in the surface.
See L<SDL::PixelFormat>

=head2 pitch

 my $pitch = $surface->pitch;

The scanline length in bytes.

=head1 Direct Write to Surface Pixel

B<Disclaimer:> The following methods can be very slow, making them suitable for creating surfaces, but not for animations

=head2 get_pixel

 my $pixel = $surface->get_pixel( $offset )

Returns the numeric pixel value for the given C<$offset>.
The pixel value depends on current pixel format.

B<Note:> For surfaces with a palette (1 byte per pixel) the palette index is returned instead of color values.

=head2 set_pixels

 $surface->set_pixels( $offset, $value );

Sets the pixel C<$value> to the given C<$offset>.
The pixel value must fit the pixel format of the surface.

B<Note>: For surfaces with a palette (1 byte per pixel) the palette index must be passed instead of color values.

Example:

 sub putpixel {
     my ($x, $y, $color) = @_;
     $display->set_pixels( $x + $y * $display->w, $color);
 }

See also F<examples/pixel_operations/sols/ch02.pl>!

=head2 get_pixels_ptr

 my $ptr = $surface->get_pixels_ptr;

Returns a reference to the surface's pixels.

=head1 SEE ALSO

L<SDL>, L<SDL::PixelFormat>, L<SDL::Video>, L<SDL::Rect>

=head1 AUTHORS

See L<SDL/AUTHORS>.

=cut