root/HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/Display.pm

Revision 963 (checked in by tanimoto, 17 years ago)

0.20 ������������������

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 package HTTP::MobileAgent::Display;
2 use strict;
3 __PACKAGE__->HTTP::MobileAgent::make_accessors(
4     qw(width height color depth width_bytes height_bytes)
5 );
6
7 use vars qw($VERSION);
8 $VERSION = 0.17;
9
10 sub new {
11     my($class, %data) = @_;
12     bless {%data}, $class;
13 }
14
15 sub size {
16     my $self = shift;
17     return wantarray ? ($self->width, $self->height) : $self->width * $self->height;
18 }
19
20 1;
21 __END__
22
23 =head1 NAME
24
25 HTTP::MobileAgent::Display - Display information for HTTP::MobileAgent
26
27 =head1 SYNOPSIS
28
29   use HTTP::MobileAgent;
30
31   my $agent   = HTTP::MobileAgent->new;
32   my $display = $agent->display;
33
34   my $width  = $display->width;
35   my $height = $display->height:
36   my($width, $height) = $display->size;
37
38   if ($display->color) {
39       my $depth = $display->depth;
40   }
41
42   # only available in DoCoMo 505i
43   my $width_bytes  = $display->width_bytes;
44   my $height_bytes = $display->height_bytes;
45
46 =head1 DESCRIPTION
47
48 HTTP::MobileAgent::Display is a class for display information on
49 HTTP::MobileAgent. Handy for image resizing or dispatching.
50
51 =head1 METHODS
52
53 =over 4
54
55 =item width, height
56
57   $width  = $display->width;
58   $height = $display->height:
59
60 returns width and height of the display.
61
62 =item size
63
64   ($width, $height) = $display->size;
65   $size = $display->size;
66
67 returns width with height in array context, width * height in scalar context.
68
69 =item color
70
71   if ($display->color) { }
72
73 returns true if it has color capability.
74
75 =item depth
76
77   $depth = $display->depth;
78
79 returns color depth of the display.
80
81 =head1 USING EXTERNAL MAP FILE
82
83 If the environment variable DoCoMoMap exists, use the (xml) data indicated for $DisplayMap.
84
85 ex) Please add the following code.
86
87   $ENV{DoCoMoMap} = '/path/to/DoCoMoMap.xml';
88
89 =back
90
91 =head1 AUTHOR
92
93 Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
94
95 This library is free software; you can redistribute it and/or modify
96 it under the same terms as Perl itself.
97
98 =head1 SEE ALSO
99
100 L<HTTP::MobileAgent>, L<t/DoCoMoMap.xml>
101
102 =cut
Note: See TracBrowser for help on using the browser.