os_image
|
 |
An inline image.
An os_image
is an image that is rendered inline with surrounding text. The source URL of the
displayed image is specified in a constructor and can be modified through the source()
member function. The URL typically references an image in the GIF or JPEG
format. A text alternative, displayed instead of the image or while the image is
being retrieved, can be specified through either a constructor or the alternate()
member function.
Several member functions are
provided to control the rendering of an os_image by
the browser.
align()
-Specifies the alignment of the image with respect to surrounding text.
hspace()
and vspace() -Specifies the horizontal and
vertical space between the image and surrounding text.
border()
-Specifies the width of the border surrounding the image. A width of 0
implies no border.
lowsrc()
-Specifies a smaller, low-resolution image for the browser to display while
a large image is being retrieved.
Note that the hspace()
, vspace() , border()
, and lowsrc() member functions support HTML
extensions implemented by Netscape browsers.
An os_image
is rendered full size by default. An os_image can
be scaled by specifying the height, width, and units of the bounding box within
which the image must fit, through the height() , width()
, and units() member functions. The units default
to pixels. Note that these member functions support features proposed for HTML
3.0 and may not be supported by all browsers.
An os_image
can be made active through either a CGI (Common Gateway Interface) program or an
os_image_map . When an image is active, a mouse
selection within the image is translated into an action by either the CGI
program or the os_image_map .
For an os_image
to be active through a CGI program, the image must enable CGI mapping though the
ismap() member function. Additionally, the os_image
must be contained within an os_hyperlink , which
specifies the URL of the CGI program. The mouse selection is transmitted to the
CGI program by appending ? x
, y to the URL specified by the os_hyperlink
, where x and y are the coordinates of the mouse selection, measured in pixels,
from the upper left corner of the image. The CGI program is responsible for
translating the coordinates into an action.
For an os_image
to be active through an os_image_map , it must be
associated with an os_image_map through the usemap()
member function. It is not required to be contained within an os_hyperlink
. Instead, the os_image_map defines hyperlinks
between regions within the image and destination URLs. Note that the usemap()
member function supports HTML extensions implemented by Netscape Navigator 2.0
and Microsoft Internet Explorer 2.0.
Declaration
#include <ospace/web/image.h>
class os_image : public os_element
Enums
enum os_image::alignment
{
top, // Aligns the top of image with the line's text.
middle, // Aligns the middle of image with the line's text.
bottom, // Aligns the bottom of the image with the line's text.
right, // Aligns the image along the right margin and allows text to flow beside.
left // Aligns the image along the left margin and allows text to flow beside.
};
enum os_image::units_type
{
pixels, // Sets height and width units to pixels.
en // Sets height and width units to one-half the point size of the text.
};
Interface
Constructor
os_image(
const string& source )
Creates an inline image to
include the image file at the URL source .
Constructor
os_image(
const string& source ,
const string& alternate )
Creates an inline image to
include the image file at the URL source with text
alternative alternate .
Constructor
os_image(
const string& source ,
alignment align )
Creates an inline image to
include the image file at the URL source with
alignment align .
Constructor
os_image(
const string& source ,
const string& alternate ,
alignment align )
Creates an inline image to
include the image file at the URL source , with
text alternative alternate and alignment align
.
align
int
align() const
Returns the alignment
relative to surrounding text, or os_element::use_default
if not set.
align
os_image&
align( alignment align )
Sets the alignment
relative to surrounding text to align and returns
a reference to the inline image.
alternate
os_image&
alternate( const string& alternate )
Sets the text alternative
to alternate and returns a reference to the inline
image.
alternate
string
alternate() const
Returns the text
alternative, or the empty string if not set.
border
int
border() const
Returns the width, in
pixels, of the border surrounding the image, or 0 if not set.
border
os_image&
border( int border )
Sets the width of the
border surrounding the image to border pixels, and
returns a reference to the inline image.
clone
/*
virtual */ os_element* clone() const
Returns a base class
pointer to a heap-based deep copy of the image.
height
os_image&
height( int height )
Sets, to height
, the height of the bounding box within which the image is to be displayed,
and returns a reference to the inline image.
height
int
height() const
Returns the height of the
bounding box within which the image is to be displayed, or 0 if not set.
hspace
int
hspace() const
Returns the horizontal
space, in pixels, between the image and surrounding text, or 0 if not set.
hspace
os_image&
hspace( int hspace )
Sets the horizontal space
between the image and surrounding text to hspace pixels,
and returns a reference to the inline image.
ismap
os_image&
ismap( bool ismap )
Sets the active status to ismap
and returns a reference to the inline image.
ismap
bool
ismap() const
Returns true
if the image is active via a server-side gateway program.
lowsrc
os_image&
lowsrc( const string& lowsrc )
Sets the low resolution
version of the image to the URL lowsrc , and
returns a reference to the inline image.
lowsrc
string
lowsrc() const
Returns the URL of the low
resolution version of the image, or the empty string if not set.
source
string
source() const
Returns the image file
URL.
source
os_image&
source( const string& source )
Sets the image file source
to the URL source and returns a reference to the
inline image.
units
os_image&
units( units_type units )
Sets, to units
, the units of the bounding box within which the image is to be displayed,
and returns a reference to the inline image.
units
int
units() const
Returns the units of the
bounding box within which the image is to be displayed, or os_element::use_default
if not set.
usemap
os_image&
usemap( const string& label )
Sets the inline image to
be active via the client-side image map specified by label
and returns a reference to the inline image. The client-side image map
specified by label must be on the same page as the
inline image.
usemap
os_image&
usemap( const string& url ,
const string& label )
Sets the inline image to
be active via the client-side image map specified by url
and label , and returns a reference to the
inline image.
usemap
pair<string,
string> usemap() const
Returns a pair of strings
containing the URL and label of the client-side image map, or empty strings
if not set.
vspace
os_image&
vspace( int vspace )
Sets the vertical space
between the image and surrounding text to vspace
pixels, and returns a reference to the inline image.
vspace
int
vspace() const
Returns the vertical
space, in pixels, between the image and surrounding text, or 0 if not set.
width
int
width() const
Returns the width of the
bounding box within which the image is to be displayed, or 0 if not set.
width
os_image&
width( int width )
Sets, to
width , the width of the bounding box within which the image is to be
displayed, and returns a reference to the inline image.
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved