Get square out of rectangle without deformation in QML The Next CEO of Stack OverflowC++ compiler error definition of implicitly declaredHow to design a multi-level fluid layout in QMLClosed contour in C++/QtRectangle is not shown in QMLQML Arc inside rectangleqml: Rectangle animation not workingQML - LinearGradient on a Rectangle with Radius?QML: onClicked method on MouseArea of Rectangle is not getting invokedQML Change color of rectangle by textHow to Opacitymask with QQuickFramebufferObject
Is there a reasonable and studied concept of reduction between regular lagnagues?
Is it ever safe to open a suspicious HTML file (e.g. email attachment)?
Axiom Schema vs Axiom
Lucky Feat: How can "more than one creature spend a luck point to influence the outcome of a roll"?
How to penalize for empty fields in a DataFrame?
Can I use the word “Senior” as part of a job title directly in German?
Help/tips for a first time writer?
What is the difference between Statistical Mechanics and Quantum Mechanics
Is the D&D universe the same as the Forgotten Realms universe?
Decide between Polyglossia and Babel for LuaLaTeX in 2019
Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico
Is there a way to save my career from absolute disaster?
What CSS properties can the br tag have?
What steps are necessary to read a Modern SSD in Medieval Europe?
Calculator final project in Python
Traduction de « Life is a roller coaster »
From jafe to El-Guest
Why didn't Khan get resurrected in the Genesis Explosion?
How to avoid supervisors with prejudiced views?
When "be it" is at the beginning of a sentence, what kind of structure do you call it?
Strength of face-nailed connection for stair steps
Yu-Gi-Oh cards in Python 3
Sulfuric acid symmetry point group
Can I add a classname to CSS variable?
Get square out of rectangle without deformation in QML
The Next CEO of Stack OverflowC++ compiler error definition of implicitly declaredHow to design a multi-level fluid layout in QMLClosed contour in C++/QtRectangle is not shown in QMLQML Arc inside rectangleqml: Rectangle animation not workingQML - LinearGradient on a Rectangle with Radius?QML: onClicked method on MouseArea of Rectangle is not getting invokedQML Change color of rectangle by textHow to Opacitymask with QQuickFramebufferObject
I have a small application with Map and I want to make something like the minimap.
Illustration of the problem:
White area (rectangle, not square, it's 1200x800px) represents Map and green area represents crop (square with radius (about 800x800px)), wich I want to get from map.
Whenever I tried to do it, (I tried using ShaderEffectSource and OpacityMask), whole the Map was taken and resized to square, so output was deformed.
I want to take only that part of Map, that is covered by the green area.
Rectangle
id: map
width: 1200
height: 800
color: "white"
Rectangle
id: mask
anchors.centerIn: parent
width: 800
height: 800
radius: width/2
How can I achieve something like that?
Thanks for your help!
EDIT: This is my current code
ShaderEffectSource
visible: true
id: shaderEffect
anchors.centerIn: parent
width: parent.height
height: parent.height
sourceItem: map
layer.enabled: true
layer.effect: OpacityMask
maskSource: Rectangle
width: map.height
height: map.height
radius: width/2
//EDIT: Added image
My deformed result
As you can see map is deformed - original size of Map component is resized from 1200x800 to 800x800 (Circle size). My goal is to crop everything that is outside of circle.
qt qml
add a comment |
I have a small application with Map and I want to make something like the minimap.
Illustration of the problem:
White area (rectangle, not square, it's 1200x800px) represents Map and green area represents crop (square with radius (about 800x800px)), wich I want to get from map.
Whenever I tried to do it, (I tried using ShaderEffectSource and OpacityMask), whole the Map was taken and resized to square, so output was deformed.
I want to take only that part of Map, that is covered by the green area.
Rectangle
id: map
width: 1200
height: 800
color: "white"
Rectangle
id: mask
anchors.centerIn: parent
width: 800
height: 800
radius: width/2
How can I achieve something like that?
Thanks for your help!
EDIT: This is my current code
ShaderEffectSource
visible: true
id: shaderEffect
anchors.centerIn: parent
width: parent.height
height: parent.height
sourceItem: map
layer.enabled: true
layer.effect: OpacityMask
maskSource: Rectangle
width: map.height
height: map.height
radius: width/2
//EDIT: Added image
My deformed result
As you can see map is deformed - original size of Map component is resized from 1200x800 to 800x800 (Circle size). My goal is to crop everything that is outside of circle.
qt qml
Do you want to get a green circle? if so, you just have to set a radius:Rectangle id: mask anchors.centerIn: parent width: 800 height: 800 radius: 400 color: "green"
– eyllanesc
Mar 8 at 17:58
1
It's not clear what do you want to do. Cut circle from the map? Mask the area outside the circle? You have to clarify the question.
– folibis
Mar 9 at 15:17
I want to cut circle from map (wich Is 1200x800). Circle should be center of map (800x800). My output Is circle cut out of that map, but it's width of map (1200) shrinked to width of that circle (800), thus it's deformated. I want to cut circle out of that map, but I want to crop everything that Is outside of that circle and show only that part of map, that Is under circle.
– Brykyz
Mar 11 at 8:37
Maybe trymaskSource: mask
– augre
Mar 11 at 11:20
@augre I tried, result is what you see on last picture (deformed)
– Brykyz
Mar 11 at 11:47
add a comment |
I have a small application with Map and I want to make something like the minimap.
Illustration of the problem:
White area (rectangle, not square, it's 1200x800px) represents Map and green area represents crop (square with radius (about 800x800px)), wich I want to get from map.
Whenever I tried to do it, (I tried using ShaderEffectSource and OpacityMask), whole the Map was taken and resized to square, so output was deformed.
I want to take only that part of Map, that is covered by the green area.
Rectangle
id: map
width: 1200
height: 800
color: "white"
Rectangle
id: mask
anchors.centerIn: parent
width: 800
height: 800
radius: width/2
How can I achieve something like that?
Thanks for your help!
EDIT: This is my current code
ShaderEffectSource
visible: true
id: shaderEffect
anchors.centerIn: parent
width: parent.height
height: parent.height
sourceItem: map
layer.enabled: true
layer.effect: OpacityMask
maskSource: Rectangle
width: map.height
height: map.height
radius: width/2
//EDIT: Added image
My deformed result
As you can see map is deformed - original size of Map component is resized from 1200x800 to 800x800 (Circle size). My goal is to crop everything that is outside of circle.
qt qml
I have a small application with Map and I want to make something like the minimap.
Illustration of the problem:
White area (rectangle, not square, it's 1200x800px) represents Map and green area represents crop (square with radius (about 800x800px)), wich I want to get from map.
Whenever I tried to do it, (I tried using ShaderEffectSource and OpacityMask), whole the Map was taken and resized to square, so output was deformed.
I want to take only that part of Map, that is covered by the green area.
Rectangle
id: map
width: 1200
height: 800
color: "white"
Rectangle
id: mask
anchors.centerIn: parent
width: 800
height: 800
radius: width/2
How can I achieve something like that?
Thanks for your help!
EDIT: This is my current code
ShaderEffectSource
visible: true
id: shaderEffect
anchors.centerIn: parent
width: parent.height
height: parent.height
sourceItem: map
layer.enabled: true
layer.effect: OpacityMask
maskSource: Rectangle
width: map.height
height: map.height
radius: width/2
//EDIT: Added image
My deformed result
As you can see map is deformed - original size of Map component is resized from 1200x800 to 800x800 (Circle size). My goal is to crop everything that is outside of circle.
qt qml
qt qml
edited Mar 11 at 11:06
Brykyz
asked Mar 8 at 16:53
BrykyzBrykyz
10611
10611
Do you want to get a green circle? if so, you just have to set a radius:Rectangle id: mask anchors.centerIn: parent width: 800 height: 800 radius: 400 color: "green"
– eyllanesc
Mar 8 at 17:58
1
It's not clear what do you want to do. Cut circle from the map? Mask the area outside the circle? You have to clarify the question.
– folibis
Mar 9 at 15:17
I want to cut circle from map (wich Is 1200x800). Circle should be center of map (800x800). My output Is circle cut out of that map, but it's width of map (1200) shrinked to width of that circle (800), thus it's deformated. I want to cut circle out of that map, but I want to crop everything that Is outside of that circle and show only that part of map, that Is under circle.
– Brykyz
Mar 11 at 8:37
Maybe trymaskSource: mask
– augre
Mar 11 at 11:20
@augre I tried, result is what you see on last picture (deformed)
– Brykyz
Mar 11 at 11:47
add a comment |
Do you want to get a green circle? if so, you just have to set a radius:Rectangle id: mask anchors.centerIn: parent width: 800 height: 800 radius: 400 color: "green"
– eyllanesc
Mar 8 at 17:58
1
It's not clear what do you want to do. Cut circle from the map? Mask the area outside the circle? You have to clarify the question.
– folibis
Mar 9 at 15:17
I want to cut circle from map (wich Is 1200x800). Circle should be center of map (800x800). My output Is circle cut out of that map, but it's width of map (1200) shrinked to width of that circle (800), thus it's deformated. I want to cut circle out of that map, but I want to crop everything that Is outside of that circle and show only that part of map, that Is under circle.
– Brykyz
Mar 11 at 8:37
Maybe trymaskSource: mask
– augre
Mar 11 at 11:20
@augre I tried, result is what you see on last picture (deformed)
– Brykyz
Mar 11 at 11:47
Do you want to get a green circle? if so, you just have to set a radius:
Rectangle id: mask anchors.centerIn: parent width: 800 height: 800 radius: 400 color: "green" – eyllanesc
Mar 8 at 17:58
Do you want to get a green circle? if so, you just have to set a radius:
Rectangle id: mask anchors.centerIn: parent width: 800 height: 800 radius: 400 color: "green" – eyllanesc
Mar 8 at 17:58
1
1
It's not clear what do you want to do. Cut circle from the map? Mask the area outside the circle? You have to clarify the question.
– folibis
Mar 9 at 15:17
It's not clear what do you want to do. Cut circle from the map? Mask the area outside the circle? You have to clarify the question.
– folibis
Mar 9 at 15:17
I want to cut circle from map (wich Is 1200x800). Circle should be center of map (800x800). My output Is circle cut out of that map, but it's width of map (1200) shrinked to width of that circle (800), thus it's deformated. I want to cut circle out of that map, but I want to crop everything that Is outside of that circle and show only that part of map, that Is under circle.
– Brykyz
Mar 11 at 8:37
I want to cut circle from map (wich Is 1200x800). Circle should be center of map (800x800). My output Is circle cut out of that map, but it's width of map (1200) shrinked to width of that circle (800), thus it's deformated. I want to cut circle out of that map, but I want to crop everything that Is outside of that circle and show only that part of map, that Is under circle.
– Brykyz
Mar 11 at 8:37
Maybe try
maskSource: mask– augre
Mar 11 at 11:20
Maybe try
maskSource: mask– augre
Mar 11 at 11:20
@augre I tried, result is what you see on last picture (deformed)
– Brykyz
Mar 11 at 11:47
@augre I tried, result is what you see on last picture (deformed)
– Brykyz
Mar 11 at 11:47
add a comment |
0
active
oldest
votes
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%2f55067617%2fget-square-out-of-rectangle-without-deformation-in-qml%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f55067617%2fget-square-out-of-rectangle-without-deformation-in-qml%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

Do you want to get a green circle? if so, you just have to set a radius:
Rectangle id: mask anchors.centerIn: parent width: 800 height: 800 radius: 400 color: "green"– eyllanesc
Mar 8 at 17:58
1
It's not clear what do you want to do. Cut circle from the map? Mask the area outside the circle? You have to clarify the question.
– folibis
Mar 9 at 15:17
I want to cut circle from map (wich Is 1200x800). Circle should be center of map (800x800). My output Is circle cut out of that map, but it's width of map (1200) shrinked to width of that circle (800), thus it's deformated. I want to cut circle out of that map, but I want to crop everything that Is outside of that circle and show only that part of map, that Is under circle.
– Brykyz
Mar 11 at 8:37
Maybe try
maskSource: mask– augre
Mar 11 at 11:20
@augre I tried, result is what you see on last picture (deformed)
– Brykyz
Mar 11 at 11:47