Введение в технологию программирования. Ч.1. Среда объектно-ориентированного программирования Delphi. Коржов Е.Н - 81 стр.

UptoLike

Составители: 

81
Ʉɥɚɫɫ TCanvas
ɗɬɨɬ ɤɥɚɫɫ ɫɨɡɞɚɟɬ «ɤɚɧɜɭ», ɧɚ ɤɨɬɨɪɨɣ ɦɨɠɧɨ ɪɢɫɨɜɚɬɶ ɱɟɪɬɟɠɧɵɦɢ
ɢɧɫɬɪɭɦɟɧɬɚɦɢɩɟɪɨɦ, ɤɢɫɬɶɸ ɢ ɲɪɢɮɬɨɦ. Ɉɛɴɟɤɬɵ ɤɥɚɫɫɚ Tɋɚnvas ɚɜ-
ɬɨɦɚɬɢɱɟɫɤɢ ɫɨɡɞɚɸɬɫɹ ɞɥɹ ɜɫɟɯ ɜɢɞɢɦɵɯ ɤɨɦɩɨɧɟɧɬɨɜ, ɤɨɬɨɪɵɟ ɞɨɥɠɧɵ
ɭɦɟɬɶ ɧɚɪɢɫɨɜɚɬɶ ɫɟɛɹ. Ɉɧɢ ɢɧɤɚɩɫɭɥɢɪɭɸɬ ɨɛɴɟɤɬɵ Font, Pen, Brush, ɚ
ɬɚɤɠɟ ɦɧɨɝɨɱɢɫɥɟɧɧɵɟ ɦɟɬɨɞɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ ɷɬɢ ɨɛɴɟɤɬɵ. Ɉɫɧɨɜɧɵɟ
ɫɜɨɣɫɬɜɚ ɤɥɚɫɫɚ ɩɪɟɞɫɬɚɜɥɟɧɵ ɜ ɬɚɛɥ. 7.4.
Ɍɚɛɥɢɰɚ 4.4
ɋɜɨɣɫɬɜɚ ɤɥɚɫɫɚ TCanvas
ɋɜɨɣɫɬɜɨ Ɉɩɢɫɚɧɢɟ
property Brush: TBrush;
property ClipRect: TRect;
Ɉɛɴɟɤɬ-ɤɢɫɬɶ. Ɉɩɪɟɞɟɥɹɟɬ ɬɟɤɭɳɢɟ ɪɚɡɦɟɪɵ
ɨɛɥɚɫɬɢ, ɧɭɠɞɚɸɳɟɣɫɹ ɜ ɩɪɨɪɢɫɨɜɤɟ
property CopyMode:
TCopyMode;
ɍɫɬɚɧɚɜɥɢɜɚɟɬ ɫɩɨɫɨɛ ɜɡɚɢɦɨɞɟɣɫɬɜɢɹ ɪɚɫ-
ɬɪɨɜɨɝɨ ɢɡɨɛɪɚɠɟɧɢɹ ɫ ɰɜɟɬɨɦ ɮɨɧɚ
property Font: TFont; Ɉɛɴɟɤɬ-ɲɪɢɮɬ
property Pen: TPen; Ɉɛɴɟɤɬ-ɩɟɪɨ
property PenPos:TPoint; Ɉɩɪɟɞɟɥɹɟɬ ɬɟɤɭɳɟɟ ɩɨɥɨɠɟɧɢɟ ɩɟɪɚ ɜ ɩɢɤɫɟ-
ɥɹɯ ɨɬɧɨɫɢɬɟɥɶɧɨ ɥɟɜɨɝɨ ɜɟɪɯɧɟɝɨ ɭɝɥɚ ɤɚɧɜɵ
property Piels
[X,Y:Integer]: TColor;
Ɇɚɫɫɢɜ ɩɢɤɫɟɥɟɣ ɤɚɧɜɵ
ɋɜɨɣɫɬɜɨ ɋopyMode ɦɨɠɟɬ ɩɪɢɧɢɦɚɬɶ ɨɞɧɨ ɢɡ ɫɥɟɞɭɸɳɢɯ ɡɧɚɱɟɧɢɣ:
(ɫɜɨɣɫɬɜɨ ɢɫɩɨɥɶɡɭɟɬɫɹ ɩɪɢ ɤɨɩɢɪɨɜɚɧɢɢ ɱɚɫɬɢ ɨɞɧɨɣ ɤɚɧɜɵ (ɢɫɬɨɱɧɢɤɚ)
ɜ ɞɪɭɝɭɸ (ɩɪɢɟɦɧɢɤ) ɦɟɬɨɞɨɦ copyRect)
ɋɜɨɣɫɬɜɨ Ɉɩɢɫɚɧɢɟ
cmBlackness Ɂɚɩɨɥɧɹɟɬ ɨɛɥɚɫɬɶ ɪɢɫɨɜɚɧɢɹ ɱɟɪɧɵɦ ɰɜɟɬɨɦ
cmDestInvert Ɂɚɩɨɥɧɹɟɬ ɨɛɥɚɫɬɶ ɪɢɫɨɜɚɧɢɹ ɢɧɜɟɪɫɧɵɦ ɰɜɟɬɨɦ ɮɨɧɚ
cmMergeCopy Ɉɛɴɟɞɢɧɹɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɧɚ ɤɚɧɜɟ ɢ ɤɨɩɢɪɭɟɦɨɟ ɢɡɨ-
ɛɪɚɠɟɧɢɟ ɨɩɟɪɚɰɢɟɣ and
cmMergePaint Ɉɛɴɟɞɢɧɹɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɧɚ ɤɚɧɜɟ ɢ ɤɨɩɢɪɭɟɦɨɟ ɢɡɨ-
ɛɪɚɠɟɧɢɟ ɨɩɟɪɚɰɢɟɣ OR
cmNotSrcCopy Ʉɨɩɢɪɭɟɬ ɧɚ ɤɚɧɜɭ ɢɧɜɟɪɫɧɨɟ ɢɡɨɛɪɚɠɟɧɢɟ ɢɫɬɨɱɧɢɤɚ
cmNotSrcErase Ɉɛɴɟɞɢɧɹɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɧɚ ɤɚɧɜɟ ɢ ɤɨɩɢɪɭɟɦɨɟ ɢɡɨ-
ɛɪɚɠɟɧɢɟ ɨɩɟɪɚɰɢɟɣ OR ɢ ɢɧɜɟɪɬɢɪɭɟɬ ɩɨɥɭɱɟɧɧɨɟ
cmPatCopy Ʉɨɩɢɪɭɟɬ ɨɛɪɚɡɟɰ ɢɫɬɨɱɧɢɤɚ
cmPatInvert Ʉɨɦɛɢɧɢɪɭɟɬ ɨɛɪɚɡɟɰ ɢɫɬɨɱɧɢɤɚ ɫ ɢɡɨɛɪɚɠɟɧɢɟɦ ɧɚ
ɤɚɧɜɟ ɫ ɩɨɦɨɳɶɸ ɨɩɟɪɚɰɢɢ XOR
cmPatPaint Ʉɨɦɛɢɧɢɪɭɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɢɫɬɨɱɧɢɤɚ ɫ ɟɝɨ ɨɛɪɚɡɰɨɦ ɫ
ɩɨɦɨɳɶɸ ɨɩɟɪɚɰɢɢ OR, ɡɚɬɟɦ ɩɨɥɭɱɟɧɧɨɟ ɨɛɴɟɞɢɧɹɟɬ-
ɫɹ ɫ ɢɡɨɛɪɚɠɟɧɢɟɦ ɧɚ ɤɚɧɜɟ ɬɚɤɠɟ ɫ ɩɨɦɨɳɶɸ OR
     Ʉɥɚɫɫ TCanvas
     ɗɬɨɬ ɤɥɚɫɫ ɫɨɡɞɚɟɬ «ɤɚɧɜɭ», ɧɚ ɤɨɬɨɪɨɣ ɦɨɠɧɨ ɪɢɫɨɜɚɬɶ ɱɟɪɬɟɠɧɵɦɢ
