This wiki is out of date, use the continuation of this wiki instead

Drawing stipple

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:30, 20 November 2007 (edit)
Sandman (Talk | contribs)
m (Example)
← Previous diff
Current revision (23:48, 14 August 2008) (edit) (undo)
Sandman (Talk | contribs)
m
 
(One intermediate revision not shown.)
Line 7: Line 7:
Tells [[Fenix]] which pixels to draw of the coming [[drawing]]s. Tells [[Fenix]] which pixels to draw of the coming [[drawing]]s.
-This is done by passing a 32bit value, each bit representing a pixel. Bit 0 represents the first pixels drawn, bit 1 represents the second, etc. When a 33rd pixel is to be drawn or not, bit 0 is checked, etc. This means a value of ''-1'' means normal operation, that is all the pixels will be drawn.+This is done by passing a 32bit value, each bit representing a pixel. Bit 0 represents the first pixels drawn, bit 1 represents the second, etc. When a 33rd pixel is to be drawn or not, bit 0 is checked and the cycle starts over. This means a value of <code>0xFFFFFFFF</code> (=<code>2^32-1</code>) means normal operation, meaning all the pixels will be drawn.
 + 
 +Note that this works only for non-filled drawings. For [[draw_curve]](), the pattern is not always visible for the higher smoothness levels.
== Parameters == == Parameters ==
Line 57: Line 59:
draw_line(100, 50,150,150); draw_line(100, 50,150,150);
- // Draw a curve+ // Draw two curves: one with high smoothness (bit pattern not visible) and one with low smoothness
draw_curve( 200,200, draw_curve( 200,200,
100,200, 100,200,
100,150, 100,150,
300,100,15); 300,100,15);
 + draw_curve( 200,200,
 + 100,200,
 + 100,150,
 + 300,100,1);
// Draw a filled circle // Draw a filled circle

Current revision


Contents

[edit] Definition

INT drawing_stipple ( <INT stipples> )

Tells Fenix which pixels to draw of the coming drawings.

This is done by passing a 32bit value, each bit representing a pixel. Bit 0 represents the first pixels drawn, bit 1 represents the second, etc. When a 33rd pixel is to be drawn or not, bit 0 is checked and the cycle starts over. This means a value of 0xFFFFFFFF (=2^32-1) means normal operation, meaning all the pixels will be drawn.

Note that this works only for non-filled drawings. For draw_curve(), the pattern is not always visible for the higher smoothness levels.

[edit] Parameters

INT stipples - Which pixels to draw, repetitive 32bits.

[edit] Returns

INT : true

[edit] Example

Program example;         
Private
//    int draw_id;
Begin

    // Draw in background
    drawing_map(0,background);

    // Set stipplemode to display every other pixel.
    // binary code 0101 0101 0101 0101 0101 0101 0101 0101
    // hex code 55555555h
    drawing_stipple(55555555h);

    // Draw two lines
    draw_line(10,10,190,10);
    draw_line(11,12,190,12);

    // Draw this funky pattern
    // binary code 0011 1100 0111 1100 1010 0001 1101 0011
    // hex code 3C7CA1D3h
    drawing_stipple(3C7CA1D3h);

    // Draw two lines
    draw_line(10,20,190,20);
    draw_line(11,22,190,22);

    // Draw a circle
    draw_circle(100,100,50);

    // Draw a rectangle
    draw_rect(50,50,150,150);

    // Draw some lines
    draw_line( 50, 50,100,150);
    draw_line(100,150,150, 50);
    draw_line( 50,150,100, 50);
    draw_line(100, 50,150,150);

    // Draw two curves: one with high smoothness (bit pattern not visible) and one with low smoothness
    draw_curve( 200,200,
                100,200,
                100,150,
                300,100,15);
    draw_curve( 200,200,
                100,200,
                100,150,
                300,100,1);

    // Draw a filled circle
    draw_fcircle(20,180,15);

    // Draw a filled rectangle
    draw_box(50,180,80,195);

    // Wait for key ESC
    Repeat
        frame;
    Until(key(_ESC))

End

Used in example: drawing_map(), draw_line(), draw_circle(), draw_rect(), draw_curve(), draw_fcircle(), draw_box(), key()

This will result in something like:

Image:Drawing_stipple.PNG
The workings of drawing_stipple(): pixel patterns


Drawing Functions
Delete_draw() • Draw_box() • Draw_circle() • Draw_curve() • Draw_fcircle() • Draw_line() • Draw_rect() • Drawing_alpha() • Drawing_color() • Drawing_map() • Drawing_stipple() • Drawing_z() • Move_draw() •
Personal tools