Symbian3/SDK/Source/GUID-25035286-5134-51F6-A3B6-C0DF0E802719.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept xml:lang="en" id="GUID-25035286-5134-51F6-A3B6-C0DF0E802719"><title>The Linear DDA</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Linear Digital Differential Analyzers (DDAs) are used by various functions to construct straight lines and to calculate bitmap stretching and compression. </p> <section><title>Line construction </title> <p>The linear DDA constructs a pixel line between the start point and end point, using the straight geometric line between these points. </p> <p>In the example below Line A has a start point (3,10) and end point (22,6). The x-delta is therefore 22-3+1=20. The y-delta is 10-6+1=5. 5 goes into 20 exactly four times, so each step of the pixel line has four pixels in it. </p> <fig id="GUID-7FCC7B03-5EC0-5F5B-852B-2D372B8DABD5"><image href="GUID-4CFFD28E-25B5-5B3F-859F-DF8ADC1DC029_d0e206436_href.png" placement="inline"/></fig> <p>The distribution of pixels is fairly straightforward if the x-delta is an exact multiple of the y-delta, or vice versa. In this case there are the same number of pixels in each pixel line step (as in the case of line A). When the x-delta is <i>not</i> an exact multiple of the y-delta, (or vice versa) the pixels in the pixel line cannot be distributed evenly so the pixel line steps each have differing numbers of pixels (as in the case of line B). </p> </section> <section><title>Scaling bitmaps </title> <p>When a bitmap is to be displayed it often has to be stretched or compressed to fit the desired display area. </p> <p>The linear DDA constructs an imaginary pixel line between the start point and end point, using the straight geometric line between these points. This is then used to stretch or compress the original bitmap prior to display. </p> <p>The example below uses linear DDA to do a 400% horizontal scaling of a bitmapped "6" character. In most situations two linear DDAs would be needed, one for horizontal and one for vertical scaling. </p> <fig id="GUID-AF1CACFD-09B3-5C0B-9FF0-01A55F543D8E"><image href="GUID-B80E3FB0-C26F-52A8-B4DE-0A219B974ABC_d0e206459_href.png" placement="inline"/></fig> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
    12 <concept xml:lang="en" id="GUID-25035286-5134-51F6-A3B6-C0DF0E802719"><title>The Linear DDA</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Linear Digital Differential Analyzers (DDAs) are used by various functions to construct straight lines and to calculate bitmap stretching and compression. </p> <section><title>Line construction </title> <p>The linear DDA constructs a pixel line between the start point and end point, using the straight geometric line between these points. </p> <p>In the example below Line A has a start point (3,10) and end point (22,6). The x-delta is therefore 22-3+1=20. The y-delta is 10-6+1=5. 5 goes into 20 exactly four times, so each step of the pixel line has four pixels in it. </p> <fig id="GUID-7FCC7B03-5EC0-5F5B-852B-2D372B8DABD5"><image href="GUID-4CFFD28E-25B5-5B3F-859F-DF8ADC1DC029_d0e201428_href.png" placement="inline"/></fig> <p>The distribution of pixels is fairly straightforward if the x-delta is an exact multiple of the y-delta, or vice versa. In this case there are the same number of pixels in each pixel line step (as in the case of line A). When the x-delta is <i>not</i> an exact multiple of the y-delta, (or vice versa) the pixels in the pixel line cannot be distributed evenly so the pixel line steps each have differing numbers of pixels (as in the case of line B). </p> </section> <section><title>Scaling bitmaps </title> <p>When a bitmap is to be displayed it often has to be stretched or compressed to fit the desired display area. </p> <p>The linear DDA constructs an imaginary pixel line between the start point and end point, using the straight geometric line between these points. This is then used to stretch or compress the original bitmap prior to display. </p> <p>The example below uses linear DDA to do a 400% horizontal scaling of a bitmapped "6" character. In most situations two linear DDAs would be needed, one for horizontal and one for vertical scaling. </p> <fig id="GUID-AF1CACFD-09B3-5C0B-9FF0-01A55F543D8E"><image href="GUID-B80E3FB0-C26F-52A8-B4DE-0A219B974ABC_d0e201451_href.png" placement="inline"/></fig> </section> </conbody><related-links><link href="GUID-55C8C429-1BEC-5A58-94EC-DA1E51F62867.dita"><linktext>Drawing
    13                 to a Graphics Context Tutorials</linktext> </link> <link href="GUID-E3AC8F3E-9D5C-5E7D-9760-023B77C7C8A8.dita"><linktext>Drawing and Graphics Contexts</linktext> </link> </related-links></concept>
    13                 to a Graphics Context Tutorials</linktext> </link> <link href="GUID-E3AC8F3E-9D5C-5E7D-9760-023B77C7C8A8.dita"><linktext>Drawing and Graphics Contexts</linktext> </link> </related-links></concept>