Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXIcon Class Reference

An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask those pixels where the background should be preserved during the drawing, and a etch bitmap, which is used to draw the icon when it is disabled. More...

#include <FXIcon.h>

Inheritance diagram for FX::FXIcon:
FX::FXImage FX::FXDrawable FX::FXId FX::FXObject FX::FXBMPIcon FX::FXDDSIcon FX::FXEXEIcon FX::FXGIFIcon FX::FXICOIcon FX::FXIFFIcon FX::FXJP2Icon FX::FXJPGIcon FX::FXPCXIcon FX::FXPNGIcon FX::FXPPMIcon FX::FXRASIcon FX::FXRGBIcon FX::FXTGAIcon FX::FXTIFIcon FX::FXWEBPIcon FX::FXXBMIcon FX::FXXPMIcon

Public Member Functions

 FXIcon (FXApp *a, const FXColor *pix=nullptr, FXColor clr=0, FXuint opts=0, FXint w=1, FXint h=1)
 Create an icon with an initial pixel buffer pix, a transparent color clr, and options as in FXImage. More...
 
virtual void create ()
 Create the server side pixmap, the shape bitmap, and the etch bitmap, then call render() to fill it with the pixel data from the client-side buffer. More...
 
virtual void detach ()
 Detach the server side pixmap, shape bitmap, and etch bitmap from the Icon. More...
 
virtual void destroy ()
 Destroy the server-side pixmap and the shape bitmap and etch bitmap. More...
 
virtual void render ()
 Render the server-side pixmap, shape bitmap and etch bitmap for the icon from the client-side pixel buffer.
 
virtual void resize (FXint w, FXint h)
 Resize both client-side and server-side representations (if any) to the given width and height. More...
 
FXColor getTransparentColor () const
 Get transparency color.
 
void setTransparentColor (FXColor color)
 Change transparency color.
 
FXshort getThresholdValue () const
 Get threshold value.
 
void setThresholdValue (FXshort value)
 Change threshold value.
 
virtual ~FXIcon ()
 Destructor.
 
- Public Member Functions inherited from FX::FXImage
 FXImage (FXApp *a, const FXColor *pix=nullptr, FXuint opts=0, FXint w=1, FXint h=1)
 Create an image. More...
 
void setOptions (FXuint opts)
 Change options.
 
FXuint getOptions () const
 To get to the option flags.
 
void setOwned (FXbool owned)
 Set pixel data ownership flag.
 
FXbool isOwned () const
 Get pixel data ownership flag.
 
virtual void setData (FXColor *pix, FXuint opts=0)
 Populate the image with new pixel data of the same size; it will assume ownership of the pixel data if image IMAGE_OWNED option is passed. More...
 
virtual void setData (FXColor *pix, FXuint opts, FXint w, FXint h)
 Populate the image with new pixel data of a new size; it will assume ownership of the pixel data if image IMAGE_OWNED option is passed. More...
 
FXColor * getData () const
 Return pointer to the pixel data of the image.
 
FXColor getPixel (FXint x, FXint y) const
 Get pixel at x,y.
 
void setPixel (FXint x, FXint y, FXColor color)
 Change pixel at x,y.
 
FXbool hasAlpha () const
 Scan the image and return false if fully opaque.
 
virtual void restore ()
 Retrieves pixels from the server-side image. More...
 
virtual void release ()
 Release the client-side pixels buffer, free it if it was owned. More...
 
virtual void scale (FXint w, FXint h, FXint quality=0)
 Rescale pixels image to the specified width and height; this calls resize() to adjust the client and server side representations.
 
virtual void mirror (FXbool horizontal, FXbool vertical)
 Mirror image horizontally and/or vertically.
 
virtual void rotate (FXint degrees)
 Rotate image by degrees ccw; this calls resize() to adjust the client and server side representations if necessary.
 
virtual void crop (FXint x, FXint y, FXint w, FXint h, FXColor color=0)
 Crop image to given rectangle; this calls resize() to adjust the client and server side representations. More...
 
virtual void fill (FXColor color)
 Fill image with uniform color.
 
virtual void fade (FXColor color, FXint factor=255)
 Fade image to uniform color.
 
virtual void xshear (FXint shear, FXColor clr=0)
 Shear image horizontally; the number of pixels is equal to the shear parameter times 256. More...
 
virtual void yshear (FXint shear, FXColor clr=0)
 Shear image vertically; the number of pixels is equal to the shear parameter times 256. More...
 
virtual void hgradient (FXColor left, FXColor right)
 Fill horizontal gradient.
 
virtual void vgradient (FXColor top, FXColor bottom)
 Fill vertical gradient.
 
virtual void gradient (FXColor topleft, FXColor topright, FXColor bottomleft, FXColor bottomright)
 Fill with gradient.
 
virtual void blend (FXColor color)
 Blend image over uniform color.
 
virtual void invert ()
 Invert colors of an image.
 
virtual void colorize (FXColor color)
 Colorize image based on luminance.
 
virtual FXbool savePixels (FXStream &store) const
 Save pixel data only.
 
virtual FXbool loadPixels (FXStream &store)
 Load pixel data only.
 
virtual void save (FXStream &store) const
 Save object to stream.
 
virtual void load (FXStream &store)
 Load object from stream.
 
virtual ~FXImage ()
 Destructor.
 
- Public Member Functions inherited from FX::FXDrawable
FXVisualgetVisual () const
 Get the visual.
 
FXint getWidth () const
 Width of drawable.
 
FXint getHeight () const
 Height of drawable.
 
void setVisual (FXVisual *vis)
 Change visual.
 
virtual ~FXDrawable ()
 Cleanup.
 
- Public Member Functions inherited from FX::FXId
FXAppgetApp () const
 Get application.
 
FXID id () const
 Get XID handle.
 
void setUserData (FXptr ptr)
 Set user data pointer.
 
FXptr getUserData () const
 Get user data pointer.
 
virtual ~FXId ()
 Destructor.
 
- Public Member Functions inherited from FX::FXObject
const FXchar * getClassName () const
 Get class name of some object.
 
FXbool isMemberOf (const FXMetaClass *metaclass) const
 Check if object is member of metaclass.
 
virtual long tryHandle (FXObject *sender, FXSelector sel, void *ptr)
 Try handle message safely, catching certain exceptions.
 
virtual long onDefault (FXObject *, FXSelector, void *)
 Called for unhandled messages.
 
virtual ~FXObject ()
 Virtual destructor.
 

Protected Member Functions

FXColor guesstransp () const
 
FXshort guessthresh () const
 
- Protected Member Functions inherited from FX::FXDrawable
 FXDrawable (FXApp *a, FXint w, FXint h)
 
- Protected Member Functions inherited from FX::FXId
 FXId (FXApp *a)
 

Protected Attributes

FXID shape
 
FXID etch
 
FXColor transp
 
FXshort thresh
 
- Protected Attributes inherited from FX::FXImage
FXColor * data
 
FXuint options
 
- Protected Attributes inherited from FX::FXDrawable
FXVisualvisual
 
FXint width
 
FXint height
 
- Protected Attributes inherited from FX::FXId
FXID xid
 

Friends

class FXDC
 
class FXWindow
 
class FXDCWindow
 
class FXDrawable
 
class FXTopWindow
 

Detailed Description

An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask those pixels where the background should be preserved during the drawing, and a etch bitmap, which is used to draw the icon when it is disabled.

Constructor & Destructor Documentation

◆ FXIcon()

FX::FXIcon::FXIcon ( FXApp a,
const FXColor *  pix = nullptr,
FXColor  clr = 0,
FXuint  opts = 0,
FXint  w = 1,
FXint  h = 1 
)

Create an icon with an initial pixel buffer pix, a transparent color clr, and options as in FXImage.

The transparent color is used to determine which pixel values are transparent, i.e. need to be masked out in the absence of a true alpha channel. If the flag IMAGE_OPAQUE is passed, the shape and etch bitmaps are generated as if the image is fully opaque, even if it has an alpha channel or transparancy color. The flag IMAGE_ALPHACOLOR is used to force a specific alpha color instead of the alpha channel obtained from the image file. Specifying IMAGE_ALPHAGUESS causes Icon to obtain the alpha color from the background color of the image; it has the same effect as IMAGE_ALPHACOLOR in the sense that the icon will be transparent for those colors matching the alpha color.

Member Function Documentation

◆ create()

virtual void FX::FXIcon::create ( )
virtual

Create the server side pixmap, the shape bitmap, and the etch bitmap, then call render() to fill it with the pixel data from the client-side buffer.

After the server-side pixmap and bitmaps have been created, the client-side pixel buffer will be deleted unless IMAGE_KEEP has been specified. If the pixel buffer is not owned, i.e. the flag IMAGE_OWNED is not set, the pixel buffer will not be deleted; however the pixel buffer will be set to NULL.

Reimplemented from FX::FXImage.

◆ destroy()

virtual void FX::FXIcon::destroy ( )
virtual

Destroy the server-side pixmap and the shape bitmap and etch bitmap.

The client-side pixel buffer is not affected.

Reimplemented from FX::FXImage.

◆ detach()

virtual void FX::FXIcon::detach ( )
virtual

Detach the server side pixmap, shape bitmap, and etch bitmap from the Icon.

Afterwards, the Icon is left as if it never had a server-side resources.

Reimplemented from FX::FXImage.

◆ resize()

virtual void FX::FXIcon::resize ( FXint  w,
FXint  h 
)
virtual

Resize both client-side and server-side representations (if any) to the given width and height.

The new representations typically contain garbage after this operation and need to be re-filled.

Reimplemented from FX::FXImage.


The documentation for this class was generated from the following file:

Copyright © 1997-2022 Jeroen van der Zijp