Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> aplikacja paint, javascript
karol0011
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 12.06.2015

Ostrzeżenie: (0%)
-----


witam,
chciałbym przerobić kod, za pomocą którego rysuję ołówkiem, na rysowanie prostokąta,okręgu(elipsy) i linii.
Kod
    // define a pencil brush for drawing free-hand lines
    var PencilBrush = new Class({
        initialize: function (lineWidth, drawingCxt) {
            this.lineWidth = lineWidth;

            // get the cursor associated with the pencil brush
            this.getCursor = function () {
                return "url(cursors/pencil_cursor.cur), crosshair";
            };

            this.setColour = function (colour) {
                drawingCxt.fillStyle = drawingCxt.strokeStyle = colour;
                drawingCxt.lineWidth = this.lineWidth;
                drawingCxt.lineCap = "round";
                drawingCxt.lineJoin = "round";
            };

            // draws a line to the x and y coordinates of the specified position
            function drawLine(position) {
                drawingCxt.lineTo(position.X, position.Y);
                drawingCxt.stroke();
            }

            this.startDrawing = function (position) {
                // start drawing by moving to the specified x and y coordinates
                drawingCxt.beginPath();
                drawingCxt.moveTo(position.X--, position.Y--);
                drawLine(position);
            };

            this.draw = function (position) {
                drawLine(position);
            };

            this.finishDrawing = function (position) {
                // draw the line to the finishing coordinates
                drawLine(position);
                drawingCxt.closePath();
            };
        }
    });


Pomoże ktooś ?
Powód edycji: [Spawnm]:
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 21:39