ɢɧɫɬɪɭɦɟɧɬɚɦɢ – ɩɟɪɨɦ, ɤɢɫɬɶɸ ɢ ɲɪɢɮɬɨɦ. Ɉɛɴɟɤɬɵ ɤɥɚɫɫɚ Tɋɚnvas ɚɜ-
ɬɨɦɚɬɢɱɟɫɤɢ ɫɨɡɞɚɸɬɫɹ ɞɥɹ ɜɫɟɯ ɜɢɞɢɦɵɯ ɤɨɦɩɨɧɟɧɬɨɜ, ɤɨɬɨɪɵɟ ɞɨɥɠɧɵ
ɭɦɟɬɶ ɧɚɪɢɫɨɜɚɬɶ ɫɟɛɹ. Ɉɧɢ ɢɧɤɚɩɫɭɥɢɪɭɸɬ ɨɛɴɟɤɬɵ Font, Pen, Brush, ɚ
ɬɚɤɠɟ ɦɧɨɝɨɱɢɫɥɟɧɧɵɟ ɦɟɬɨɞɵ, ɢɫɩɨɥɶɡɭɸɳɢɟ ɷɬɢ ɨɛɴɟɤɬɵ. Ɉɫɧɨɜɧɵɟ
ɫɜɨɣɫɬɜɚ ɤɥɚɫɫɚ ɩɪɟɞɫɬɚɜɥɟɧɵ ɜ ɬɚɛɥ. 7.4.

                                                             Ɍɚɛɥɢɰɚ 4.4
                            ɋɜɨɣɫɬɜɚ ɤɥɚɫɫɚ TCanvas
        ɋɜɨɣɫɬɜɨ                             Ɉɩɢɫɚɧɢɟ
