You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
826 lines
53 KiB
826 lines
53 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpixmap.cpp:53 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQPixmap Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQPixmap Class Reference</h1>
|
|
|
|
<p>The TQPixmap class is an off-screen, pixel-based paint device.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qpixmap-h.html">ntqpixmap.h</a>></tt>
|
|
<p>Inherits <a href="ntqpaintdevice.html">TQPaintDevice</a> and <a href="ntqt.html">TQt</a>.
|
|
<p>Inherited by <a href="ntqbitmap.html">TQBitmap</a> and <a href="tqcanvaspixmap.html">TQCanvasPixmap</a>.
|
|
<p><a href="qpixmap-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn>enum <a href="#ColorMode-enum"><b>ColorMode</b></a> { Auto, Color, Mono }</li>
|
|
<li class=fn>enum <a href="#Optimization-enum"><b>Optimization</b></a> { DefaultOptim, NoOptim, MemoryOptim = NoOptim, NormalOptim, BestOptim }</li>
|
|
<li class=fn><a href="#TQPixmap"><b>TQPixmap</b></a> ()</li>
|
|
<li class=fn><a href="#TQPixmap-2"><b>TQPixmap</b></a> ( const TQImage & image )</li>
|
|
<li class=fn><a href="#TQPixmap-3"><b>TQPixmap</b></a> ( int w, int h, int depth = -1, Optimization optimization = DefaultOptim )</li>
|
|
<li class=fn><a href="#TQPixmap-4"><b>TQPixmap</b></a> ( const TQSize & size, int depth = -1, Optimization optimization = DefaultOptim )</li>
|
|
<li class=fn><a href="#TQPixmap-5"><b>TQPixmap</b></a> ( const TQString & fileName, const char * format = 0, ColorMode mode = Auto )</li>
|
|
<li class=fn><a href="#TQPixmap-6"><b>TQPixmap</b></a> ( const TQString & fileName, const char * format, int conversion_flags )</li>
|
|
<li class=fn><a href="#TQPixmap-7"><b>TQPixmap</b></a> ( const char * xpm[] )</li>
|
|
<li class=fn><a href="#TQPixmap-8"><b>TQPixmap</b></a> ( const TQByteArray & img_data )</li>
|
|
<li class=fn><a href="#TQPixmap-9"><b>TQPixmap</b></a> ( const TQPixmap & pixmap )</li>
|
|
<li class=fn><a href="#~TQPixmap"><b>~TQPixmap</b></a> ()</li>
|
|
<li class=fn>TQPixmap & <a href="#operator-eq"><b>operator=</b></a> ( const TQPixmap & pixmap )</li>
|
|
<li class=fn>TQPixmap & <a href="#operator-eq-2"><b>operator=</b></a> ( const TQImage & image )</li>
|
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
|
<li class=fn>int <a href="#width"><b>width</b></a> () const</li>
|
|
<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
|
|
<li class=fn>TQSize <a href="#size"><b>size</b></a> () const</li>
|
|
<li class=fn>TQRect <a href="#rect"><b>rect</b></a> () const</li>
|
|
<li class=fn>int <a href="#depth"><b>depth</b></a> () const</li>
|
|
<li class=fn>void <a href="#fill"><b>fill</b></a> ( const TQColor & fillColor = TQt::white )</li>
|
|
<li class=fn>void <a href="#fill-2"><b>fill</b></a> ( const TQWidget * widget, int xofs, int yofs )</li>
|
|
<li class=fn>void <a href="#fill-3"><b>fill</b></a> ( const TQWidget * widget, const TQPoint & ofs )</li>
|
|
<li class=fn>void <a href="#resize"><b>resize</b></a> ( int w, int h )</li>
|
|
<li class=fn>void <a href="#resize-2"><b>resize</b></a> ( const TQSize & size )</li>
|
|
<li class=fn>const TQBitmap * <a href="#mask"><b>mask</b></a> () const</li>
|
|
<li class=fn>void <a href="#setMask"><b>setMask</b></a> ( const TQBitmap & newmask )</li>
|
|
<li class=fn>bool <a href="#selfMask"><b>selfMask</b></a> () const</li>
|
|
<li class=fn>bool <a href="#hasAlpha"><b>hasAlpha</b></a> () const</li>
|
|
<li class=fn>bool <a href="#hasAlphaChannel"><b>hasAlphaChannel</b></a> () const</li>
|
|
<li class=fn>TQBitmap <a href="#createHeuristicMask"><b>createHeuristicMask</b></a> ( bool clipTight = TRUE ) const</li>
|
|
<li class=fn>TQPixmap <a href="#xForm"><b>xForm</b></a> ( const TQWMatrix & matrix ) const</li>
|
|
<li class=fn>TQImage <a href="#convertToImage"><b>convertToImage</b></a> () const</li>
|
|
<li class=fn>bool <a href="#convertFromImage-2"><b>convertFromImage</b></a> ( const TQImage & image, ColorMode mode = Auto )</li>
|
|
<li class=fn>bool <a href="#convertFromImage"><b>convertFromImage</b></a> ( const TQImage & img, int conversion_flags )</li>
|
|
<li class=fn>bool <a href="#load-2"><b>load</b></a> ( const TQString & fileName, const char * format = 0, ColorMode mode = Auto )</li>
|
|
<li class=fn>bool <a href="#load"><b>load</b></a> ( const TQString & fileName, const char * format, int conversion_flags )</li>
|
|
<li class=fn>bool <a href="#loadFromData-2"><b>loadFromData</b></a> ( const uchar * buf, uint len, const char * format = 0, ColorMode mode = Auto )</li>
|
|
<li class=fn>bool <a href="#loadFromData"><b>loadFromData</b></a> ( const uchar * buf, uint len, const char * format, int conversion_flags )</li>
|
|
<li class=fn>bool <a href="#loadFromData-3"><b>loadFromData</b></a> ( const TQByteArray & buf, const char * format = 0, int conversion_flags = 0 )</li>
|
|
<li class=fn>bool <a href="#save"><b>save</b></a> ( const TQString & fileName, const char * format, int quality = -1 ) const</li>
|
|
<li class=fn>bool <a href="#save-2"><b>save</b></a> ( TQIODevice * device, const char * format, int quality = -1 ) const</li>
|
|
<li class=fn>int <a href="#serialNumber"><b>serialNumber</b></a> () const</li>
|
|
<li class=fn>Optimization <a href="#optimization"><b>optimization</b></a> () const</li>
|
|
<li class=fn>void <a href="#setOptimization"><b>setOptimization</b></a> ( Optimization optimization )</li>
|
|
<li class=fn>virtual void <a href="#detach"><b>detach</b></a> ()</li>
|
|
<li class=fn>bool <a href="#isTQBitmap"><b>isTQBitmap</b></a> () const</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>int <a href="#defaultDepth"><b>defaultDepth</b></a> ()</li>
|
|
<li class=fn>TQPixmap <a href="#fromMimeSource"><b>fromMimeSource</b></a> ( const TQString & abs_name )</li>
|
|
<li class=fn>TQPixmap <a href="#grabWindow"><b>grabWindow</b></a> ( WId window, int x = 0, int y = 0, int w = -1, int h = -1 )</li>
|
|
<li class=fn>TQPixmap <a href="#grabWidget"><b>grabWidget</b></a> ( TQWidget * widget, int x = 0, int y = 0, int w = -1, int h = -1 )</li>
|
|
<li class=fn>TQWMatrix <a href="#trueMatrix"><b>trueMatrix</b></a> ( const TQWMatrix & matrix, int w, int h )</li>
|
|
<li class=fn>const char * <a href="#imageFormat"><b>imageFormat</b></a> ( const TQString & fileName )</li>
|
|
<li class=fn>Optimization <a href="#defaultOptimization"><b>defaultOptimization</b></a> ()</li>
|
|
<li class=fn>void <a href="#setDefaultOptimization"><b>setDefaultOptimization</b></a> ( Optimization optimization )</li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQPixmap-a"><b>TQPixmap</b></a> ( int w, int h, const uchar * bits, bool isXbitmap )</li>
|
|
<li class=fn>virtual int <a href="#metric"><b>metric</b></a> ( int m ) const</li>
|
|
</ul>
|
|
<h2>Related Functions</h2>
|
|
<ul>
|
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQPixmap & pixmap )</li>
|
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQPixmap & pixmap )</li>
|
|
<li class=fn>void <a href="#copyBlt"><b>copyBlt</b></a> ( TQPixmap * dst, int dx, int dy, const TQPixmap * src, int sx, int sy, int sw, int sh )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQPixmap class is an off-screen, pixel-based paint device.
|
|
<p>
|
|
|
|
|
|
|
|
<p> TQPixmap is one of the two classes TQt provides for dealing with
|
|
images; the other is <a href="ntqimage.html">TQImage</a>. TQPixmap is designed and optimized
|
|
for drawing; TQImage is designed and optimized for I/O and for
|
|
direct pixel access/manipulation. There are (slow) functions to
|
|
convert between TQImage and TQPixmap: <a href="#convertToImage">convertToImage</a>() and
|
|
<a href="#convertFromImage">convertFromImage</a>().
|
|
<p> One common use of the TQPixmap class is to enable smooth updating
|
|
of widgets. Whenever something complex needs to be drawn, you can
|
|
use a pixmap to obtain flicker-free drawing, like this:
|
|
<p> <ol type=1>
|
|
<li> Create a pixmap with the same size as the widget.
|
|
<li> Fill the pixmap with the widget background color.
|
|
<li> Paint the pixmap.
|
|
<li> <a href="ntqpaintdevice.html#bitBlt">bitBlt</a>() the pixmap contents onto the widget.
|
|
</ol>
|
|
<p> Pixel data in a pixmap is internal and is managed by the
|
|
underlying window system. Pixels can be accessed only through
|
|
<a href="ntqpainter.html">TQPainter</a> functions, through bitBlt(), and by converting the
|
|
TQPixmap to a TQImage.
|
|
<p> You can easily display a TQPixmap on the screen using
|
|
<a href="ntqlabel.html#setPixmap">TQLabel::setPixmap</a>(). For example, all the <a href="ntqbutton.html">TQButton</a> subclasses
|
|
support pixmap use.
|
|
<p> The TQPixmap class uses <a href="shclass.html">copy-on-write</a>,
|
|
so it is practical to pass TQPixmap objects by value.
|
|
<p> You can retrieve the <a href="#width">width</a>(), <a href="#height">height</a>(), <a href="#depth">depth</a>() and <a href="#size">size</a>() of a
|
|
pixmap. The enclosing rectangle is given by <a href="#rect">rect</a>(). Pixmaps can be
|
|
filled with <a href="#fill">fill</a>() and resized with <a href="#resize">resize</a>(). You can create and
|
|
set a mask with <a href="#createHeuristicMask">createHeuristicMask</a>() and <a href="#setMask">setMask</a>(). Use
|
|
<a href="#selfMask">selfMask</a>() to see if the pixmap is identical to its mask.
|
|
<p> In addition to loading a pixmap from file using <a href="#load">load</a>() you can
|
|
also <a href="#loadFromData">loadFromData</a>(). You can control optimization with
|
|
<a href="#setOptimization">setOptimization</a>() and obtain a transformed version of the pixmap
|
|
using <a href="#xForm">xForm</a>()
|
|
<p> Note regarding Windows 95 and 98: on Windows 9x the system crashes
|
|
if you create more than about 1000 pixmaps, independent of the
|
|
size of the pixmaps or installed RAM. Windows NT-systems (including
|
|
2000, XP and following versions) do not have the same limitation,
|
|
but depending on the graphics equipment the system will fail to
|
|
allocate pixmap objects at some point (due to system running out of
|
|
GDI resources).
|
|
<p> TQt tries to work around the resource limitation. If you set the
|
|
pixmap optimization to <a href="#Optimization-enum">TQPixmap::MemoryOptim</a> and the width of
|
|
your pixmap is less than or equal to 128 pixels, TQt stores the
|
|
pixmap in a way that is very memory-efficient when there are many
|
|
pixmaps.
|
|
<p> If your application uses dozens or hundreds of pixmaps (for
|
|
example on tool bar buttons and in popup menus), and you plan to
|
|
run it on Windows 95 or Windows 98, we recommend using code like
|
|
this:
|
|
<p> <pre>
|
|
TQPixmap::<a href="#setDefaultOptimization">setDefaultOptimization</a>( TQPixmap::<a href="#Optimization-enum">MemoryOptim</a> );
|
|
while ( ... ) {
|
|
// load tool bar pixmaps etc.
|
|
TQPixmap *pixmap = new TQPixmap(fileName);
|
|
}
|
|
TQPixmap::<a href="#setDefaultOptimization">setDefaultOptimization</a>( TQPixmap::<a href="#Optimization-enum">NormalOptim</a> );
|
|
</pre>
|
|
|
|
<p> In general it is recommended to make as much use of TQPixmap's
|
|
<a href="shclass.html#implicit-sharing">implicit sharing</a> and the <a href="ntqpixmapcache.html">TQPixmapCache</a> as possible.
|
|
<p> <p>See also <a href="ntqbitmap.html">TQBitmap</a>, <a href="ntqimage.html">TQImage</a>, <a href="qimageio.html">TQImageIO</a>, <a href="shclass.html">Shared Classes</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
|
|
|
|
<hr><h2>Member Type Documentation</h2>
|
|
<h3 class=fn><a name="ColorMode-enum"></a>TQPixmap::ColorMode</h3>
|
|
|
|
<p> This enum type defines the color modes that exist for converting
|
|
<a href="ntqimage.html">TQImage</a> objects to TQPixmap.
|
|
<ul>
|
|
<li><tt>TQPixmap::Auto</tt> - Select <a href="#ColorMode-enum">Color</a> or <a href="#ColorMode-enum">Mono</a> on a case-by-case basis.
|
|
<li><tt>TQPixmap::Color</tt> - Always create colored pixmaps.
|
|
<li><tt>TQPixmap::Mono</tt> - Always create bitmaps.
|
|
</ul>
|
|
<h3 class=fn><a name="Optimization-enum"></a>TQPixmap::Optimization</h3>
|
|
|
|
<p> TQPixmap has the choice of optimizing for speed or memory in a few
|
|
places; the best choice varies from pixmap to pixmap but can
|
|
generally be derived heuristically. This enum type defines a
|
|
number of optimization modes that you can set for any pixmap to
|
|
tweak the speed/memory tradeoffs:
|
|
<ul>
|
|
<li><tt>TQPixmap::DefaultOptim</tt> - Whatever <a href="#defaultOptimization">TQPixmap::defaultOptimization</a>()
|
|
returns. A pixmap with this optimization will have whatever
|
|
the current default optimization is. If the default
|
|
optimization is changed using <a href="#setDefaultOptimization">setDefaultOptimization</a>(), then
|
|
this will not effect any pixmaps that have already been
|
|
created.
|
|
<li><tt>TQPixmap::NoOptim</tt> - No optimization (currently the same as <a href="#Optimization-enum">MemoryOptim</a>).
|
|
<li><tt>TQPixmap::MemoryOptim</tt> - Optimize for minimal memory use on Windows
|
|
9x and X11 systems.
|
|
<li><tt>TQPixmap::NormalOptim</tt> - Optimize for typical usage. Often uses more
|
|
memory than <a href="#Optimization-enum">MemoryOptim</a>, and is often faster.
|
|
<li><tt>TQPixmap::BestOptim</tt> - Optimize for pixmaps that are drawn very often
|
|
and where performance is critical. Generally uses more memory
|
|
than <a href="#Optimization-enum">NormalOptim</a> and may provide a little more speed.
|
|
</ul><p> We recommend using <a href="#Optimization-enum">DefaultOptim</a>.
|
|
<p>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQPixmap"></a>TQPixmap::TQPixmap ()
|
|
</h3>
|
|
Constructs a null pixmap.
|
|
<p> <p>See also <a href="#isNull">isNull</a>().
|
|
|
|
<h3 class=fn><a name="TQPixmap-2"></a>TQPixmap::TQPixmap ( const <a href="ntqimage.html">TQImage</a> & image )
|
|
</h3>
|
|
Constructs a pixmap from the <a href="ntqimage.html">TQImage</a> <em>image</em>.
|
|
<p> <p>See also <a href="#convertFromImage">convertFromImage</a>().
|
|
|
|
<h3 class=fn><a name="TQPixmap-3"></a>TQPixmap::TQPixmap ( int w, int h, int depth = -1, <a href="ntqpixmap.html#Optimization-enum">Optimization</a> optimization = DefaultOptim )
|
|
</h3>
|
|
Constructs a pixmap with <em>w</em> width, <em>h</em> height and <em>depth</em> bits
|
|
per pixel. The pixmap is optimized in accordance with the <em>optimization</em> value.
|
|
<p> The contents of the pixmap is uninitialized.
|
|
<p> The <em>depth</em> can be either 1 (monochrome) or the depth of the
|
|
current video mode. If <em>depth</em> is negative, then the hardware
|
|
depth of the current video mode will be used.
|
|
<p> If either <em>w</em> or <em>h</em> is zero, a null pixmap is constructed.
|
|
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#Optimization-enum">TQPixmap::Optimization</a>.
|
|
|
|
<h3 class=fn><a name="TQPixmap-4"></a>TQPixmap::TQPixmap ( const <a href="ntqsize.html">TQSize</a> & size, int depth = -1, <a href="ntqpixmap.html#Optimization-enum">Optimization</a> optimization = DefaultOptim )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Constructs a pixmap of size <em>size</em>, <em>depth</em> bits per pixel,
|
|
optimized in accordance with the <em>optimization</em> value.
|
|
|
|
<h3 class=fn><a name="TQPixmap-5"></a>TQPixmap::TQPixmap ( const <a href="ntqstring.html">TQString</a> & fileName, const char * format = 0, <a href="ntqpixmap.html#ColorMode-enum">ColorMode</a> mode = Auto )
|
|
</h3>
|
|
Constructs a pixmap from the file <em>fileName</em>. If the file does
|
|
not exist or is of an unknown format, the pixmap becomes a null
|
|
pixmap.
|
|
<p> The <em>fileName</em>, <em>format</em> and <em>mode</em> parameters are passed on to
|
|
<a href="#load">load</a>(). This means that the data in <em>fileName</em> is not compiled
|
|
into the binary. If <em>fileName</em> contains a relative path (e.g. the
|
|
filename only) the relevant file must be found relative to the
|
|
runtime working directory.
|
|
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>, <a href="#isNull">isNull</a>(), <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), and <a href="#imageFormat">imageFormat</a>().
|
|
|
|
<h3 class=fn><a name="TQPixmap-6"></a>TQPixmap::TQPixmap ( const <a href="ntqstring.html">TQString</a> & fileName, const char * format, int conversion_flags )
|
|
</h3>
|
|
Constructs a pixmap from the file <em>fileName</em>. If the file does
|
|
not exist or is of an unknown format, the pixmap becomes a null
|
|
pixmap.
|
|
<p> The <em>fileName</em>, <em>format</em> and <em>conversion_flags</em> parameters are
|
|
passed on to <a href="#load">load</a>(). This means that the data in <em>fileName</em> is
|
|
not compiled into the binary. If <em>fileName</em> contains a relative
|
|
path (e.g. the filename only) the relevant file must be found
|
|
relative to the runtime working directory.
|
|
<p> If the image needs to be modified to fit in a lower-resolution
|
|
result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
|
|
<p> <p>See also <a href="ntqt.html#ImageConversionFlags-enum">TQt::ImageConversionFlags</a>, <a href="#isNull">isNull</a>(), <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), and <a href="#imageFormat">imageFormat</a>().
|
|
|
|
<h3 class=fn><a name="TQPixmap-7"></a>TQPixmap::TQPixmap ( const char * xpm[] )
|
|
</h3>
|
|
Constructs a pixmap from <em>xpm</em>, which must be a valid XPM image.
|
|
<p> Errors are silently ignored.
|
|
<p> Note that it's possible to squeeze the XPM variable a little bit
|
|
by using an unusual declaration:
|
|
<p> <pre>
|
|
static const char * const start_xpm[]={
|
|
"16 15 8 1",
|
|
"a c #cec6bd",
|
|
....
|
|
</pre>
|
|
|
|
<p> The extra <tt>const</tt> makes the entire definition read-only, which is
|
|
slightly more efficient (for example, when the code is in a shared
|
|
library) and ROMable when the application is to be stored in ROM.
|
|
<p> In order to use that sort of declaration you must cast the
|
|
variable back to <tt>const char **</tt> when you create the TQPixmap.
|
|
|
|
<h3 class=fn><a name="TQPixmap-8"></a>TQPixmap::TQPixmap ( const <a href="qbytearray.html">TQByteArray</a> & img_data )
|
|
</h3>
|
|
Constructs a pixmaps by loading from <em>img_data</em>. The data can be
|
|
in any image format supported by TQt.
|
|
<p> <p>See also <a href="#loadFromData">loadFromData</a>().
|
|
|
|
<h3 class=fn><a name="TQPixmap-9"></a>TQPixmap::TQPixmap ( const <a href="ntqpixmap.html">TQPixmap</a> & pixmap )
|
|
</h3>
|
|
Constructs a pixmap that is a copy of <em>pixmap</em>.
|
|
|
|
<h3 class=fn><a name="TQPixmap-a"></a>TQPixmap::TQPixmap ( int w, int h, const uchar * bits, bool isXbitmap )<tt> [protected]</tt>
|
|
</h3>
|
|
Constructs a monochrome pixmap, with width <em>w</em> and height <em>h</em>,
|
|
that is initialized with the data in <em>bits</em>. The <em>isXbitmap</em>
|
|
indicates whether the data is an X bitmap and defaults to FALSE.
|
|
This constructor is protected and used by the <a href="ntqbitmap.html">TQBitmap</a> class.
|
|
|
|
<h3 class=fn><a name="~TQPixmap"></a>TQPixmap::~TQPixmap ()
|
|
</h3>
|
|
Destroys the pixmap.
|
|
|
|
<h3 class=fn>bool <a name="convertFromImage"></a>TQPixmap::convertFromImage ( const <a href="ntqimage.html">TQImage</a> & img, int conversion_flags )
|
|
</h3>
|
|
Converts image <em>img</em> and sets this pixmap. Returns TRUE if
|
|
successful; otherwise returns FALSE.
|
|
<p> The <em>conversion_flags</em> argument is a bitwise-OR of the
|
|
<a href="ntqt.html#ImageConversionFlags-enum">TQt::ImageConversionFlags</a>. Passing 0 for <em>conversion_flags</em>
|
|
sets all the default options.
|
|
<p> Note that even though a TQPixmap with depth 1 behaves much like a
|
|
<a href="ntqbitmap.html">TQBitmap</a>, <a href="#isTQBitmap">isTQBitmap</a>() returns FALSE.
|
|
<p> If a pixmap with depth 1 is painted with color0 and color1 and
|
|
converted to an image, the pixels painted with color0 will produce
|
|
pixel index 0 in the image and those painted with color1 will
|
|
produce pixel index 1.
|
|
<p> <p>See also <a href="#convertToImage">convertToImage</a>(), <a href="#isTQBitmap">isTQBitmap</a>(), <a href="ntqimage.html#convertDepth">TQImage::convertDepth</a>(), <a href="#defaultDepth">defaultDepth</a>(), and <a href="ntqimage.html#hasAlphaBuffer">TQImage::hasAlphaBuffer</a>().
|
|
|
|
<p>Examples: <a href="canvas-example.html#x2943">canvas/canvas.cpp</a> and <a href="themes-example.html#x228">themes/wood.cpp</a>.
|
|
<h3 class=fn>bool <a name="convertFromImage-2"></a>TQPixmap::convertFromImage ( const <a href="ntqimage.html">TQImage</a> & image, <a href="ntqpixmap.html#ColorMode-enum">ColorMode</a> mode = Auto )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Converts <em>image</em> and sets this pixmap using color mode <em>mode</em>.
|
|
Returns TRUE if successful; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>.
|
|
|
|
<h3 class=fn><a href="ntqimage.html">TQImage</a> <a name="convertToImage"></a>TQPixmap::convertToImage () const
|
|
</h3>
|
|
Converts the pixmap to a <a href="ntqimage.html">TQImage</a>. Returns a null image if it fails.
|
|
<p> If the pixmap has 1-bit depth, the returned image will also be 1
|
|
bit deep. If the pixmap has 2- to 8-bit depth, the returned image
|
|
has 8-bit depth. If the pixmap has greater than 8-bit depth, the
|
|
returned image has 32-bit depth.
|
|
<p> Note that for the moment, alpha masks on monochrome images are
|
|
ignored.
|
|
<p> <p>See also <a href="#convertFromImage">convertFromImage</a>().
|
|
|
|
<p>Example: <a href="qmag-example.html#x1783">qmag/qmag.cpp</a>.
|
|
<h3 class=fn><a href="ntqbitmap.html">TQBitmap</a> <a name="createHeuristicMask"></a>TQPixmap::createHeuristicMask ( bool clipTight = TRUE ) const
|
|
</h3>
|
|
Creates and returns a heuristic mask for this pixmap. It works by
|
|
selecting a color from one of the corners and then chipping away
|
|
pixels of that color, starting at all the edges.
|
|
<p> The mask may not be perfect but it should be reasonable, so you
|
|
can do things such as the following:
|
|
<pre>
|
|
pm->setMask( pm->createHeuristicMask() );
|
|
</pre>
|
|
|
|
<p> This function is slow because it involves transformation to a
|
|
<a href="ntqimage.html">TQImage</a>, non-trivial computations and a transformation back to a
|
|
<a href="ntqbitmap.html">TQBitmap</a>.
|
|
<p> If <em>clipTight</em> is TRUE the mask is just large enough to cover the
|
|
pixels; otherwise, the mask is larger than the data pixels.
|
|
<p> <p>See also <a href="ntqimage.html#createHeuristicMask">TQImage::createHeuristicMask</a>().
|
|
|
|
<h3 class=fn>int <a name="defaultDepth"></a>TQPixmap::defaultDepth ()<tt> [static]</tt>
|
|
</h3>
|
|
Returns the default pixmap depth, i.e. the depth a pixmap gets if
|
|
-1 is specified.
|
|
<p> <p>See also <a href="#depth">depth</a>().
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html#Optimization-enum">Optimization</a> <a name="defaultOptimization"></a>TQPixmap::defaultOptimization ()<tt> [static]</tt>
|
|
</h3>
|
|
Returns the default pixmap optimization setting.
|
|
<p> <p>See also <a href="#setDefaultOptimization">setDefaultOptimization</a>(), <a href="#setOptimization">setOptimization</a>(), and <a href="#optimization">optimization</a>().
|
|
|
|
<h3 class=fn>int <a name="depth"></a>TQPixmap::depth () const
|
|
</h3>
|
|
|
|
<p> Returns the depth of the pixmap.
|
|
<p> The pixmap depth is also called bits per pixel (bpp) or bit planes
|
|
of a pixmap. A null pixmap has depth 0.
|
|
<p> <p>See also <a href="#defaultDepth">defaultDepth</a>(), <a href="#isNull">isNull</a>(), and <a href="ntqimage.html#convertDepth">TQImage::convertDepth</a>().
|
|
|
|
<h3 class=fn>void <a name="detach"></a>TQPixmap::detach ()<tt> [virtual]</tt>
|
|
</h3>
|
|
This is a special-purpose function that detaches the pixmap from
|
|
shared pixmap data.
|
|
<p> A pixmap is automatically detached by TQt whenever its contents is
|
|
about to change. This is done in all TQPixmap member functions
|
|
that modify the pixmap (<a href="#fill">fill</a>(), <a href="#resize">resize</a>(), <a href="#convertFromImage">convertFromImage</a>(),
|
|
<a href="#load">load</a>(), etc.), in <a href="ntqpaintdevice.html#bitBlt">bitBlt</a>() for the destination pixmap and in
|
|
<a href="ntqpainter.html#begin">TQPainter::begin</a>() on a pixmap.
|
|
<p> It is possible to modify a pixmap without letting TQt know. You can
|
|
first obtain the system-dependent <a href="ntqpaintdevice.html#handle">handle</a>() and then call
|
|
system-specific functions (for instance, BitBlt under Windows)
|
|
that modify the pixmap contents. In such cases, you can call
|
|
<a href="#detach">detach</a>() to cut the pixmap loose from other pixmaps that share
|
|
data with this one.
|
|
<p> detach() returns immediately if there is just a single reference
|
|
or if the pixmap has not been initialized yet.
|
|
|
|
<h3 class=fn>void <a name="fill"></a>TQPixmap::fill ( const <a href="ntqcolor.html">TQColor</a> & fillColor = TQt::white )
|
|
</h3>
|
|
Fills the pixmap with the color <em>fillColor</em>.
|
|
|
|
<p>Examples: <a href="tutorial2-08.html#x2606">chart/setdataform.cpp</a>, <a href="desktop-example.html#x1742">desktop/desktop.cpp</a>, <a href="grapher-nsplugin-example.html#x2765">grapher/grapher.cpp</a>, <a href="hello-example.html#x1638">hello/hello.cpp</a>, <a href="tutorial1-10.html#x2358">t10/cannon.cpp</a>, <a href="themes-example.html#x292">themes/metal.cpp</a>, and <a href="xform-example.html#x1245">xform/xform.cpp</a>.
|
|
<h3 class=fn>void <a name="fill-2"></a>TQPixmap::fill ( const <a href="tqwidget.html">TQWidget</a> * widget, int xofs, int yofs )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Fills the pixmap with the <em>widget</em>'s background color or pixmap.
|
|
If the background is empty, nothing is done. <em>xofs</em>, <em>yofs</em> is
|
|
an offset in the widget.
|
|
|
|
<h3 class=fn>void <a name="fill-3"></a>TQPixmap::fill ( const <a href="tqwidget.html">TQWidget</a> * widget, const <a href="ntqpoint.html">TQPoint</a> & ofs )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Fills the pixmap with the <em>widget</em>'s background color or pixmap.
|
|
If the background is empty, nothing is done.
|
|
<p> The <em>ofs</em> point is an offset in the widget.
|
|
<p> The point <em>ofs</em> is a point in the widget's coordinate system. The
|
|
pixmap's top-left pixel will be mapped to the point <em>ofs</em> in the
|
|
widget. This is significant if the widget has a background pixmap;
|
|
otherwise the pixmap will simply be filled with the background
|
|
color of the widget.
|
|
<p> Example:
|
|
<pre>
|
|
void CuteWidget::paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> *e )
|
|
{
|
|
<a href="ntqrect.html">TQRect</a> ur = e-><a href="qpaintevent.html#rect">rect</a>(); // rectangle to update
|
|
TQPixmap pix( ur.<a href="ntqrect.html#size">size</a>() ); // Pixmap for double-buffering
|
|
pix.<a href="#fill">fill</a>( this, ur.<a href="ntqrect.html#topLeft">topLeft</a>() ); // fill with widget background
|
|
|
|
<a href="ntqpainter.html">TQPainter</a> p( &pix );
|
|
p.<a href="ntqpainter.html#translate">translate</a>( -ur.<a href="ntqrect.html#x">x</a>(), -ur.<a href="ntqrect.html#y">y</a>() ); // use widget coordinate system
|
|
// when drawing on pixmap
|
|
// ... draw on pixmap ...
|
|
|
|
p.<a href="ntqpainter.html#end">end</a>();
|
|
|
|
<a href="ntqpaintdevice.html#bitBlt">bitBlt</a>( this, ur.<a href="ntqrect.html#topLeft">topLeft</a>(), &pix );
|
|
}
|
|
</pre>
|
|
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="fromMimeSource"></a>TQPixmap::fromMimeSource ( const <a href="ntqstring.html">TQString</a> & abs_name )<tt> [static]</tt>
|
|
</h3> Convenience function. Gets the data associated with the absolute
|
|
name <em>abs_name</em> from the default mime source factory and decodes it
|
|
to a pixmap.
|
|
<p> <p>See also <a href="qmimesourcefactory.html">TQMimeSourceFactory</a>, <a href="ntqimage.html#fromMimeSource">TQImage::fromMimeSource</a>(), and <a href="qimagedrag.html#decode">TQImageDrag::decode</a>().
|
|
|
|
<p>Example: <a href="qactiongroup.html#x2113">textedit/textedit.cpp</a>.
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="grabWidget"></a>TQPixmap::grabWidget ( <a href="tqwidget.html">TQWidget</a> * widget, int x = 0, int y = 0, int w = -1, int h = -1 )<tt> [static]</tt>
|
|
</h3>
|
|
Creates a pixmap and paints <em>widget</em> in it.
|
|
<p> If the <em>widget</em> has any children, then they are also painted in
|
|
the appropriate positions.
|
|
<p> If you specify <em>x</em>, <em>y</em>, <em>w</em> or <em>h</em>, only the rectangle you
|
|
specify is painted. The defaults are 0, 0 (top-left corner) and
|
|
-1,-1 (which means the entire widget).
|
|
<p> (If <em>w</em> is negative, the function copies everything to the right
|
|
border of the window. If <em>h</em> is negative, the function copies
|
|
everything to the bottom of the window.)
|
|
<p> If <em>widget</em> is 0, or if the rectangle defined by <em>x</em>, <em>y</em>, the
|
|
modified <em>w</em> and the modified <em>h</em> does not overlap the <em>widget</em>->rect(), this function will return a null TQPixmap.
|
|
<p> This function actually asks <em>widget</em> to paint itself (and its
|
|
children to paint themselves). <a href="#grabWindow">TQPixmap::grabWindow</a>() grabs pixels
|
|
off the screen, which is a bit faster and picks up <em>exactly</em>
|
|
what's on-screen. This function works by calling paintEvent() with
|
|
painter redirection turned on. If there are overlaying windows,
|
|
<a href="#grabWindow">grabWindow</a>() will see them, but not this function.
|
|
<p> If there is overlap, it returns a pixmap of the size you want,
|
|
containing a rendering of <em>widget</em>. If the rectangle you ask for
|
|
is a superset of <em>widget</em>, the areas outside <em>widget</em> are
|
|
covered with the widget's background.
|
|
<p> If an error occurs when trying to grab the widget, such as the
|
|
size of the widget being too large to fit in memory, an <a href="#isNull">isNull</a>()
|
|
pixmap is returned.
|
|
<p> <p>See also <a href="#grabWindow">grabWindow</a>(), <a href="ntqpainter.html#redirect">TQPainter::redirect</a>(), and <a href="tqwidget.html#paintEvent">TQWidget::paintEvent</a>().
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="grabWindow"></a>TQPixmap::grabWindow ( WId window, int x = 0, int y = 0, int w = -1, int h = -1 )<tt> [static]</tt>
|
|
</h3>
|
|
Grabs the contents of the window <em>window</em> and makes a pixmap out
|
|
of it. Returns the pixmap.
|
|
<p> The arguments <em>(x, y)</em> specify the offset in the window, whereas
|
|
<em>(w, h)</em> specify the width and height of the area to be copied.
|
|
<p> If <em>w</em> is negative, the function copies everything to the right
|
|
border of the window. If <em>h</em> is negative, the function copies
|
|
everything to the bottom of the window.
|
|
<p> Note that <a href="#grabWindow">grabWindow</a>() grabs pixels from the screen, not from the
|
|
window. If there is another window partially or entirely over the
|
|
one you grab, you get pixels from the overlying window, too.
|
|
<p> Note also that the mouse cursor is generally not grabbed.
|
|
<p> The reason we use a window identifier and not a <a href="tqwidget.html">TQWidget</a> is to
|
|
enable grabbing of windows that are not part of the application,
|
|
window system frames, and so on.
|
|
<p> <b>Warning:</b> Grabbing an area outside the screen is not safe in
|
|
general. This depends on the underlying window system.
|
|
<p> <b>Warning:</b> X11 only: If <em>window</em> is not the same depth as the root
|
|
window and another window partially or entirely obscures the one
|
|
you grab, you will <em>not</em> get pixels from the overlying window.
|
|
The contests of the obscured areas in the pixmap are undefined and
|
|
uninitialized.
|
|
<p> <p>See also <a href="#grabWidget">grabWidget</a>().
|
|
|
|
<p>Example: <a href="qmag-example.html#x1784">qmag/qmag.cpp</a>.
|
|
<h3 class=fn>bool <a name="hasAlpha"></a>TQPixmap::hasAlpha () const
|
|
</h3>
|
|
Returns TRUE this pixmap has an alpha channel or a mask.
|
|
<p> <p>See also <a href="#hasAlphaChannel">hasAlphaChannel</a>() and <a href="#mask">mask</a>().
|
|
|
|
<h3 class=fn>bool <a name="hasAlphaChannel"></a>TQPixmap::hasAlphaChannel () const
|
|
</h3>
|
|
Returns TRUE if the pixmap has an alpha channel; otherwise it
|
|
returns FALSE.
|
|
<p> NOTE: If the pixmap has a mask but not alpha channel, this
|
|
function returns FALSE.
|
|
<p> <p>See also <a href="#hasAlpha">hasAlpha</a>() and <a href="#mask">mask</a>().
|
|
|
|
<h3 class=fn>int <a name="height"></a>TQPixmap::height () const
|
|
</h3>
|
|
|
|
<p> Returns the height of the pixmap.
|
|
<p> <p>See also <a href="#width">width</a>(), <a href="#size">size</a>(), and <a href="#rect">rect</a>().
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1743">desktop/desktop.cpp</a>, <a href="movies-example.html#x510">movies/main.cpp</a>, <a href="scribble-example.html#x921">scribble/scribble.cpp</a>, <a href="scrollview-example.html#x638">scrollview/scrollview.cpp</a>, <a href="tutorial1-10.html#x2359">t10/cannon.cpp</a>, and <a href="xform-example.html#x1246">xform/xform.cpp</a>.
|
|
<h3 class=fn>const char * <a name="imageFormat"></a>TQPixmap::imageFormat ( const <a href="ntqstring.html">TQString</a> & fileName )<tt> [static]</tt>
|
|
</h3>
|
|
Returns a string that specifies the image format of the file <em>fileName</em>, or 0 if the file cannot be read or if the format cannot
|
|
be recognized.
|
|
<p> The <a href="qimageio.html">TQImageIO</a> documentation lists the supported image formats.
|
|
<p> <p>See also <a href="#load">load</a>() and <a href="#save">save</a>().
|
|
|
|
<h3 class=fn>bool <a name="isNull"></a>TQPixmap::isNull () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this is a null pixmap; otherwise returns FALSE.
|
|
<p> A null pixmap has zero width, zero height and no contents. You
|
|
cannot draw in a null pixmap or <a href="ntqpaintdevice.html#bitBlt">bitBlt</a>() anything to it.
|
|
<p> Resizing an existing pixmap to (0, 0) makes a pixmap into a null
|
|
pixmap.
|
|
<p> <p>See also <a href="#resize">resize</a>().
|
|
|
|
<p>Examples: <a href="movies-example.html#x511">movies/main.cpp</a>, <a href="qdir-example.html#x1834">qdir/qdir.cpp</a>, <a href="qmag-example.html#x1785">qmag/qmag.cpp</a>, and <a href="scrollview-example.html#x639">scrollview/scrollview.cpp</a>.
|
|
<h3 class=fn>bool <a name="isTQBitmap"></a>TQPixmap::isTQBitmap () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this is a <a href="ntqbitmap.html">TQBitmap</a>; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="load"></a>TQPixmap::load ( const <a href="ntqstring.html">TQString</a> & fileName, const char * format, int conversion_flags )
|
|
</h3>
|
|
Loads a pixmap from the file <em>fileName</em> at runtime. Returns TRUE
|
|
if successful; otherwise returns FALSE.
|
|
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
|
|
using the specified format. If <em>format</em> is not specified
|
|
(default), the loader reads a few bytes from the header to guess
|
|
the file's format.
|
|
<p> See the <a href="#convertFromImage">convertFromImage</a>() documentation for a description of the
|
|
<em>conversion_flags</em> argument.
|
|
<p> The <a href="qimageio.html">TQImageIO</a> documentation lists the supported image formats and
|
|
explains how to add extra formats.
|
|
<p> <p>See also <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="ntqimage.html#load">TQImage::load</a>(), and <a href="qimageio.html">TQImageIO</a>.
|
|
|
|
<p>Examples: <a href="picture-example.html#x124">picture/picture.cpp</a>, <a href="scrollview-example.html#x640">scrollview/scrollview.cpp</a>, and <a href="xform-example.html#x1247">xform/xform.cpp</a>.
|
|
<h3 class=fn>bool <a name="load-2"></a>TQPixmap::load ( const <a href="ntqstring.html">TQString</a> & fileName, const char * format = 0, <a href="ntqpixmap.html#ColorMode-enum">ColorMode</a> mode = Auto )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Loads a pixmap from the file <em>fileName</em> at runtime.
|
|
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
|
|
using the specified format. If <em>format</em> is not specified
|
|
(default), the loader reads a few bytes from the header to guess
|
|
the file's format.
|
|
<p> The <em>mode</em> is used to specify the color mode of the pixmap.
|
|
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>.
|
|
|
|
<h3 class=fn>bool <a name="loadFromData"></a>TQPixmap::loadFromData ( const uchar * buf, uint len, const char * format, int conversion_flags )
|
|
</h3>
|
|
Loads a pixmap from the binary data in <em>buf</em> (<em>len</em> bytes).
|
|
Returns TRUE if successful; otherwise returns FALSE.
|
|
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
|
|
using the specified format. If <em>format</em> is not specified
|
|
(default), the loader reads a few bytes from the header to guess
|
|
the file's format.
|
|
<p> See the <a href="#convertFromImage">convertFromImage</a>() documentation for a description of the
|
|
<em>conversion_flags</em> argument.
|
|
<p> The <a href="qimageio.html">TQImageIO</a> documentation lists the supported image formats and
|
|
explains how to add extra formats.
|
|
<p> <p>See also <a href="#load">load</a>(), <a href="#save">save</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="ntqimage.html#loadFromData">TQImage::loadFromData</a>(), and <a href="qimageio.html">TQImageIO</a>.
|
|
|
|
<h3 class=fn>bool <a name="loadFromData-2"></a>TQPixmap::loadFromData ( const uchar * buf, uint len, const char * format = 0, <a href="ntqpixmap.html#ColorMode-enum">ColorMode</a> mode = Auto )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Loads a pixmap from the binary data in <em>buf</em> (<em>len</em> bytes) using
|
|
color mode <em>mode</em>. Returns TRUE if successful; otherwise returns
|
|
FALSE.
|
|
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
|
|
using the specified format. If <em>format</em> is not specified
|
|
(default), the loader reads a few bytes from the header to guess
|
|
the file's format.
|
|
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>.
|
|
|
|
<h3 class=fn>bool <a name="loadFromData-3"></a>TQPixmap::loadFromData ( const <a href="qbytearray.html">TQByteArray</a> & buf, const char * format = 0, int conversion_flags = 0 )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p>
|
|
<h3 class=fn>const <a href="ntqbitmap.html">TQBitmap</a> * <a name="mask"></a>TQPixmap::mask () const
|
|
</h3>
|
|
|
|
<p> Returns the mask bitmap, or 0 if no mask has been set.
|
|
<p> <p>See also <a href="#setMask">setMask</a>(), <a href="ntqbitmap.html">TQBitmap</a>, and <a href="#hasAlpha">hasAlpha</a>().
|
|
|
|
<h3 class=fn>int <a name="metric"></a>TQPixmap::metric ( int m ) const<tt> [virtual protected]</tt>
|
|
</h3>
|
|
Internal implementation of the virtual TQPaintDevice::metric() function.
|
|
<p> Use the <a href="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a> class instead.
|
|
<p> <em>m</em> is the metric to get.
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> & <a name="operator-eq"></a>TQPixmap::operator= ( const <a href="ntqpixmap.html">TQPixmap</a> & pixmap )
|
|
</h3>
|
|
Assigns the pixmap <em>pixmap</em> to this pixmap and returns a
|
|
reference to this pixmap.
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> & <a name="operator-eq-2"></a>TQPixmap::operator= ( const <a href="ntqimage.html">TQImage</a> & image )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Converts the image <em>image</em> to a pixmap that is assigned to this
|
|
pixmap. Returns a reference to the pixmap.
|
|
<p> <p>See also <a href="#convertFromImage">convertFromImage</a>().
|
|
|
|
<h3 class=fn><a href="ntqpixmap.html#Optimization-enum">Optimization</a> <a name="optimization"></a>TQPixmap::optimization () const
|
|
</h3>
|
|
|
|
<p> Returns the optimization setting for this pixmap.
|
|
<p> The default optimization setting is <a href="#Optimization-enum">TQPixmap::NormalOptim</a>. You
|
|
can change this setting in two ways:
|
|
<ul>
|
|
<li> Call <a href="#setDefaultOptimization">setDefaultOptimization</a>() to set the default optimization
|
|
for all new pixmaps.
|
|
<li> Call <a href="#setOptimization">setOptimization</a>() to set the optimization for individual
|
|
pixmaps.
|
|
</ul>
|
|
<p> <p>See also <a href="#setOptimization">setOptimization</a>(), <a href="#setDefaultOptimization">setDefaultOptimization</a>(), and <a href="#defaultOptimization">defaultOptimization</a>().
|
|
|
|
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="rect"></a>TQPixmap::rect () const
|
|
</h3>
|
|
|
|
<p> Returns the enclosing rectangle (0,0,width(),height()) of the pixmap.
|
|
<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#size">size</a>().
|
|
|
|
<h3 class=fn>void <a name="resize"></a>TQPixmap::resize ( int w, int h )
|
|
</h3>
|
|
Resizes the pixmap to <em>w</em> width and <em>h</em> height. If either <em>w</em>
|
|
or <em>h</em> is 0, the pixmap becomes a null pixmap.
|
|
<p> If both <em>w</em> and <em>h</em> are greater than 0, a valid pixmap is
|
|
created. New pixels will be uninitialized (random) if the pixmap
|
|
is expanded.
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1744">desktop/desktop.cpp</a> and <a href="grapher-nsplugin-example.html#x2766">grapher/grapher.cpp</a>.
|
|
<h3 class=fn>void <a name="resize-2"></a>TQPixmap::resize ( const <a href="ntqsize.html">TQSize</a> & size )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Resizes the pixmap to size <em>size</em>.
|
|
|
|
<h3 class=fn>bool <a name="save"></a>TQPixmap::save ( const <a href="ntqstring.html">TQString</a> & fileName, const char * format, int quality = -1 ) const
|
|
</h3>
|
|
Saves the pixmap to the file <em>fileName</em> using the image file
|
|
format <em>format</em> and a quality factor <em>quality</em>. <em>quality</em> must
|
|
be in the range [0,100] or -1. Specify 0 to obtain small
|
|
compressed files, 100 for large uncompressed files, and -1 to use
|
|
the default settings. Returns TRUE if successful; otherwise
|
|
returns FALSE.
|
|
<p> <p>See also <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="ntqimage.html#save">TQImage::save</a>(), and <a href="qimageio.html">TQImageIO</a>.
|
|
|
|
<p>Example: <a href="qmag-example.html#x1786">qmag/qmag.cpp</a>.
|
|
<h3 class=fn>bool <a name="save-2"></a>TQPixmap::save ( <a href="ntqiodevice.html">TQIODevice</a> * device, const char * format, int quality = -1 ) const
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> This function writes a TQPixmap to the <a href="ntqiodevice.html">TQIODevice</a>, <em>device</em>. This
|
|
can be used, for example, to save a pixmap directly into a
|
|
TQByteArray:
|
|
<pre>
|
|
TQPixmap pixmap;
|
|
<a href="qbytearray.html">TQByteArray</a> ba;
|
|
<a href="ntqbuffer.html">TQBuffer</a> buffer( ba );
|
|
buffer.<a href="ntqiodevice.html#open">open</a>( <a href="ntqfile.html#open">IO_WriteOnly</a> );
|
|
pixmap.<a href="#save">save</a>( &buffer, "PNG" ); // writes pixmap into ba in PNG format
|
|
</pre>
|
|
|
|
|
|
<h3 class=fn>bool <a name="selfMask"></a>TQPixmap::selfMask () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the pixmap's mask is identical to the pixmap
|
|
itself; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#mask">mask</a>().
|
|
|
|
<h3 class=fn>int <a name="serialNumber"></a>TQPixmap::serialNumber () const
|
|
</h3>
|
|
|
|
<p> Returns a number that uniquely identifies the contents of this
|
|
TQPixmap object. This means that multiple TQPixmap objects can have
|
|
the same serial number as long as they refer to the same contents.
|
|
<p> An example of where this is useful is for caching TQPixmaps.
|
|
<p> <p>See also <a href="ntqpixmapcache.html">TQPixmapCache</a>.
|
|
|
|
<h3 class=fn>void <a name="setDefaultOptimization"></a>TQPixmap::setDefaultOptimization ( <a href="ntqpixmap.html#Optimization-enum">Optimization</a> optimization )<tt> [static]</tt>
|
|
</h3>
|
|
Sets the default pixmap optimization.
|
|
<p> All <em>new</em> pixmaps that are created will use this default
|
|
optimization. You may also set optimization for individual pixmaps
|
|
using the <a href="#setOptimization">setOptimization</a>() function.
|
|
<p> The initial default <em>optimization</em> setting is <tt>TQPixmap::Normal</tt>.
|
|
<p> <p>See also <a href="#defaultOptimization">defaultOptimization</a>(), <a href="#setOptimization">setOptimization</a>(), and <a href="#optimization">optimization</a>().
|
|
|
|
<h3 class=fn>void <a name="setMask"></a>TQPixmap::setMask ( const <a href="ntqbitmap.html">TQBitmap</a> & newmask )
|
|
</h3>
|
|
Sets a mask bitmap.
|
|
<p> The <em>newmask</em> bitmap defines the clip mask for this pixmap. Every
|
|
pixel in <em>newmask</em> corresponds to a pixel in this pixmap. Pixel
|
|
value 1 means opaque and pixel value 0 means transparent. The mask
|
|
must have the same size as this pixmap.
|
|
<p> <b>Warning:</b> Setting the mask on a pixmap will cause any alpha channel
|
|
data to be cleared. For example:
|
|
<pre>
|
|
TQPixmap alpha( "image-with-alpha.png" );
|
|
TQPixmap alphacopy = alpha;
|
|
alphacopy.<a href="#setMask">setMask</a>( *alphacopy.<a href="#mask">mask</a>() );
|
|
</pre>
|
|
|
|
Now, alpha and alphacopy are visually different.
|
|
<p> Setting a <a href="#isNull">null</a> mask resets the mask.
|
|
<p> <p>See also <a href="#mask">mask</a>(), <a href="#createHeuristicMask">createHeuristicMask</a>(), and <a href="ntqbitmap.html">TQBitmap</a>.
|
|
|
|
<h3 class=fn>void <a name="setOptimization"></a>TQPixmap::setOptimization ( <a href="ntqpixmap.html#Optimization-enum">Optimization</a> optimization )
|
|
</h3>
|
|
Sets pixmap drawing optimization for this pixmap.
|
|
<p> The <em>optimization</em> setting affects pixmap operations, in
|
|
particular drawing of transparent pixmaps (<a href="ntqpaintdevice.html#bitBlt">bitBlt</a>() a pixmap with
|
|
a mask set) and pixmap transformations (the <a href="#xForm">xForm</a>() function).
|
|
<p> Pixmap optimization involves keeping intermediate results in a
|
|
cache buffer and using the cache to speed up bitBlt() and xForm().
|
|
The cost is more memory consumption, up to twice as much as an
|
|
unoptimized pixmap.
|
|
<p> Use the <a href="#setDefaultOptimization">setDefaultOptimization</a>() to change the default
|
|
optimization for all new pixmaps.
|
|
<p> <p>See also <a href="#optimization">optimization</a>(), <a href="#setDefaultOptimization">setDefaultOptimization</a>(), and <a href="#defaultOptimization">defaultOptimization</a>().
|
|
|
|
<p>Example: <a href="desktop-example.html#x1745">desktop/desktop.cpp</a>.
|
|
<h3 class=fn><a href="ntqsize.html">TQSize</a> <a name="size"></a>TQPixmap::size () const
|
|
</h3>
|
|
|
|
<p> Returns the size of the pixmap.
|
|
<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#rect">rect</a>().
|
|
|
|
<p>Example: <a href="movies-example.html#x512">movies/main.cpp</a>.
|
|
<h3 class=fn><a href="ntqwmatrix.html">TQWMatrix</a> <a name="trueMatrix"></a>TQPixmap::trueMatrix ( const <a href="ntqwmatrix.html">TQWMatrix</a> & matrix, int w, int h )<tt> [static]</tt>
|
|
</h3>
|
|
Returns the actual matrix used for transforming a pixmap with <em>w</em>
|
|
width and <em>h</em> height and matrix <em>matrix</em>.
|
|
<p> When transforming a pixmap with <a href="#xForm">xForm</a>(), the <a href="ntqwmatrix.html#TransformationMode">transformation matrix</a>
|
|
is internally adjusted to compensate for unwanted translation,
|
|
i.e. xForm() returns the smallest pixmap containing all
|
|
transformed points of the original pixmap.
|
|
<p> This function returns the modified matrix, which maps points
|
|
correctly from the original pixmap into the new pixmap.
|
|
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="ntqwmatrix.html">TQWMatrix</a>.
|
|
|
|
<h3 class=fn>int <a name="width"></a>TQPixmap::width () const
|
|
</h3>
|
|
|
|
<p> Returns the width of the pixmap.
|
|
<p> <p>See also <a href="#height">height</a>(), <a href="#size">size</a>(), and <a href="#rect">rect</a>().
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1746">desktop/desktop.cpp</a>, <a href="movies-example.html#x513">movies/main.cpp</a>, <a href="scribble-example.html#x922">scribble/scribble.cpp</a>, <a href="scrollview-example.html#x641">scrollview/scrollview.cpp</a>, and <a href="xform-example.html#x1248">xform/xform.cpp</a>.
|
|
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="xForm"></a>TQPixmap::xForm ( const <a href="ntqwmatrix.html">TQWMatrix</a> & matrix ) const
|
|
</h3>
|
|
Returns a copy of the pixmap that is transformed using <em>matrix</em>.
|
|
The original pixmap is not changed.
|
|
<p> The transformation <em>matrix</em> is internally adjusted to compensate
|
|
for unwanted translation, i.e. <a href="#xForm">xForm</a>() returns the smallest image
|
|
that contains all the transformed points of the original image.
|
|
<p> This function is slow because it involves transformation to a
|
|
<a href="ntqimage.html">TQImage</a>, non-trivial computations and a transformation back to a
|
|
TQPixmap.
|
|
<p> <p>See also <a href="#trueMatrix">trueMatrix</a>(), <a href="ntqwmatrix.html">TQWMatrix</a>, <a href="ntqpainter.html#setWorldMatrix">TQPainter::setWorldMatrix</a>(), and <a href="ntqimage.html#xForm">TQImage::xForm</a>().
|
|
|
|
<p>Examples: <a href="desktop-example.html#x1747">desktop/desktop.cpp</a>, <a href="fileiconview-example.html#x863">fileiconview/qfileiconview.cpp</a>, <a href="movies-example.html#x514">movies/main.cpp</a>, and <a href="qmag-example.html#x1787">qmag/qmag.cpp</a>.
|
|
<hr><h2>Related Functions</h2>
|
|
<h3 class=fn>void <a name="copyBlt"></a>copyBlt ( <a href="ntqpixmap.html">TQPixmap</a> * dst, int dx, int dy, const <a href="ntqpixmap.html">TQPixmap</a> * src, int sx, int sy, int sw, int sh )
|
|
</h3>
|
|
|
|
<p> Copies a block of pixels from <em>src</em> to <em>dst</em>. The alpha channel
|
|
and mask data (if any) is also copied from <em>src</em>. NOTE: <em>src</em>
|
|
is <em>not</em> alpha blended or masked when copied to <em>dst</em>. Use
|
|
<a href="ntqpaintdevice.html#bitBlt">bitBlt</a>() or <a href="ntqpainter.html#drawPixmap">TQPainter::drawPixmap</a>() to perform alpha blending or
|
|
masked drawing.
|
|
<p> <em>sx</em>, <em>sy</em> is the top-left pixel in <em>src</em> (0, 0 by default), <em>dx</em>, <em>dy</em> is the top-left position in <em>dst</em> and <em>sw</em>, \sh is the
|
|
size of the copied block (all of <em>src</em> by default).
|
|
<p> If <em>src</em>, <em>dst</em>, <em>sw</em> or <em>sh</em> is 0 (zero), <a href="#copyBlt">copyBlt</a>() does
|
|
nothing. If <em>sw</em> or <em>sh</em> is negative, copyBlt() copies starting
|
|
at <em>sx</em> (and respectively, <em>sy</em>) and ending at the right edge
|
|
(and respectively, the bottom edge) of <em>src</em>.
|
|
<p> copyBlt() does nothing if <em>src</em> and <em>dst</em> have different depths.
|
|
|
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="ntqdatastream.html">TQDataStream</a> & s, const <a href="ntqpixmap.html">TQPixmap</a> & pixmap )
|
|
</h3>
|
|
|
|
<p> Writes the pixmap <em>pixmap</em> to the stream <em>s</em> as a PNG image.
|
|
<p> Note that writing the stream to a file will not produce a valid image file.
|
|
<p> <p>See also <a href="#save">TQPixmap::save</a>() and <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
|
|
|
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="ntqdatastream.html">TQDataStream</a> & s, <a href="ntqpixmap.html">TQPixmap</a> & pixmap )
|
|
</h3>
|
|
|
|
<p> Reads a pixmap from the stream <em>s</em> into the pixmap <em>pixmap</em>.
|
|
<p> <p>See also <a href="#load">TQPixmap::load</a>() and <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|