Just getting into Inkscape. When I use the pencil or "Draw Bezier lines.." buttons, I follow the instructions in the manual to get the intended effect to get a horizontal or vertical line.
Except, I cannot see the line itself. In the examples the line shows up, but after I stop highlighting it, it goes away completely. The other lines turn out fine. Below is a picture of my screen.
image
My opacity, and alpha are correct for the line segment (as you can see from the screenshot), so I was wondering what I'm doing wrong here.
Thanks!
Try setting a stroke instead of a fill. And make sure you are in a visible layer.
Related
Using wxWidgets wxStyledTextCtrl I cannot find a way of having the color behind the text to be anything but white. I can change the editor's background but typing in text results in black text with a white background behind the characters.
Searches and review of Scintilla's and wxWidgets docs has revealed nothing to me yet. Any suggestions? (C++, Linux Mint)
update #1: After poking around in the wxWidget source, as a test, I modified in PlatWX.cpp the SurfaceImpl::DrawTextTransparent. I added a call to set brush colour and changed hdc->SetBackgroundMode( wxBRUSHSTYLE_TRANSPARENT ) to wxBRUSHSTYLE_SOLID.
These seems to work reasonably well. However, there are added problems with whitespace. The first being the settings for white space coloring seem to be ignored. The second is a carriage return always leaves a white blank space and multiple spaces having a growing white bow (as on a ship) when holding the spacebar down.
I am new to C++,Qt and Visual Studio and this is my first post on Stack Overflow.
I apologize in advance if this is a repeated question, I tried searching for a similar question but couldn't find one. Let me know if this is a repeated question and I will delete it.
I am trying to create a line plot using QWidget::paintEvent(). The line plot I am drawing is actually a QPainterPath. I want to detect when the mouse hovers over my line plot and so I create a small rectangle where my mouse cursor is and detect when this rectangle intersects with my line plot using bool QPainterPath::intersects() function. The problem is that this function returns true even when my mouse is not exactly over my line plot. In the Image 1 (I am not allowed to embed images yet) my line plot is the thick black curve and the bool QPainterPath::intersects() returns true even when my cursor is over the yellow region. As per the Qt document this is because:
There is an intersection if any of the lines making up the rectangle crosses a part of the path or if any part of the rectangle overlaps with any area enclosed by the path.
There is no way to have a QPainterPath without any enclosed area as Qt only provides two types of fill for QPainterPath: Qt::OddEvenFill or Qt::WindingFill. (To be honest, I find this kind of annoying, since an open path is a series of line segments connected end-to-end, if someone wants to enclose an area they can easily connect the first and last point using either QPainterPath::lineTo() or QPainterPath::moveTo() functions)
Anyway, I decided to get smarter than Qt and drew two extra QPainterPath with pathUp being a few pixels above my line plot and pathDn being a few pixels below my line plot. Image 2 shows these 3 line plots, red one is pathUp, black one is real line plot and green one is pathDn. I thought I coould detect the intersection in the QWidget::mouseMoveEvent() by using the following code:
// cRect: Rectangle at mouse cursor position
if((pathUp.intersects(cRect) && (!pathDn.intersects(cRect))) || ((!pathUp.intersects(cRect)) && pathDn.intersects(cRect)))
{
qDebug() << "Intersects";
}
But this still produces wrong results because now the enclosed area is different, as you can see in Image 3 the green area is an enclosed area of pathDn and red area is the enclosed area of pathUp. The thick black curve is again the line plot that I want to detect my mouse hover on. This enclosed area is not affected by Qt::setFillRule of QPainterPath.
What's even more frustrating is that I tried this technique using QPolygonF instead of QPainterPath on QWidget and the results were exactly the same. I also tried QGraphicsView, there I used QGraphicsPathItem to create my line plot and then used QGraphicsScene::focusItemChanged() signal to detect when I click on my line plot. It again produced the same result of detecting the click when my cursor is over the enclosed area. I do not want to create a custom QGraphicsItem (unless I absolutely have to) just to reimplement it's hoverEnterEvent() and hoverLeaveEvent() method because of the limitations imposed on the boundingRect() of the QGraphicsItem as explained in Qt Docs:
QGraphicsScene expects all items boundingRect() and shape() to remain unchanged unless it is notified. If you want to change an item's geometry in any way, you must first call prepareGeometryChange() to allow QGraphicsScene to update its bookkeeping.
Since I making a plot in real-time the boundingRect() will change quite frequently (> 20 Hz), which will result in an extra computational burden on the software. Is there any way I can solve my problem without creating a custom QGraphicsItem?
P.S. I have been using Stack Overflow for many years whenever I got stuck. I just never made an account here because I never needed to post anything. You guys are the best and I am very happy to be a part of this community!
I often use a TPanel or TGroupBox to group my form controls.
Now I need to draw just a straight line like the border of a Panel or GroupBox.
How do I do this on LAZARUS?
Thanks in advance!
Note: The technique must work on both Linux and Windows
As an optical line separator you should use either the TBevel component with Shape property set to one of the following values bsTopLine, bsBottomLine, bsLeftLine or bsRightLine depending on which line you currently need and resize it to a smaller size (in your case you can use bsTopLine or bsBottomLine and resize the bevel vertically):
Or you can use a special component called TDividerBevel which except the single line adds to this optical divider also a caption:
Here's what I've finally done but I'm not sure if this is the RIGHT way so I won't accept my answer. If there's someone else who can point out any issues with this, please let me know. I found this pretty straightforward as well :)
Place a TGroupBox on the form.
Leave the Caption property blank. Now it should look like a panel with only borders.
Use the mouse and drag the bottom border towards the top. Now it looks like a line.
Well, I personally think this method is NOT efficient as it would take up more memory space than just a real straight line. Anyway, so far it seems to work for me :)
Here's the screenshot - look towards the bottom (just above the last text box). The only issues is that on the sides of the line, it shows the lines bending. I think I should set the properties correctly than dragging with the mouse.
i have been using cleardevice() to clear the graphics ... but it creates several problems
for eg .. i create a background but i have to clear some specific elements , then i have to use another user defined function drawb() which draws the background and simultaneously cleardevice();
creating a lot of problems
line(x,y,x1,y1); //suppose this line is to be erased
//but using cleardevice even clears the background
cleardevice();
drawb(); //to draw board or background
so i want to know an alternative approach(an approach to clear only the line not the background) (if it exists )
Once a line is drawn, there is no real way to remove it (except if you are drawing using XOR mode!). However, there are some thing you could do. You could render everything but the line in a page and store it there. Then, in another page you render everything, including the line. So if you want to undo the line, you just switch the page back.
An example:
setactivepage(0);
// draw stuff, including background
setactivepage(1);
// draw stuff, including background and line
setvisualpage(0); // no line visible
setvisualpage(1); // line visible
Also, if you want to reset the screen with a background, there is no need to do a cleardevice(), since the drawb() overwrites every pixel ayway.
You can first take the image before drawing the line by getimage()
and put that image on the line whenever you want to hide your image
This will not change your background and not flick it. putimage() can put the image.
I need to use CCTransitionPageTurn in my app between scenes.
When i run this transition, my running scene looks nice - it turns like page.
but at the background i see black screen(during page turn animation), that is replaced later by new scene.
And i want to see new scene in the background(during animation), when i start this transition.
Can anybody help me?
Oh, i found out the answer.
All works as it should, after i commented out this line
//director.projection = kCCDirectorProjection2D;
also i turned on depth buffer and changed depthformat.