property Brush: TBrush;     Ɉɛɴɟɤɬ-ɤɢɫɬɶ. Ɉɩɪɟɞɟɥɹɟɬ ɬɟɤɭɳɢɟ ɪɚɡɦɟɪɵ
property ClipRect: TRect;   ɨɛɥɚɫɬɢ, ɧɭɠɞɚɸɳɟɣɫɹ ɜ ɩɪɨɪɢɫɨɜɤɟ
property CopyMode:          ɍɫɬɚɧɚɜɥɢɜɚɟɬ ɫɩɨɫɨɛ ɜɡɚɢɦɨɞɟɣɫɬɜɢɹ ɪɚɫ-
TCopyMode;                  ɬɪɨɜɨɝɨ ɢɡɨɛɪɚɠɟɧɢɹ ɫ ɰɜɟɬɨɦ ɮɨɧɚ
property Font: TFont;       Ɉɛɴɟɤɬ-ɲɪɢɮɬ
property Pen: TPen;         Ɉɛɴɟɤɬ-ɩɟɪɨ
property PenPos:TPoint;     Ɉɩɪɟɞɟɥɹɟɬ ɬɟɤɭɳɟɟ ɩɨɥɨɠɟɧɢɟ ɩɟɪɚ ɜ ɩɢɤɫɟ-
                            ɥɹɯ ɨɬɧɨɫɢɬɟɥɶɧɨ ɥɟɜɨɝɨ ɜɟɪɯɧɟɝɨ ɭɝɥɚ ɤɚɧɜɵ
