The GR32_VectorUtils.Circle method works different from my expectation
I'm using the following code blocks to draw a circle on TBitmap32 (x:0,y:0) points.
Pts := Circle(0,0,35);
PolylineFS(Bitmap32, Pts, clBlack32, True, 3);
However, the drawn circle is drawn behind the specified coordinates. Half of the circle is in the minus coordinates of the TBitmap32.
Pts := Circle(35,35,35);
When I try this line of code, the x coordinate is drawn almost to the correct point, but Y point is still not in the correct coordinate.
I want this function to act like TCanvas.Ellipse. I tried a lot of things, but I wasn't successful.
delphi graphics32
add a comment |
I'm using the following code blocks to draw a circle on TBitmap32 (x:0,y:0) points.
Pts := Circle(0,0,35);
PolylineFS(Bitmap32, Pts, clBlack32, True, 3);
However, the drawn circle is drawn behind the specified coordinates. Half of the circle is in the minus coordinates of the TBitmap32.
Pts := Circle(35,35,35);
When I try this line of code, the x coordinate is drawn almost to the correct point, but Y point is still not in the correct coordinate.
I want this function to act like TCanvas.Ellipse. I tried a lot of things, but I wasn't successful.
delphi graphics32
add a comment |
I'm using the following code blocks to draw a circle on TBitmap32 (x:0,y:0) points.
Pts := Circle(0,0,35);
PolylineFS(Bitmap32, Pts, clBlack32, True, 3);
However, the drawn circle is drawn behind the specified coordinates. Half of the circle is in the minus coordinates of the TBitmap32.
Pts := Circle(35,35,35);
When I try this line of code, the x coordinate is drawn almost to the correct point, but Y point is still not in the correct coordinate.
I want this function to act like TCanvas.Ellipse. I tried a lot of things, but I wasn't successful.
delphi graphics32
I'm using the following code blocks to draw a circle on TBitmap32 (x:0,y:0) points.
Pts := Circle(0,0,35);
PolylineFS(Bitmap32, Pts, clBlack32, True, 3);
However, the drawn circle is drawn behind the specified coordinates. Half of the circle is in the minus coordinates of the TBitmap32.
Pts := Circle(35,35,35);
When I try this line of code, the x coordinate is drawn almost to the correct point, but Y point is still not in the correct coordinate.
I want this function to act like TCanvas.Ellipse. I tried a lot of things, but I wasn't successful.
delphi graphics32
delphi graphics32
edited Jan 3 at 16:59
Tom Brunberg
13.3k62340
13.3k62340
asked Jan 3 at 15:57
yesilcimen.ahmetyesilcimen.ahmet
14
14
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The code performs as designed. The coordinates that you supply are the centre of the circle and the radius.
Naturally if you supply 0 as the centre, then half of the circle will have negative coordinates. Solve your problem by passing the coordinates of the centre of the circle.
I want this function to act like
TCanvas.Ellipse
.
That's not how programming against a third party interface works. The author of the third party library decides on the interface, and you have to follow it. In this case, the author of the library has decreed that you must supply the centre of the circle. You have no choice in this matter. You must follow the interface that has been defined by the library's author.
If you wish to supply coordinates in a different way you need to write an adaptor. You can write your own code that accepts coordinates in the form that you wish to use, and then have that code convert your coordinates into those required for the library.
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
add a comment |
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54025735%2fthe-gr32-vectorutils-circle-method-works-different-from-my-expectation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The code performs as designed. The coordinates that you supply are the centre of the circle and the radius.
Naturally if you supply 0 as the centre, then half of the circle will have negative coordinates. Solve your problem by passing the coordinates of the centre of the circle.
I want this function to act like
TCanvas.Ellipse
.
That's not how programming against a third party interface works. The author of the third party library decides on the interface, and you have to follow it. In this case, the author of the library has decreed that you must supply the centre of the circle. You have no choice in this matter. You must follow the interface that has been defined by the library's author.
If you wish to supply coordinates in a different way you need to write an adaptor. You can write your own code that accepts coordinates in the form that you wish to use, and then have that code convert your coordinates into those required for the library.
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
add a comment |
The code performs as designed. The coordinates that you supply are the centre of the circle and the radius.
Naturally if you supply 0 as the centre, then half of the circle will have negative coordinates. Solve your problem by passing the coordinates of the centre of the circle.
I want this function to act like
TCanvas.Ellipse
.
That's not how programming against a third party interface works. The author of the third party library decides on the interface, and you have to follow it. In this case, the author of the library has decreed that you must supply the centre of the circle. You have no choice in this matter. You must follow the interface that has been defined by the library's author.
If you wish to supply coordinates in a different way you need to write an adaptor. You can write your own code that accepts coordinates in the form that you wish to use, and then have that code convert your coordinates into those required for the library.
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
add a comment |
The code performs as designed. The coordinates that you supply are the centre of the circle and the radius.
Naturally if you supply 0 as the centre, then half of the circle will have negative coordinates. Solve your problem by passing the coordinates of the centre of the circle.
I want this function to act like
TCanvas.Ellipse
.
That's not how programming against a third party interface works. The author of the third party library decides on the interface, and you have to follow it. In this case, the author of the library has decreed that you must supply the centre of the circle. You have no choice in this matter. You must follow the interface that has been defined by the library's author.
If you wish to supply coordinates in a different way you need to write an adaptor. You can write your own code that accepts coordinates in the form that you wish to use, and then have that code convert your coordinates into those required for the library.
The code performs as designed. The coordinates that you supply are the centre of the circle and the radius.
Naturally if you supply 0 as the centre, then half of the circle will have negative coordinates. Solve your problem by passing the coordinates of the centre of the circle.
I want this function to act like
TCanvas.Ellipse
.
That's not how programming against a third party interface works. The author of the third party library decides on the interface, and you have to follow it. In this case, the author of the library has decreed that you must supply the centre of the circle. You have no choice in this matter. You must follow the interface that has been defined by the library's author.
If you wish to supply coordinates in a different way you need to write an adaptor. You can write your own code that accepts coordinates in the form that you wish to use, and then have that code convert your coordinates into those required for the library.
answered Jan 3 at 16:05
David HeffernanDavid Heffernan
522k348361226
522k348361226
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
add a comment |
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
The result seemed wrong because of a window problem. x = 35, y = 35 correct. Thank you.
– yesilcimen.ahmet
Jan 3 at 16:29
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54025735%2fthe-gr32-vectorutils-circle-method-works-different-from-my-expectation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown