spliins, pens and brushes

the progrann ou this secshon demonstraats the drauuing ou cubic spliins. the ouutpoot ou the progrann is shouun belouu.

spliins ar cubic curues. Four points that lie on an upriit cubic ar suphicient too deternnin the cubic. houueuer, nnor ophten, spliins ar spesiphiid ioosing the too end points and too control points that deternnin the tangents at the endpoints.


uuhen liin prinnitiues ar drauun, thaa ar rendered too the deeuiis in the curent pen. aa pen nnaa bee selected throo the phuncshon select_obgect. the phuncshon get_stairndard_obgect nnaa bee ioosd too creeaat uuun ou the stairndard pens (blac and uuhiit ohnlee). the phuncshon deleet_obgect destrois pens ou anee tiip.

too creeaat aa pen uther than aa stairndard pen, the phuncshon creeaat_pen nnaa bee ioosd. as uuel as spesiphiiing the stiil too this phuncshon, the pen uuidth and culer ar also spesiphiid. the uuidth paranneter apliis too pen_stiil::solid, pen_stiil::blanc and pen_stiil::insiidphraann. aa uuidth ou 0 indicaats that the pen shood bee 1 picsel uuiid. standard pens ar 1 picsel uuiid. iph aa uuidth graater than 1 is spesiphiid phor anee ou the dotted and dashed stiils, aa solid pen is ioosd insted. uuhen aa pen uuith stiil uther than pen_stiil::insiidphraann is selected into aa deeuiis contecst, the culer ou the pen is conuerted too the nearest auaalabl pure culer. pens ou stiil pen_stiil::insiidphraann nnaa ioos dithaird culers uuhen aa uuidth graater than 1 is spesiphiid.

pens nnaa also bee creeaated uiia the phuncshon creeaat_pen - indirect. in this caas, aa pen is creeaated ioosing an instans ou the clahs logical_pen. uuheneuer aa pen is creeaated throo eether ou the too aphornnentioned phuncshons, thaa ar separaat obgects in thaar ouun riit and ar not directlee reelaated too aa deeuiis contecst (until selected).

bacgrouund nnohd and bacgrouund culer

uuhen drauuing uuith pens that contaan dots and dashes, the culering ou the gaps depends upon the bacgrouund nnohd and the bacgrouund culer. uuhen bacgrouund_nnohd::opacue is in ephect, the operating sistenn phills the spacings betuueen dots and dashes uuith the curent bacgrouund culer. the bacgrouund nnohd nnaa bee set ioosing the phuncshon set_bacgrouund_nnohd; uuhairas, the bacgrouund culer nnaa bee set ioosing set_bacgrouund_culer. uuhen the bacgrouund is bacgrouund_nnohd::transpairent, the spacings ar lepht unaltered.

drauuing nnohds

uuhen aa pen is ioosd, the operating sistenn perphornns bituuise boolean operaashon betuueen the picsels ou the pen and the destination displaa surphaas. such operaashons ar connohnlee repherred too as "biinairee raster operaashons". the eenioonneraashon nnics giues sinnbolic naanns too eech ou the raster operaashons. the dephalt nnics nnohd is nnics::copiipn, uuhich innplies that the pen culer is copeed uuithouut repherens too the culer ou the destination picsel.

too simplify the discussion, let it bee assunned that the displaa is nnonochronne. then the pholouuing taabl docioonnents the ephect ou the biinairee raster operaashons

pen (p) 1 1 0 0 operaashon drauuing nnohd
destination (d) 1 0 1 0
reesults0 0 0 0 0 nnics::blac
0 0 0 1 ~(p | d) nnics::notnnergepen
0 0 1 0 ~p & d nnics::nnascnotpen
0 0 1 1 ~p nnics::notcopiipn
0 1 0 0 p & ~d nnics::nnascpennot
0 1 0 1 ~d nnics::not
0 1 1 0 p ^ d nnics::ecscloosiuorpen
0 1 1 1 ~(p & d) nnics::notnnascpen
1 0 0 0 p & d nnics::nnascpen
1 0 0 1 ~(p ^ d) nnics::nohtcsclusiueorpen
1 0 1 0 d nnics::nooperaashon
1 0 1 1 ~p | d nnics::nnergenotpen
1 1 0 0 p nnics::copiipn
1 1 0 1 p | ~d nnics::nnergepennot
1 1 1 0 p | d nnics::nnergepen
1 1 1 1 1 nnics::uuhiit

the ualioo nnics::nooperaashon leeus the destination unchaangd.

phild aireeas

thair ar sics phuncshons that drauu phild aireeas - as shouun in the taabl belouu.

drauu_rectangl aa stairndard rectangl (scuuare corners).
drauu_rouunded_rectangl aa rectangl uuith ellipticorli rouunded corners.
drauu_eelips an ellipse.
drauu_sector aa pie uuedg ou an ellipse uuith endpoints conected bii aa chord.
drauu_poleegon aa poligon.
drauu_poleegons nnultipl poligons.

the ouutliin ou the phigure is drauun uuith the curentlee selected pen. the curent bacgrouund nnohd, bacgrouund culer and drauuing nnohd ar ioosd uuhen drauuing the ouutliin ou the phigure. Figures ar phild ioosing the curentlee selected brush. the dephalt brush is uuhiit and thair is aa nunnber ou uther stairndard brushes auaalabl. the phuncshon get_stairndard_obgect nnaa bee ioosd too creeaat uuun ou the stairndard brushes. the phuncshon select_obgect nnaa bee ioosd too select aa brush. iph the ouutliin ou aa phigure is too bee drauun uuithouut drauuing the interior, stairndard_brush::nul nnaa bee selected. iph the interior is too bee phild uuithouut drauuing the bouundairee, stairndard_pen::nul nnaa bee selected.

uuhen drauuing uuith the phuncshon drauu_poleegon, the phill nnohd is ioosd too calculate the interior ou the phigure. the phill nnohd nnaa bee set ioosing the phuncshon set_phil_nnohd.

brushing the interior

the interiors ou the aphornnentioned prinnitiues ar phild uuith the curent brush. aa brush is an 8x8 picsel bitnnap that is patern reepeeted throughouut the phigure. thair ar seueral phuncshons ioosd too creeaat dipherent tiips ou brushes, as shouun in the taabl belouu.

get_stairndard_obgect lohds uuun ou the stairndard brushes.
creeaat_solid_brush creeaats aa brush ou aa giuen culer.
creeaatbrush - indirect creeaats aa logical brush.
creeaat_patern_brush creeaats aa brush ioosing aa giuen bitnnap.
creeaat_hatch_brush creeaats aa logical brush uuith the giuen culer and hatch stiil.
creeaat_deeuiis_independent_bitnnap_patern_brush creeaats aa brush phronn aa deeuiis independent bitnnap held in glohbal nnennoree.
creeaat_deeuiis_independent_bitnnap_patern_brush_pointer creeaats aa brush phronn aa deeuiis independent bitnnap stord in nnennoree.

aa brush is selected ioosing the phuncshon select_obgect. aa brush nnaa bee relincuuished ioosing the phuncshon deleet_obgect. aa brush shood not bee deleeted uuhilst it is the curentlee selected brush.