Use a paint brush
The attributes of a paint brush include line, line width, and color. The attributes of the paint brush can be specified in the constructor or
Setstyle (), setwidth (), setbrush (), setcapstyle (), setjoinstyle (), and other functions
Set items one by one
Attributes of the paint brush. QT uses QT: penstyle to define six paint styles, which are
Qt: solidline, QT: dashline, QT: dotline, QT: dashdotline, QT: dashdotdotline,
Qt: customdashline.
The custom line style (QT: customdashline) needs to be set using the setdashpattern () function of qpen.
The following code sets
Set a custom qpen
Qpen pen;
Qvector customdashes;
Qreal blank = 4;
Dashes <2 <
Pen. setdashpattern (customdashes );
Cap Style)
The endpoint style determines the end point of the line.
Style, which is only valid for a line with a line width greater than 1. Qt defines three endpoint styles, which are represented by enumeration QT: pencapstyle.
Qt: squrecap, QT: flatcap, QT: roundcap,
Join Style)
What is the connection style like?
Connection. The connection style is valid for a line with a line width greater than or equal to 1. Qt defines four connection modes, which are represented by enumeration QT: penstyle.
Qt: miterjoin, QT: beveljoin, QT: roundjoin.
Qt: svgmiterjoin.
2.
Paint Brush
In QT, the image is filled with qbrush, which includes fill color and style (fill mode). In QT, the color is represented by qcolor class, And qcolor supports
RGB, HSV, and CMYK color models. Qcolor also supports the combination of Alpha outlines and
Fill. The basic mode fill includes various vertices and line combinations. Qt support
RGB, HSV, and CMYK color models. RGB is a hardware-oriented model. The color is composed of three base colors: Red, green, and blue. The HSV model is consistent with the human's perception of color.
Color Tone
(0-359), saturation (0-255), and brightness (0-255). CMYK consists of four colors: blue, magenta, yellow, and black. It is mainly used on printers and other hardware copy devices. Each color score
The value of qcolor is 0-255. In addition, qcolor can be used.
Any color defined in svg1.0 is called parameter initialization.
Qt4 provides a gradually filled image brush
Changing fill includes two elements: color change and path change. You can specify a gradient from one color to another. You can also specify the color of some vertices in the changed path for segmentation gradient.
Qt4
Three gradient fills are provided: linear (qlineargradient), circular (qradialgradient), and cone gradient
(Qconicalgradient). All classes are inherited from the qgradient class.
------------------
Linear Gradient
Fill
Linear Gradient fill specifies two control points, and the painting brush performs color interpolation between the two control points. Set the painter by creating a qlineargradient object.
Qlineargradient
Lineargradient (0, 0, 200,100 );
Lineargradient. setcolorat (0, QT: Red );
Lineargradient. setcolorat (0.5, QT: Green );
Lineargradient. setcolorat (1, QT: Blue );
Painter. setbrush (lineargradient );
Painter. drawrect (0, 0, 200,100 );
In
In the qgradient constructor, the two points filled by the line are (100,100) and () respectively. The setcolorat () function sets the face of the specified position between 0 and 1 ------------------
Round gradient Filling
The center, radius, and focus must be specified for the circular gradient filling. The image is painted between the focus and all vertices on the circle.
Color interpolation. Create a qradialgradient object to set the painter
Qradialgradient
Radialgradient (50, 50, 50, 30 );
Radialgradient. setcolorat (0.2, QT: Cyan );
Radialgradient. setcolorat (0.8, QT: yellow );
Radialgradient. setcolorat (1, QT: magenta );
Painter. setbrush (radialgradient );
Painter. drawellipse (100,100 );
-------------------------------
Circle
Cone gradient Filling
The taper gradient fills in the specified center and start angle. The painting brush performs color interpolation counterclockwise along the center of the circle, creates a qconicalgradient object, and sets the painting brush.
Qconicalgradient
Conicalgradient (60, 40, 30 );
Conicalgradient. setcolorat (0, QT: Gray );
Conicalgradient. setcolorat (0.4, QT: darkgreen );
Conicalgradient. setcolorat (0.6, QT: darkmagenta );
Conicalgradient. setcolorat (1, QT: drakblue );
Painter. setbrush (conicalgradient );
Painter. drawellipse (100,100 );
---------------------------------
Is
You can also use the qpixmap or qimage object for texture filling. Use settexture () and
The settextureimage () function loads the texture.
========================================================== ========================================================== ==============================================
Double
BUFFER PLOT
In qt4, by default, all widgets use double buffering for plotting. Double Buffering can reduce the flickering effect of the painting. In some cases, you need to disable double buffering and manage the painting by yourself.
Graph. The following statement sets the window part
The QT: wa_paintonscreen attribute of closes the double buffering of the window part.
Mywidget-> setattribute (QT: wa_paintonscreen );
By
Qt4 no longer provides different or pens. The combination mode qpainter: compostionmode_xor () is not different or pen. qt4 only provides qrubberband
Drawing Feedback of current rectangle and line. Therefore, we need to implement the dynamic
Other methods must be used for feedback. In the program, double-loop punch is used to solve this problem. During the drawing process, a buffer zone is drawn temporarily
Save, a buffer to save the drawn content, and finally merge.
During the interactive drawing process, the program copies the image buffer zone to the temporary buffer zone and draws the image on the temporary buffer zone.
Copy to the image buffer zone. If there is no interactive copy, the image buffer zone will be drawn directly to the screen.
------------------------
Use
Alpha Channel
In Windows, Mac
On OSX and X11 systems with xrender extensions, qt4 can support alpha channels and achieve translucent effects through Alpha channels. The qcolor class defines
Transparency of the alpha channel. 0 indicates full transparency.
255 indicates that it is completely opaque. Note that the qwidget class has a property windowopacity.
Setwindowopacity (qreal level) can be used to set the window transparency. However, the principle of this attribute is different from that of the alpha channel.
Windows
And Mac OS
This attribute is only supported on the X platform, but on the X11 platform, the composite extension is required to work. (The alpha channel uses the xrender extension of X11 ).
---------------------------------------
Painting
Graph Device
The qpaintdevice class is the base class of the actual drawing device. qpainter can be drawn on the qpaintdevice subclass, as shown in figure
Qwidget, qimage, qpixmap, qglwidget, qglpixelbuffer, qpicture, qprinter
Qsvggenerator.
To implement your own drawing device, you must inherit from the qpaintdevice class and implement its virtual function qpaintdevice: paintengine ().
Qpainter is able to draw images on this particular device, and also needs
The qpaintengine class inherits the custom Graphics Rendering Engine.
1
Qwidget
Qwidget is the base class of all user interface elements. When a window component is used, it is an atomic element of the user interface. It accepts the mouse, keyboard, and other events of the window system and draws its own
Ji.
2 qimage
The qimage class provides hardware-independent image representation, which provides Optimization for direct pixel operations. qimage supports monochrome, 8-bit, 32-
The advantage of using qimage for bit and Alpha hybrid images is that it can achieve platform-independent painting operations. Another benefit is that
The image does not need to be processed in the GUI thread.
3
Qpixmap
The image displayed in the background when qpixmap is used, which provides Optimization for displaying images on the screen. Unlike qimage, the image data of pixmap is invisible to users and
It is managed by the underlying window system. To optimize the qpixmap image, QT provides the qpixmapcache class for storage.
Temporary pixmap. QT also provides qpixmap
The inheritance class qbitmap class, qbitmap represents a monochrome pixmap, which is mainly used to create a custom qcursor and qbrush object, construct a qregion object, Set
Set the pixmap and window part mask.
4. openglwidget
Qt provides the qtopengl module to implement OpenGL operations.
Qglwidget allows OpenGL
API. The sub-class of qwidget in qglwidget at the same time, So qpainter can also be drawn on it. In this way, QT can use OpenGL
End
For example, transform and plot pixmap.
5 Pixel Buffer
Qglpixelbuffer inherits from qpaintdevice and encapsulates
OpenGL pbuffer. pbuffer is usually used for Full Hardware acceleration, which is faster than qpixmap.
6 framebuffer
Qglframebufferobject
Inherited from qpaintdevice, qglframebufferobject encapsulates OpenGL
Framebuffer object, which is used for background screen rendering by framebuffer, is better than Pixel Buffer. 7 picture
The plotting device that records and replays the qpainter command during the qpicture class. The picture serial painter command is
The platform-independent format and qpicture are also independent of resolution. For example, qpicuture can be used on different devices (SVG, PDF, PS
Printer and screen) has
. The qpicture: load () and qpicture: Save () functions load and store images respectively.
8 printer
Qprinter
A plotting device that is drawn on a printer, on Windows and Mac OS.
On X, qprinter uses the built-in printer driver. On X11, The qprinter mountain postscript code is sent to LPR, LP, or other printers.
Qprinter can print on any other qprintengine objects or generate PDF files directly.
The qprintengine class is defined.
The interface for qprinter to interact with other printer systems. It can be inherited from qpaintengine and qpaintengine when creating its own printing engine.
========================================================== ========================================================== ======================================
Coordinate System and Coordinate Transformation
1. the QT coordinate system is controlled by qpainter and
Qpaintdevice and qpaintengine class control. The qpaintdevice class is the basis of the drawing device.
Class, qwidget, qpixmap, qimage, and qprinter are subclasses of the qpaintdevice class. The default coordinate origin of the QT drawing device is the upper left corner and the X axis.
To the right, the Y axis grows downward. The default unit is pixel on the pixel-based device, and the logical coordinate of qpainter is 1/72 inch (0.35mm) on the printer device.
The ing between the physical coordinates of qpainterdevice is handled by the transformation matrix of qpainter, And the view and window. The logical and physical coordinates are also consistent. Qpainter support
Coordinate Transformation (such as rotation and scaling );
2. Coordinate Transformation.
Generally, qpainer draws a picture on the device's coordinate system, but qpainter also supports coordinate transformation. You can use the qpainter: Scale () function to perform proportional transformation. Use
The qpainter: Rotate () function performs Rotation Transformation. Use the qpainter: translate () function for translation conversion.
Number, qpainter: shear () function to distort the image. All transformation matrices can be obtained through the qpainter: wordmatrix () function.
Output. Different transformation matrices can be saved using stacks.
Use qpainter: Save () to save the transformation matrix to the stack. Use the qpainter: Restore () function
Its pop-up stack.
Qmatrix defines the two-dimensional transformation of the system. The qmatrix object actually defines a 3x3 matrix.
--------------
M11 M12 0
M21 m22 0
DX dy 1
--------------- <Br/> X // '= M11 * x + m21 * Y + dx;
Y // '= m22 * Y + M12 * x + dy;
Its
In dx, Dy indicates the horizontal and vertical offset, and M11, m22 indicates the ratio of the horizontal and vertical directions. M12 and m21 indicate horizontal and vertical distortion.
Matrix is acceptable
You can use the setmatrix function to set the value, and then use functions such as translate (), rotate (), scale (), and shear () to change the value.
In. qt4.3, The qtransform class is introduced to represent the transformation matrix. Unlike qmatrix, qtransform () supports perspective transformation. Use toaffine ()
The function can convert a qtransform object to a qmatrix object. This will lose the perspective transformation data of qtransform. Logical and physical coordinates are transformed from
The worldmatrix () function of qpainter. And qpainter's viewport () and window () functions. The viewport represents an arbitrary number of physical coordinates.
Rectangle. The window Indicates the same rectangle under the logical coordinate. By default, logical coordinates are the same as physical coordinates. It is also consistent with the rectangle on the drawing device. Use window-view transform to enable logical coordinate Operators
In combination with custom requirements, this mechanism is usually used to complete device-independent drawing code. For example, you can set the logical coordinates (-100,-100) to (100,100) and at the origin (),
You can use the qpainter: setwindow () function to perform the following operations.
Qpainter painter (this );
Painter. setwindow (qrect (-100,-100,200,200 ));
Now
In, the logical coordinate (-100,-100) corresponds to the drawing device (), so that the drawing can be independent from the device and always work on the specified logical coordinate. Setting the window or the window rectangle is actually executed
Linear transformation. Essentially, the four corners of a window are mapped to the corresponding four corners of a window, and vice versa. Therefore, the proportional transformation between the two corners is consistent with that between the x-axis and Y-axis of the window, ensuring that the transformation is not deformed. Window-view transform only
Is a linear transformation without cropping. For example, when the painting is out of the window, the painting is still mapped
Draw the view. The process of QT is to perform Coordinate Transformation in the window.
-View transform.
========================================================== ========================================================== ========================================
Use different fonts
Qt provides a font class to represent the font. When a qfont object is created, QT uses the specified font. If there is no corresponding font, QT looks for a closest installed font. Font information is acceptable
Pass
Retrieve qfontinfo and use qfontmetrics to obtain the font-related data. Function exactmatch () to determine whether the underlying window system is fully correct
Font. Use qapplication: setfont () to set the default font of the application. If the selected Font does not include all the characters to be displayed, qfont will try
Find the nearest base font. When qpainter draws a character that does not exist in the specified font
A hollow square line is drawn. Drawing path -- qpainterpath
Painter
Path) is composed of basic elements (rectangular, elliptical, straight line, curve). The drawing path can be a closed path, such as a rectangle and a circle, or a non-closed path, such as a straight line and a curve. Graph path used in QT
Qpainterpth class,
It provides a container for drawing operations to enable graphic reuse. The drawing path can be filled to show the outline and cropping. Plotting of the contour to be filled
Path, you can use the qpainterpathstroker class. The advantage of using qpainterpath is complex.
A graph can be created multiple times.
The qpainterpath object can only have an empty path from the start point, or copy from another qpainterpath object. After creating the qpainterpath object, you can use
Lineto (), cubicto (),
The quadto () function adds straight lines and curves to the path, starting with currentposition ().
Draw. Currentposition () always returns the end point drawn by the last child path. You can use the moveTo () function to move without adding a path.
Currentpositon (), which closes a child meridian and starts a new child Meridian. Closesubpath () can also close the current path and
Currentposition () connects a straight line to the starting point of the drawing path. Qpainter can be used
Addellipse (), addpath (), addrect (), addregion (), addtext () add some basic elements of QT to the drawing path. I
Existing drawing paths can be added to another drawing path through the connectpath () function.
The following code draws an arrow:
Qpainterpath
Path;
Path. moveTo (10,100 );
Path. cubicto (10,100,100, 10,200, 70 );
Path. lineto (200,50 );
Path. lineto (220,80 );
Path. lineto (200,110 );
Path. lineto (200,90 );
Path. cuticto (200,100,100, 50,50, 100 );
Qpainter
Painter (this );
Qpen pen (qcolor (255, 0, 0), 2 );
Painter. setpen (PEN );
Painter. drawpath (PATH );
Qt
Provides two filling modes: QT: oddeventfill and QT: windingfill. QT: oddevent.
Qpainterpath uses the parity filling rule to determine whether a point is in the graph. The method is to draw a horizontal line from the store to the path, and calculate the intersection points of the horizontal line and path. If the intersection point is
If the number is odd, the point is in the path graph. Qpainterpath also has some functions that can obtain path information. For example, the elementat () function can retrieve the specified sub-path element,
Isempty ()
The function checks whether the current path is empty. The controlpointrect () function returns the rectangles of all vertices and control points in the path. This function is faster than returning a precise and inclusive box.
The boundingrect () function is much faster. The contains () function determines whether a vertex or rectangle is in a path. Intersects () determines whether the specified rectangle and path are
No intersection. qpainterpath can be used to convert a rectangle to another image.
The tofillpolygon (), tofillpolygon (), and tosubpathpolygons () functions convert paths to polygon.
Qpainterpath
You can also use text as the path. The following Code demonstrates the text path and uses linear gradient filling.
Qlineargradient
Lineargrad (qpointf (), qpointf ));
Lineargrad. setcolorat (0, QT: Black );
Lineargrad. setcolorat (1, QT: White );
Qfont
Font ("Shu", 80 );
Font. setbold (true );
Qpainterpath textpath ();
Textpath. addtext (200,300, Font, TR ("
E-Industry Press "));
Painter. setbrush (lineargrad );
Painter. drawpath (textpath );
========================================================== ==========================================
Qimage and qpixmap plotting Devices
Qt provides four image processing classes. Qimage, qpixmap, qbitmap, and qpicure
Their respective features. Qimage optimizes I/O operations and allows you to directly access pixel data. Qpixmap is mainly used to display images on the screen. Qbitmap inherits from qpixmap,
It can only represent two colors. qpicture is a class that records and replays the qprinter command. Qimage provides a hardware-independent image representation method. Qimage can be used directly
Access pixel data. qimage can also be used as a drawing device.
The image color supported by qimage can be a monochrome, 8-bit, 32-bit, and Alpha mixed format. Because qimage
It is inherited from qpainterdevice, so qpainter can draw directly on qimage. In addition to drawing the text format (qfont depends on the underlying GUI ).
The painting operation can be completed in any thread. To draw text in other threads, you can use qpainterpath. Qimage objects are implicitly shared and can be used as value passing parameters.
Data Stream and comparison features.
You can use the qimage constructor, load (), and loadfromdata () Methods to read images. You can also use
The static function fromdata () of qimage constructs a qimage object from the specified data. It can be loaded from the file system or embedded resources of the QT application.
Save () can save the qimage object. Qimagereader: supportedimageformats () and
Qimagewriter: supportedimageformats () to obtain the list of all file formats supported by qimage. ------------------------------------------
Qimage Function
Certificate --------------------------------------------------------------------------------------------------------------------------------------------------
Quantity
What are the function size (), widt (), dotspermeterx (), and dotspermetery () functions to obtain the image size and proportion information.
Rect ()
The function returns an inclusive rectangle of the image. Valid () is used to test whether the given coordinate is in this rectangle. Offset () obtains the relative offset between the image and other images. Setoffset () function
Number to set the offset.
Color Functions
The color of a pixel can be obtained through the pixel function. The return value is of the qrgb type. For monochrome and 256 color images, colortable () returns the color palette and numcolors returns
Number of entries in the color palette. Use pixelindex ()
The function gets the color index of the pixel, and then uses the color () function to retrieve the actual color value. hasalphachannel () function to return whether the image uses the alpha channel.
Allgray () and isgrayscale () test whether the image is a grayscale image.
The text () function returns the text appended to the image.
Text, textkeys () returns the key-value table of the text. The settext () function changes the image text.
Low-level information
The depth () function is used to obtain the number of digits of the image color. The options are, 32-bit. Format (). bytesperline () and numbytes ().
Storage information. The serieralnumber () function gets the number that uniquely identifies the qimage object.
Certificate --------------------------------------------------------------------------------------------------------------------------------------------------
Qimage
The 8-bit and monochrome images are accessed using the color index table, and 32-bit images directly store the argb value. therefore, their pixel operation functions are also different. For 32-bit images, setpixel ()
The function can change the qrgb color value of a specified pixel.
For a monochrome image, setpixel () changes the index value in the pre-defined color table. To change the color table, you can use
Setcolor () function. Qimage provides the scanline () function to return data of the specified row. The bits () function returns the pointer to the first pixel. Each pixel is stored in qimage
Are expressed in integer form. A monochrome image uses a one-digit index to point to a palette of only two colors, two types of monochrome images, big endia (MSB), little
Endian (LSB). 256 color image uses an 8-bit color palette. The data type of the palette is qvector, and qrgb is actually an unsigned integer type. The format of the storage argb is
0x0000rggbb. 32-bit images are directly stored in three storage formats: RGB, argb, and pre-Multiplied argb. In the pre-Multiplied argb, the red, green, and blue colors have been
The alpha multiplication and division of the 255. allgray () and isgrayscale () functions can determine whether a color image can be safely converted to a gray image. Image Format
The format () function reads and extracts images. converttoformat () can be used to convert the image format. qimage supports the following storage formats:
Qimage: format_mono ticket
Color Image (MSB)
Qimage: format_monolsb monochrome image (LSB)
Qimage: format_indexed8
Use a 256-color image of a color table
Qimage: format_rgb32 does not support 32-bit Alpha-channel Images
Qimage: format_argb32 included
Alpha-channel 32-bit image
Qimage: format_argb32_premultiplied
Pre-Multiplied 32-bit images with Alpha channels.
-----------------------------------
Qpixmap
Qpixmap
It mainly draws the off-screen buffer. The qpixmap object can use the qlabel or qiniactbutton subclass.
(Qpushbutton, qtoolbutton) display. qlabel sets the pixmap attribute and qiniactbutton sets the icon attribute.
In addition to constructor initialization, The qpixmap object can also be created using the static functions grabwidget () and grabwindow (), and the specified window can be drawn.
And the pixel data in the window part. qpixmap, which is managed by the underlying window system. If you want to access the pixel, you only need to use the qprinter function to play the qpixmap.
Qpixmap can be stored in rgb32 or hybrid Alpha format based on the underlying system. If the image has an alpha channel and the underlying system permits the conversion
The hybrid Alpha format is preferred. Therefore, qpixmap depends on the underlying system. On X11 and Mac, qpixmap is stored on the server and qimage is stored on the customer's site,
In Windows, the expressions of these two classes are the same. Qimage and qpixmap can be converted to each other. Generally, qimage is loaded into the image and operated directly, and then converted
Qpixmap is displayed on the screen. If you do not need to operate on pixels, you can directly use qpixmap. On Windows, qpixmap can also convert to hbitmap.
In other words, qpixmap and qimage use implicit sharing and data stream.
========================================================== ========================================================== ======================================
Group
Mode drawing
Composition
Mode) is used to specify how to merge the source image and an image. The most common is sourceover (usually called Alpha mixing). When the original and target pixels are mixed in this way, the source Image
The alpha channel defines the transparency of pixels. Only the format_argb32_premultiplied and format_argb32 lattice types are supported for Combined Mode plotting,
The format_argb32_premultiplied format should be used first. After the combination mode is set, it is effective for all plotting operations, such as paint brushes, paint brushes, gradient effects and
Pixmap/image rendering. In qpainter: compositemode, the combination types of the first 12 are T. Porter and T. Duff at 1984.
In Years
The calculation method for the 12 types of Porter-Duff hybrid rules described in image is given here. To understand the hybrid process. First, define the mixed factor:
As: Alpha component of the original Pixel
CS:
The premultiplied color component is calculated based on the original pixel type.
AD: Alpha component of the target Pixel
CD;
Color components calculated by the target Pixel
FS: proportion of the original pixel in the output result
FD: proportion of the target pixel in the output result
AR:
Alpha component of the output result type
Cr: calculated color component of the output result.
Porter and Duff define the selection of mixed factors FS and FD Production
There are 12 rules for producing different visual effects. The alpha and color values of the final result are determined by the following formula:
FS = f (AD );
FD = f ();
AR = asxfs + adxfd
Cr = csxfs + cdxfd
The FS and FD values for each type are shown in the table
Display
Bytes ------------------------------------------------------------------------------------------
Regular
Quantity
Fs fd description
Qpainter: compositionmode_sourceover 1 1-
Default Mode: Source Alpha and target pixel Mixing
Qpainter: compositionmode_destinationover
1-ad 1 is opposite to sourceover. The target Alpha is mixed with the source pixel.
Qpainter: compositionmode_clear
N/A n/a clear target Pixel
Qpainter: compositionmode_source N/
N/A output source Pixel
Qpainter: compositionmode_sourcein ad 0
Source substitution target in the target part
Qpainter: compositionmode_destinationi 0
As is opposite to sourcein
Qpainter: compositionmode_sourceout
1-ad 0 source substitution target out of target
Qpainter: compositionmode_destinationout 0
1-as is opposite to sourceout
Qpainter: compositionmode_sourceatop ad 1-
Source and target combinations of As in the target part
Qpainter: compositionmode_destinationatop
1-ad as is opposite to sourceatop
Qpainter: compositionmode_xor
1-ad 1-as is a mixture of sources outside the target and those outside the source.
Bytes --------------------------------------------------------------------------------------------------------
Note
Meaning, the above description does not completely summarize the meaning of various mixing. To accurately understand them, they can look at the formula and practice it. In addition to the 12 porter_duff rules above, QT also supports 12 extensions.
Hybrid mode. The calculation formula is given below. Note that if the Alpha value and color value in the result exceed the range of 0 to, the value will be truncated.
1 qpainter: compositionmode_plus
Add the source and target. This operation is used to dissolve and over-process the two images in the animation. Cr = Cs + cd ar = aS + AD
2 qpainter: compositionmode_multiply
Source and target to perform multiply operations. The color of the result is at least the darker color of the source and target. Any color or black. This operation produces black. Any color or white
The
The operation will not change. Cr = csxcd + CSX (1-AD) + CDX (1-as) Ar = asxad + ASX (1-AD) + ADX (1-ad-
As) = aS + Ad-asxad
3 qpainter: compositionmode_screen
The colors of the source and target are complementary, and then the result is multiplied by at least the brighter colors of the source and target. Any color and black color filtering operation will not change, any color and white color filtering operation
Work
Or White
4 qpainter: compositionmode_overlay perform multiplication or filtering based on the target color value
Source color to keep the brightness and shadow on the target. The target color and source color are mixed to reflect the brightness of the target.
5 qpainter: compositionmode_darken
Select a darker color for the source and target
6 qpainter: compositionmode_lighten select bright colors for the source and target types
Color
7 qpainter: compositoinmode_colordodge highlight the target color to reflect the source color. Rendering black will have no effect.
8 qpainter: compositionmode_colorburn
The target color is dimmed to reflect the source color. It is ineffective to draw a white image.
9 qpainter: compositionmode_hardlight according
The source color determines whether the source color is stacked on the front or filtered. If the source color is greater than 0.5, the target color is highlighted. That is, perform the color filter operation. If the source color brightness is less than 0.5
Yes
The image is dimmed, which is equivalent to stacking the front slice. If the source brightness value is equal to 0.5, the target will not change. If the source brightness is highlighted or dimmed, the source color and the difference of 0.5 are determined.
Color
The result is still pure black or pure white.
10
Qpainter: compositionmode_softlight: depending on the source color, determines whether to perform the darken operation or brightening.
(Lighten) operation. If the source color is brighter than 0.5, the target is brightened, that is, the color filter is performed. If the source color
Ratio
0.5 dark, the target is dimmed, which is equivalent to a burn operation. If it is equal to 0. 5, the target will not change. The degree of brightness or darkness depends on the source color and the difference of 0.5.
Value.
11
Qpainter: compositionmode_difference
The darker colors of the source and target types minus the brighter colors. The painting results in the white color being reversed to the black color.
Informatization
12
Qpainter: compositionmode_exclusion is similar to the effect of the previous rule. However, if the contrast is relatively low, rendering White will result in a reverse
The target color, which is black.