property Piels              Ɇɚɫɫɢɜ ɩɢɤɫɟɥɟɣ ɤɚɧɜɵ
[X,Y:Integer]: TColor;
ɋɜɨɣɫɬɜɨ ɋopyMode ɦɨɠɟɬ ɩɪɢɧɢɦɚɬɶ ɨɞɧɨ ɢɡ ɫɥɟɞɭɸɳɢɯ ɡɧɚɱɟɧɢɣ:
(ɫɜɨɣɫɬɜɨ ɢɫɩɨɥɶɡɭɟɬɫɹ ɩɪɢ ɤɨɩɢɪɨɜɚɧɢɢ ɱɚɫɬɢ ɨɞɧɨɣ ɤɚɧɜɵ (ɢɫɬɨɱɧɢɤɚ)
ɜ ɞɪɭɝɭɸ (ɩɪɢɟɦɧɢɤ) ɦɟɬɨɞɨɦ copyRect)
  ɋɜɨɣɫɬɜɨ                             Ɉɩɢɫɚɧɢɟ
cmBlackness      Ɂɚɩɨɥɧɹɟɬ ɨɛɥɚɫɬɶ ɪɢɫɨɜɚɧɢɹ ɱɟɪɧɵɦ ɰɜɟɬɨɦ
cmDestInvert     Ɂɚɩɨɥɧɹɟɬ ɨɛɥɚɫɬɶ ɪɢɫɨɜɚɧɢɹ ɢɧɜɟɪɫɧɵɦ ɰɜɟɬɨɦ ɮɨɧɚ
cmMergeCopy      Ɉɛɴɟɞɢɧɹɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɧɚ ɤɚɧɜɟ ɢ ɤɨɩɢɪɭɟɦɨɟ ɢɡɨ-
                 ɛɪɚɠɟɧɢɟ ɨɩɟɪɚɰɢɟɣ and
cmMergePaint     Ɉɛɴɟɞɢɧɹɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɧɚ ɤɚɧɜɟ ɢ ɤɨɩɢɪɭɟɦɨɟ ɢɡɨ-
                 ɛɪɚɠɟɧɢɟ ɨɩɟɪɚɰɢɟɣ OR
cmNotSrcCopy     Ʉɨɩɢɪɭɟɬ ɧɚ ɤɚɧɜɭ ɢɧɜɟɪɫɧɨɟ ɢɡɨɛɪɚɠɟɧɢɟ ɢɫɬɨɱɧɢɤɚ
cmNotSrcErase    Ɉɛɴɟɞɢɧɹɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɧɚ ɤɚɧɜɟ ɢ ɤɨɩɢɪɭɟɦɨɟ ɢɡɨ-
                 ɛɪɚɠɟɧɢɟ ɨɩɟɪɚɰɢɟɣ OR ɢ ɢɧɜɟɪɬɢɪɭɟɬ ɩɨɥɭɱɟɧɧɨɟ
cmPatCopy        Ʉɨɩɢɪɭɟɬ ɨɛɪɚɡɟɰ ɢɫɬɨɱɧɢɤɚ
cmPatInvert      Ʉɨɦɛɢɧɢɪɭɟɬ ɨɛɪɚɡɟɰ ɢɫɬɨɱɧɢɤɚ ɫ ɢɡɨɛɪɚɠɟɧɢɟɦ ɧɚ
                 ɤɚɧɜɟ ɫ ɩɨɦɨɳɶɸ ɨɩɟɪɚɰɢɢ XOR
cmPatPaint       Ʉɨɦɛɢɧɢɪɭɟɬ ɢɡɨɛɪɚɠɟɧɢɟ ɢɫɬɨɱɧɢɤɚ ɫ ɟɝɨ ɨɛɪɚɡɰɨɦ ɫ
                 ɩɨɦɨɳɶɸ ɨɩɟɪɚɰɢɢ OR, ɡɚɬɟɦ ɩɨɥɭɱɟɧɧɨɟ ɨɛɴɟɞɢɧɹɟɬ-
                 ɫɹ ɫ ɢɡɨɛɪɚɠɟɧɢɟɦ ɧɚ ɤɚɧɜɟ ɬɚɤɠɟ ɫ ɩɨɦɨɳɶɸ OR

                                   81