Introduction to 2D and 3D Computer Graphics Understanding Raster Architectures • Introduction to raster graphics: • Pixels & bitmaps • Block moves & raster operations • Drawing modes and transparency • Pipeline Discuss Programming Project, Selection of Groups, and Research Work • Questions? Notes: Reading Assignment: (Computer Graphics - Principles and Practice by Foley, van Dam, Feiner, and Hughes; 2nd Edition) Chapter 3: Section 3.1 Chapter 4: Sections 4.1 thru 4.5 Homework Assignment: Page 197: 4.9a, 4.12
Introduction to 2D and 3D Computer Graphics The objective for today’s lecture is to examine what is going on at a fairly low-level when we request a drawing operation to be performed. Please note, you are definitely NOT restricted to just manipulating pixels at this low-level in your projects We will move rather quickly through the material and also cover material from packet #1 today. If time, a scientific visualization video will give us insights as to when “voxels” (low-level) versus object models (higher level should be used Notes: Reading Assignment: (Computer Graphics - Principles and Practice by Foley, van Dam, Feiner, and Hughes; 2nd Edition) Chapter 3: Section 3.1 Chapter 4: Sections 4.1 thru 4.5 Homework Assignment: Page 197: 4.9a, 4.12
Using Raster Graphics Like programming methodologies Some Thoughts Like programming methodologies raster graphics must be examined in relation to its underlying semantics how do we justify what is “good” or “realistic” the perceived quality of rendering can depend on our perception, the evaluation criteria, the viewing monitor (is it properly adjusted), the viewing-room illumination, depth of the pixmap
Using Raster Graphics In addition, Some Thoughts In addition, just because a graphics system performs an operation that is desired, it may not perform that operation in the fashion desired therefore, we must look beyond the surface and examine the underlying semantics behind each and every operation for example, are line segment endpoint’s included in the line segment drawn? (Sproull says :”yes”)
Using Raster Graphics Pixels... Monochrome is "1-bit per pixel" ...are the smallest addressable unit on a raster graphics device ...can be thought of as an individually-addressable dot ...stands for: picture element ...are grouped into rectangular arrays creating raster output Monochrome is "1-bit per pixel" For devices supporting shades of gray or color... ...pixels are considered to have depth Notes: The smallest addressable unit on a raster graphics device is called a pixel (picture element); where, rectangular arrays of pixels comprise the user's picture. On a black and white device, each pixel can be made either black or white. On devices that support shades of gray or color, each pixel can be set to an intermediate shade of gray or to some color.
Using Raster Graphics Pixels... ...are the smallest modifiable element of a raster device ...are device-dependent ...have a 1-to-1 correspondence with the device coordinates of a raster device ...contain one or more bits of information ...can independently be assigned a value representing an intensity or a color Notes: (Chapter 6.2 Pixels -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed A pixel is the smallest modifiable element of a raster device; it is device-dependent. A pixel is an unsigned quantity containing one or more bits of information. A one-to-one correspondence exists between the device coordinates and the pixels of a raster device; each addressable point on a raster device represents one pixel that can independently be assigned a value representing an intensity or a color. Portability of applications to different raster devices requires that applications be aware of the pixel characteristics. There are two pixel characteristics that can vary between devices: pixel shape and pixel location.
Using Raster Graphics When pixels are circular... Pixels -- Shape When pixels are circular... ...no distortion occurs Notes: (Chapter 6 Pixel shape -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Pixels are circular when they are stored in memory; however, they are either circular or elliptical when they are displayed. Whether pixels are circular or elliptical affects those functions that use device coordinates... It also affects those functions that store pixels in an array: PIXEL ARRAY and GET PIXEL ARRAY. For example, the picture in this slide could be digitized and stored in an array. The array could then subsequently be displayed. If pixels are circular, the picture in the array is not distorted when it is displayed; the aspect ratio of the picture is preserved...
Using Raster Graphics When pixels are elliptical... Pixels -- Shape When pixels are elliptical... ...distortion can occur (implicit display xform) ...functions that use device coordinates are affected Notes: (Chapter 6 Pixel shape -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed ...If pixels are elliptical, the picture in the array is distorted when it is displayed; the pixels are stretched. This distortion results from a transformation inherent in a device with elliptical pixels; it is called the implicit display transformation. The implicit display transformation is taken into account when world coordinates are mapped to device coordinates; therefore, objects specified using modeling coordinates are not affected by the implicit display transformation. Whenever a graphic object is drawn, the object is mapped in such a way as to compensate for the distortion introduced by the implicit display transformation. Pictures drawn using the primitive functions described this morning are not distorted by the implicit display transformation. This is also true for the bitblt functions which will be described later this afternoon.
Pixels -- Location relative to coordinates Using Raster Graphics Notes: (Chapter 6 Pixel location -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Pixels are centered either on device coordinates or between device coordinates. Where a pixel is positioned with respect to device coordinates is device dependent; it is usually ON or BETWEEN. If it is ON, pixels are centered on device coordinates. If it is BETWEEN, pixels are centered between device coordinates. Knowledge of the pixel location is important when abutting filled areas in order to eliminate overlap or gaps between the areas. Pixels on device coordinates Pixels between device coordinates
Pixels -- Location relative to coordinates Using Raster Graphics • For lines: Notes: (Chapter 6 Pixel location -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The pixel associated with each device coordinate depends on the area occupied by the graphic object (e.g., line or filled area) and whether pixels are on or between device coordinates. This association is implementation-dependent; however, the following guidelines are important for associating pixels with device coordinates. For lines, when pixels are on device coordinates, a pixel on a coordinate is associated with that coordinate. When pixels are between device coordinates, the pixel in the direction of increasing x and y coordinates is associated with that coordinate. This association also applies to the lines that define the edges and the boundaries of filled areas. Pixels on device coordinates Pixels between device coordinates
Pixels -- Location relative to coordinates Using Raster Graphics Pixels -- Location relative to coordinates • Guidelines for areas results in... ...the same number of pixels: Notes: (Chapter 6 Pixel location -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed For filled areas, when pixels are on device coordinates, a pixel belongs to the interior if it is strictly within the boundary of the filled area. In addition, pixels on the boundary are part of the interior if an arbitrarily small region in the direction of increasing x and y coordinates from the pixel is also strictly within the boundary. When pixels are between device coordinates, a pixel belongs to the interior only if it is strictly within the boundary of the filled area. Pixels on device coordinates Pixels between device coordinates
Pixels -- Location relative to coordinates Using Raster Graphics Pixels -- Location relative to coordinates • Not using these guidelines for areas results in... ...different number of pixels: Notes: (Chapter 6 Pixel location -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed For filled areas, the number of pixels associated with the interior can differ when the guidelines previously described are not followed. This difference depends on whether pixels are on or between device coordinates. The number of pixels associated with the interior of a filled area does not differ when these guidelines are followed. Pixels on device coordinates Pixels between device coordinates
Using Raster Graphics Resolution... ...on a raster graphics device is a measure of the number of pixels per unit of distance along the X and Y dimensions ...is not necessarily the same in the X and Y dimensions ...can be, for example, 1024x768 (1K by 768), 2Kx2K, etc. Notes: The resolution of a raster graphics device is a measure of the number of pixels per unit of distance along the two linear dimensions. Resolution may not be the same in the horizontal and vertical directions. The graphic objects described earlier today have jagged edges when drawn on a raster device. This effect causes jaggies or staircasing. Aliasing creates jaggies. Antialiasing can reduce or eliminate aliasing. In addition, by increasing the resolution, the jaggies will be diminished; however, increasing the resolution is an expensive solution and does not eliminate the problem.
Using Raster Graphics Bitmaps A bitmap is a region of computer memory containing pixels Bitmaps can be... ...displayable bitmaps ...nondisplayable bitmaps ...application-created bitmaps ...drawing bitmaps Notes: (Chapter 6 Bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed A bitmap is a region of computer memory containing pixels... There are two types of bitmaps: displayable and nondisplayable. The contents of displayable bitmaps can be displayed on the display surface of a graphics device; the contents of nondisplayable bitmaps cannot be displayed on the display surface of a graphics device. Displayable bitmaps can be predefined by the implementation; nondisplayable bitmaps can only be created by the application. Both types of bitmaps can be created by the application when additional bitmaps are needed for drawing and displaying pictures. Each bitmap is uniquely identified by a bitmap identifier; multiple bitmaps are therefore distinguishable. Bitmaps can be controlled; they can be selected to be drawn into and can be selected to be displayed out of.
Using Raster Graphics Bitmaps... Bitmaps can be... ...are uniquely identified by an identifier ...are therefore distinguishable ...are controllable by the application Bitmaps can be... ...created ...deleted ...selected to be displayed out of ...selected to be drawn into Notes: (Chapter 6 Bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed A bitmap is a region of computer memory containing pixels... There are two types of bitmaps: displayable and nondisplayable. The contents of displayable bitmaps can be displayed on the display surface of a graphics device; the contents of nondisplayable bitmaps cannot be displayed on the display surface of a graphics device. Displayable bitmaps can be predefined by the implementation; nondisplayable bitmaps can only be created by the application. Both types of bitmaps can be created by the application when additional bitmaps are needed for drawing and displaying pictures. Each bitmap is uniquely identified by a bitmap identifier; multiple bitmaps are therefore distinguishable. Bitmaps can be controlled; they can be selected to be drawn into and can be selected to be displayed out of.
Using Raster Graphics Displayable bitmaps... Bitmaps - Displayable Displayable bitmaps... ...can be displayed on the display surface of a raster device ...are predefined by the implementation ...can also be created by the application ...always exist ...support color the same as the physical device: - direct - indexed Notes: (Chapter 6 Displayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The bitmap from which pixels are read and displayed is called the display bitmap. Any displayable bitmap can be selected to be the display bitmap; however, there can only be one display bitmap at a time. There is always a display bitmap selected... Multiple displayable bitmaps are useful for graphics animation. The color capabilities of a displayable bitmap are the same as the physical device.
Bitmaps - Nondisplayable Using Raster Graphics Bitmaps - Nondisplayable Nondisplayable bitmaps... ...cannot be displayed on the display surface of a device ...may need to be copied to a displayable bitmap to be seen ...are not predefined by the implementation ...can be created by the application Two types of nondisplayable bitmaps exist...full depth, indexed Notes: (Chapter 6 Nondisplayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The contents of nondisplayable bitmaps cannot be displayed on the display surface of a raster device; to be displayed, their contents must be copied to or combined with the contents of a displayable bitmap using a raster operation function. Nondisplayable bitmaps are always created by the application; they are never predefined by the implementation. Nondisplayable bitmaps can be created when displayable bitmaps cannot be created. This occurs in those cases when no additional memory is available to create displayable bitmaps on raster devices that require special displayable memory. The color capabilities of nondisplayable bitmaps depend on the type of nondisplayable bitmap: full depth or mapped.
Bitmaps - Full depth nondisplayable Using Raster Graphics Bitmaps - Full depth nondisplayable Full depth bitmaps have the... ...same number of bits per pixel as displayable bitmaps ...same color capabilities as displayable bitmaps (either direct color or indexed color) Full depth bitmaps are useful when the implementation cannot create additional displayable bitmaps Notes: (Chapter 6 Nondisplayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Full depth bitmaps are nondisplayable bitmaps with the same number of bits per pixel as displayable bitmaps... Pixels in full depth bitmaps are maintained as either indexed or direct color specifiers in the same way that pixels in displayable bitmaps are maintained. Full depth nondisplayable bitmaps are used when the implementation does not allow the creation of displayable bitmaps.
Bitmaps - Mapped nondisplayable Using Raster Graphics Bitmaps - Mapped nondisplayable Mapped bitmaps have... ...only one bit per pixel ...a foreground value ...a background value Mapped bitmaps are useful for storing graphics with only foreground and background information Notes: (Chapter 6 Nondisplayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Mapped bitmaps are nondisplayable bitmaps with only one bit per pixel. Pixels in a mapped bitmap can assume two values: foreground and background. Mapped bitmaps are useful for storing graphics with only foreground and background information. Examples of such graphics are bitmap character fonts, hatch styles, and black and white patterns. A mapped bitmap is an efficient way to store such information because only one bit per pixel is required.
Bitmaps - Mapped nondisplayable Using Raster Graphics Bitmaps - Mapped nondisplayable For example, a mapped bitmap is an efficient way to store information such as bitmap character fonts, hatch styles, and black and white patterns Notes: (Chapter 6 Nondisplayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Mapped bitmaps are nondisplayable bitmaps with only one bit per pixel. Pixels in a mapped bitmap can assume two values: foreground and background. Mapped bitmaps are useful for storing graphics with only foreground and background information. Examples of such graphics are bitmap character fonts, hatch styles, and black and white patterns. A mapped bitmap is an efficient way to store such information because only one bit per pixel is required.
Bitmaps - Mapped nondisplayable Using Raster Graphics Bitmaps - Mapped nondisplayable The background color... ...specifies the color that will be saved as the background value when writing into a mapped bitmap ...saves all other colors as the foreground value when writing into a mapped bitmap ...specifies the color that the background value will assume when reading from a mapped bitmap Notes: (Chapter 6 Nondisplayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The actual value of foreground and background pixels in mapped bitmaps is specified by the application... These values specify the colors that the foreground and background values will be expanded to when reading pixels from a mapped bitmap...
Bitmaps - Mapped nondisplayable Using Raster Graphics Bitmaps - Mapped nondisplayable The foreground color... ...specifies the color that the foreground value will assume when reading from a mapped bitmap Colors can be lost when stored in a mapped bitmap Notes: (Chapter 6 Nondisplayable bitmaps-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The actual value of foreground and background pixels in mapped bitmaps is specified by the application... These values specify the colors that the foreground and background values will be expanded to when reading pixels from a mapped bitmap...
Using Raster Graphics The drawing bitmap... Bitmaps - Drawing The drawing bitmap... ...is the bitmap into which pixels are written ...can be either displayable or nondisplayable ...cannot be seen unless it is also selected to be the display bitmap as well The drawing bitmap may be different than the bitmap being displayed Notes: (Chapter 6 Drawing bitmap -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The bitmap into which pixels are written is called the drawing bitmap. Any bitmap, either displayable or nondisplayable, can be selected to be the drawing bitmap; however, there can only be one drawing bitmap at a time. A drawing bitmap is always selected. The contents of the drawing bitmap cannot be seen unless it is also selected to be the display bitmap. The drawing bitmap and the display bitmap may be independent of one another. When the selected drawing bitmap is not also the selected display bitmap, the static picture in the display bitmap is visible but the picture in the drawing bitmap is not visible. In order to see a picture as it is drawn, the drawing bitmap must also be selected to be the display bitmap.
Using Raster Graphics Raster operation functions... (rasterops) Raster Operations Raster operation functions... (rasterops) ...manipulate rectangular regions of pixels Raster operation functions are... ...Bitblt functions ...Pixel array functions Bitblt functions move and combine rectangular regions of pixels between bitmaps Notes: (Chapter 6 Raster operation functions -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Raster operation functions move and modify rectangular regions of pixels; they do not manipulate graphic objects. No inherent geometric structure is associated with the pixel values on which they operate; therefore, there are no associated attributes. Transparency and drawing mode, which are raster attributes associated with graphic objects, are input parameters to raster operation functions. No transformations are ever applied to pixels as a result of using raster operation functions. Two categories of raster operation functions exist: bitblt functions and pixel array functions. Bitblt functions combine a rectangular region of pixels from a source bitmap with a rectangular region in the drawing bitmap. Pixel array functions either combine pixels from a application-specified array with a rectangular region in the drawing bitmap or move a rectangular region of pixels from the drawing bitmap into a application-specified array.
Using Raster Graphics Raster Operations Pixel array functions move or combine rectangular regions of pixels between a bitmap and an array RASTER OPERATION FUNCTIONS OPERATE ON PIXEL DATA. THEY DO NOT MANIPULATE GRAPHIC OBJECTS. THERE IS NO INHERENT STRUCTURE ASSOCIATED WITH THE DATA ON WHICH THEY OPERATE Notes: (Chapter 6 Raster operation functions -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Raster operation functions move and modify rectangular regions of pixels; they do not manipulate graphic objects. No inherent geometric structure is associated with the pixel values on which they operate; therefore, there are no associated attributes. Transparency and drawing mode, which are raster attributes associated with graphic objects, are input parameters to raster operation functions. No transformations are ever applied to pixels as a result of using raster operation functions. Two categories of raster operation functions exist: bitblt functions and pixel array functions. Bitblt functions combine a rectangular region of pixels from a source bitmap with a rectangular region in the drawing bitmap. Pixel array functions either combine pixels from a application-specified array with a rectangular region in the drawing bitmap or move a rectangular region of pixels from the drawing bitmap into a application-specified array.
Raster Operations -- Bitblts Using Raster Graphics Raster Operations -- Bitblts Bitblt functions... (we called them pixblt) ...combine rectangular regions of pixels from... ...one or two source bitmaps to... ...a destination bitmap The source bitmap can be any bitmap... ...displayable ...full depth nondisplayable ...mapped nondisplayable Notes: (Chapter 6 Bitblt functions -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Bitblt is an acronym derived from BIT-aligned BLock Transfer. Bitblt functions move and combine rectangular regions of pixels from one or two source bitmaps to a destination bitmap. The source bitmap can be any displayable or nondisplayable bitmap. The destination bitmap is always the drawing bitmap. A bitblt that has one source and one destination is called a two-operand bitblt. A bitblt that has two sources and one destination is a called a three-operand bitblt.
Raster Operations - Source Destination Bitblts Using Raster Graphics Raster Operations - Source Destination Bitblts Two-operand bitblt has... ...one source bitmap ...one destination bitmap The pixels from the source bitmap are moved to and combined with pixels in the destination bitmap starting at the destination origin point Notes: (Chapter 6 SOURCE DESTINATION BITBLT -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed SOURCE DESTINATION BITBLT is a two-operand bitblt. It combines pixels in a rectangular region of the source bitmap with pixels in a rectangular region in the drawing bitmap... The source origin parameter specifies a corner of a region in the source bitmap. The opposite corner is determined by adding the values of x offset and y offset to this point. These points are mapped to device coordinates to determine the size and the location in pixels of the resulting source region. The destination origin parameter specifies a corner of a region in the drawing bitmap. The opposite corner is determined by adding the values of x offset and y offset to this point.
Raster Operations - Source Destination Bitblts Using Raster Graphics Raster Operations - Source Destination Bitblts Three-operand bitblt has... ...one source bitmap ...one pattern bitmap ...one destination bitmap Notes: (Chapter 6 SOURCE DESTINATION BITBLT -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed SOURCE DESTINATION BITBLT is a two-operand bitblt. It combines pixels in a rectangular region of the source bitmap with pixels in a rectangular region in the drawing bitmap... The source origin parameter specifies a corner of a region in the source bitmap. The opposite corner is determined by adding the values of x offset and y offset to this point. These points are mapped to device coordinates to determine the size and the location in pixels of the resulting source region. The destination origin parameter specifies a corner of a region in the drawing bitmap. The opposite corner is determined by adding the values of x offset and y offset to this point.
Using Raster Graphics Raster Operations - Source Destination Bitblts Drawing Mode = OR; Transparency = OPAQUE
Using Raster Graphics Raster Operations - Three Operand Bitblts Drawing Mode = OR; Transparency = OPAQUE Notes: (6.5.2.2 TILE THREE OPERAND BITBLT-- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The TILE THREE OPERAND BITBLT; function is a three-operand bitblt. It combines the pixels in a rectangular region of the source bitmap and a rectangular region of the pattern bitmap with pixels in a rectangular region in the drawing bitmap. The bitmap region parameter specifies the region in the pattern bitmap that defines the pattern to be combined with the source and destination regions. This region is specified as two VDC points. A nonzero area must be specified; that is, the x coordinates and the y coordinates of the two points must be different. If either the x or y coordinates are the same, an error is detected and the function is ignored. The effective pattern is established by positioning the lower-left corner of bitmap region at the Fill Reference Point. The data in bitmap region is conceptually replicated over the entire destination bitmap. The portion of the effective pattern that overlaps the destination region is combined with the source and destination regions.
Using Raster Graphics Drawing Modes Drawing modes specify how pixels representing a graphic object are combined with pixels in the drawing bitmap during rendering Drawing modes... ...work with a source pixel (value of the pixel representing the graphic object) ...destination pixel (value of the pixel in the drawing bitmap before combination with the graphic object) Notes: (Chapter 6 Drawing mode -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The drawing mode associated with a graphic object specifies how pixels representing the graphic object are combined with pixels in the drawing bitmap. Two operands are used to combine pixels. One operand is the value of the pixel representing the graphic object; this is the source pixel. The other operand is the value of the pixel in the drawing bitmap; this is the destination pixel. Pixels are always treated as unsigned quantities. The drawing mode operation combines the source and destination pixels one bit at a time. The resulting pixel value is stored back into the drawing bitmap overwriting the destination pixel. Only the destination pixel is affected. If the source and destination pixels contain one bit, each bit of the two pixels is combined as specified by the drawing mode. If the source and destination pixels contain more than one bit, each bit of the source pixel is combined with the corresponding bit of the destination pixel on a bitwise basis until all bits in the two pixels have been combined according to the drawing mode.
Using Raster Graphics Drawing Modes Drawing mode combines the source and destination pixels and places the result in the drawing bitmap Three common drawing mode classes are... ...BOOLEANOP ...ADDITIVEOP ...COMPARATIVEOP Notes: (Chapter 6 Drawing mode -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The drawing mode associated with a graphic object specifies how pixels representing the graphic object are combined with pixels in the drawing bitmap. Two operands are used to combine pixels. One operand is the value of the pixel representing the graphic object; this is the source pixel. The other operand is the value of the pixel in the drawing bitmap; this is the destination pixel. Pixels are always treated as unsigned quantities. The drawing mode operation combines the source and destination pixels one bit at a time. The resulting pixel value is stored back into the drawing bitmap overwriting the destination pixel. Only the destination pixel is affected. If the source and destination pixels contain one bit, each bit of the two pixels is combined as specified by the drawing mode. If the source and destination pixels contain more than one bit, each bit of the source pixel is combined with the corresponding bit of the destination pixel on a bitwise basis until all bits in the two pixels have been combined according to the drawing mode.
Drawing Modes - BOOLEANOP Using Raster Graphics Drawing Modes - BOOLEANOP • 0) d' = 0 • 1) d' = s AND d • 2) d' = s AND (NOT d) • 3) d' = s • 4) d' = (NOT s) AND d • 5) d' = d • 6) d' = s XOR d • 7) d' = s OR d Notes: (Chapter 6 Drawing mode -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed One example of drawing mode is boolean replacement; that is, the source pixels simply replace the destination pixels. In this case, pixels are not combined; the destination pixels have no affect on the drawn object. Other drawing mode operations allow more complex interactions between the source and destination pixels. For example, a graphic object with a drawing mode of XOR (exclusive or) results in a pixel operation that sets the destination bit to zero when the bits are equal and sets the destination bit to one when the bits are different. With a mapped bitmap, this particular drawing mode is useful because it ensures that the graphic object is always visible independent of the background on which it is drawn. Other drawing modes are OR and AND. Notes: (Chapters 6 BOOLEANOP -- Butterworth-Heinemann CGI) The BOOLEANOP drawing mode class combines the source and destination pixels on a bitwise basis using combinations of the NOT, AND, OR, and XOR boolean operations. s = source pixel d = destination pixel before operation d' = destination pixel after operation
Drawing Modes - BOOLEANOP Using Raster Graphics Drawing Modes - BOOLEANOP • 8) d' = NOT (s OR d) • 9) d' = NOT (s XOR d) • 10) d' = NOT d • 11) d' = s OR (NOT d) • 12) d' = NOT s • 13) d' = (NOT s) OR d • 14) d' = NOT (s AND d) • 15) d' =1 Notes: (Chapter 6 Drawing mode -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed One example of drawing mode is boolean replacement; that is, the source pixels simply replace the destination pixels. In this case, pixels are not combined; the destination pixels have no affect on the drawn object. Other drawing mode operations allow more complex interactions between the source and destination pixels. For example, a graphic object with a drawing mode of XOR (exclusive or) results in a pixel operation that sets the destination bit to zero when the bits are equal and sets the destination bit to one when the bits are different. With a mapped bitmap, this particular drawing mode is useful because it ensures that the graphic object is always visible independent of the background on which it is drawn. Other drawing modes are OR and AND. Notes: (Chapters 6 BOOLEANOP -- Butterworth-Heinemann CGI) The BOOLEANOP drawing mode class combines the source and destination pixels on a bitwise basis using combinations of the NOT, AND, OR, and XOR boolean operations.
Drawing Modes - BOOLEANOP Using Raster Graphics Drawing Modes - BOOLEANOP
Transparency Examples Using Raster Graphics Transparency Examples Notes: (Chapter 6 Transparency -- Butterworth-Heinemann CGI Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Transparency specifies whether or not the background is involved with raster operations. Its value is OPAQUE or TRANSPARENT. The effect is the same for the raster operation functions as it is for graphic objects. If OPAQUE, both foreground and background pixels are combined with pixels in the drawing bitmap. If TRANSPARENT, only foreground pixels are combined with pixels in the drawing bitmap. This results in the contents of the drawing bitmap showing through in place of the background pixels.
Transparency Examples Using Raster Graphics Transparency Examples Using Opaque Transparency
Transparency Examples Using Raster Graphics Transparency Examples Using Transparent Transparency
Raster Pipeline Components common with 2D and 3D graphic object pipelines Notes: (Chapter 6 Raster pipeline -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed The raster pipeline includes five components common to the graphic object pipeline: • applying drawing surface clipping, • physical rendering, • applying color, • applying the implicit display transformation, and • echoing. For a raster Virtual Device, two additional components appear in the pipeline. They are bitmaps and bitmap connections.
Raster Pipeline Notes: (Chapter 6 Displayable bitmaps -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed An implementation supporting a raster device always provides at least one displayable bitmap. This is needed to display a picture on the display surface of the device. The application can created additional displayable bitmaps as needed... Notes: (Chapter 6 Nondisplayable bitmaps -- Butterworth-Heinemann CGI) Copyright © 1991 K.S. Chauveau, J.S. Chin, T.N. Reed Nondisplayable bitmaps must always be created by the application. They cannot be displayed; their pixels must be copied onto or combined with the contents of a displayable bitmap in order to be seen. They are useful when additional displayable bitmaps cannot be created. The physical characteristics of a nondisplayable bitmap depend on its type: full depth or mapped...
Example: bitmap connections Raster Pipeline