org.gnu.gtk

Class Image


public class Image
extends Misc

The Image widget displays an image. Various kinds of objects can be displayed as an image; most typically you would create a Pixbuf from a file and then display that.

If the file isn't loaded successfully, the image will contain a "broken image" icon similar to that used in many web browsers.

Constructor Summary

Image()
Constructs a new Image.
Image(Handle handle)
Construct an Image from a handle to a native resource.
Image(String filename)
Construct a new image passing the filename of an image.
Image(String iconName, IconSize size)
Create an Image
Image(Image image, Bitmap mask)
Create an Image widget displaying a image and a mask.
Image(Pixbuf pixbuf)
Creates an Image from a Pixbuf.
Image(PixbufAnimation animation)
Creates an Image displaying the given PixbufAnimation.
Image(Pixmap pixmap, Bitmap mask)
Create an Image from a Pixmap.
Image(GtkStockItem stockId, IconSize size)
Create an Image displaying a Stock icon.
Image(IconSet iconSet, IconSize size)
Creates an Image displaying an IconSet.

Method Summary

String
getIconName()
Image
getImage()
Gets the Image being displayed by this.
static Image
getImage(Handle handle)
Construct an Image from a handle to a native resource.
Bitmap
getImageMask()
Gets the Bitmap being used as a map by the Image The storage type of the image must be GTK_IMAGE_EMPTY or GTK_IMAGE_IMAGE.
Pixbuf
getPixbuf()
Gets the Pixbuf being displayed by the Image.
int
getPixelSize()
ImageType
getStorageType()
Gets the type of representation being used by the Image to store image data.
static Type
getType()
Retrieve the runtime type used by the GLib library.
void
set(String filename)
Sets the image from a file
void
set(String iconName, IconSize size)
void
set(Image image, Bitmap mask)
Sets the image widget to displaying a image and a mask.
void
set(Pixbuf pixbuf)
Sets the Image from a Pixbuf.
void
set(PixbufAnimation animation)
Sets to image to the given PixbufAnimation.
void
set(Pixmap pixmap, Bitmap mask)
Sets the image to the given Pixmap.
void
set(GtkStockItem stockId, IconSize size)
Set the image to a Stock icon.
void
set(IconSet iconSet, IconSize size)
Sets the image to displayian IconSet.
void
setPixelSize(int pixelSize)

Methods inherited from class org.gnu.gtk.Misc

getType, getXAlign, getXPadding, getYAlign, getYPadding, setAlignment, setPadding

Methods inherited from class org.gnu.gtk.Widget

activate, addAccelerator, addEvents, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, draw, drawArea, drawArea, finish, getAccessible, getAllocation, getCanFocus, getColormap, getContext, getData, getDisplay, getDragData, getEventListenerClass, getEventType, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getType, getWidget, getWindow, grabDefault, grabFocus, hasFocus, hasScreen, hide, hideAll, highlight, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeAccelerator, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setCanFocus, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setEvents, setExtensionEvents, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight, unHighlight

Methods inherited from class org.gnu.gtk.GtkObject

destroy, getType, sink

Methods inherited from class org.gnu.glib.GObject

addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify

Constructor Details

Image

public Image()
Constructs a new Image. This will be displayed as a "no image" icon until an image is set using one of the set* methods.

Image

public Image(Handle handle)
Construct an Image from a handle to a native resource.

Image

public Image(String filename)
Construct a new image passing the filename of an image.
Parameters:
filename - The filename for the image to load.

Image

public Image(String iconName,
             IconSize size)
Create an Image

Image

public Image(Image image,
             Bitmap mask)
Create an Image widget displaying a image and a mask. A org.gnu.gdk.Image is a client-side image buffer in the pixel format of the current display.
Parameters:
image - The org.gnu.gdk.Image to use for this object creation.
mask - The org.gnu.gdk.Mask to apply to the image.

Image

public Image(Pixbuf pixbuf)
Creates an Image from a Pixbuf.
Parameters:
pixbuf - The Pixbuf to use for the Image creation.

Image

public Image(PixbufAnimation animation)
Creates an Image displaying the given PixbufAnimation.
Parameters:
animation - The PixbufAnimation to use for this object creation.

Image

public Image(Pixmap pixmap,
             Bitmap mask)
Create an Image from a Pixmap.
Parameters:
pixmap - The Pixmap to use for the Image creation.
mask - The mask to apply to the created Image.

Image

public Image(GtkStockItem stockId,
             IconSize size)
Create an Image displaying a Stock icon.
Parameters:
stockId - The id of the Stock icon to display.
size - The size of the icon.

Image

public Image(IconSet iconSet,
             IconSize size)
Creates an Image displaying an IconSet.
Parameters:
iconSet - The IconSet to use for the Image.
size - The IconSize to use for the Image.

Method Details

getIconName

public String getIconName()

getImage

public Image getImage()
Gets the Image being displayed by this. The storage type of the image must be GTK_IMAGE_EMPTY or GTK_IMAGE_IMAGE.
Returns:
The image being displayed by the image

getImage

public static Image getImage(Handle handle)
Construct an Image from a handle to a native resource.

getImageMask

public Bitmap getImageMask()
Gets the Bitmap being used as a map by the Image The storage type of the image must be GTK_IMAGE_EMPTY or GTK_IMAGE_IMAGE.
Returns:
The map being used by the image

getPixbuf

public Pixbuf getPixbuf()
Gets the Pixbuf being displayed by the Image. The storage type of the image must be GTK_IMAGE_EMPTY or GTK_IMAGE_PIXBUF.
Returns:
The pixbuf being used by the image.

getPixelSize

public int getPixelSize()

getStorageType

public ImageType getStorageType()
Gets the type of representation being used by the Image to store image data.

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.
Overrides:
getType in interface Misc

set

public void set(String filename)
Sets the image from a file
Parameters:
filename - The filename for the image to load.

set

public void set(String iconName,
                IconSize size)

set

public void set(Image image,
                Bitmap mask)
Sets the image widget to displaying a image and a mask. A org.gnu.gdk.Image is a client-side image buffer in the pixel format of the current display.
Parameters:
image - The org.gnu.gdk.Image to use for this object.
mask - The org.gnu.gdk.Mask to apply to the image.

set

public void set(Pixbuf pixbuf)
Sets the Image from a Pixbuf.
Parameters:
pixbuf - The Pixbuf to use for the Image.

set

public void set(PixbufAnimation animation)
Sets to image to the given PixbufAnimation.
Parameters:
animation - The PixbufAnimation to use for this object.

set

public void set(Pixmap pixmap,
                Bitmap mask)
Sets the image to the given Pixmap.
Parameters:
pixmap - The Pixmap to use for the Image.
mask - The mask to apply to the Image.

set

public void set(GtkStockItem stockId,
                IconSize size)
Set the image to a Stock icon.
Parameters:
stockId - The id of the Stock icon to display.
size - The size of the icon.

set

public void set(IconSet iconSet,
                IconSize size)
Sets the image to displayian IconSet.
Parameters:
iconSet - The IconSet to use for the Image.
size - The IconSize to use for the Image.

setPixelSize

public void setPixelSize(int pixelSize)