Inkscape creates pixelated images whenever I copy and paste - inkscape

Whenever I copy and paste something in Inkscape the result is a pixelated image and not the original object. For example a copied and pasted rectangle cannot be edited as a rectangle anymore and gets blurry if I zoom in.
I am working on OSX 10.10.1 and X11 2.7.7.

This has to do with the clipboard and pasteboard syncing of OSX and X11. As pointed out in the Inkscape FAQ you can prevent this by unchecking X11 preferences > Pasteboard: "Update Pasteboard when CLIPBOARD changes". Downside is that you cannot copy anything from Inkscape to other OSX programs anymore. From OSX to X11 should still be possible.
If you use duplicate instead of copy and paste the problem doesn't appear in the first place, so you can keep the pasteboard syncing.

Duplicate and then what? Duplicate and Paste just creates a raster copy of the vector object. However, after many trials and errors, I found that Duplicate and then Paste In Place results in a vector-to-vector copy.

Use Ctrl+D
Pressing Ctrl+C and Ctrl+V to copy and paste will create a bitmap image for the copy. To create a vector copy, you can make a selection and then press Ctrl+D. The D is for Duplicate.

Related

Contextmenu and Picturebox c++

I created a program like Paint and ran into this problem: I have a PictureBox where I can draw, but I want to be able to copy and paste part of the image from my PictureBox. Created Contextmenu, but I can not properly describe the copy and paste commands. I work in C ++ and want to know if it is possible to do such an action?
If possible, give an example of a simple copy and paste image code.

QApplication::processEvents not working in Windows

I am working on a project that presents live data acquired in real-time using the QCustomPlot plug-in for Qt. The display has a black background color, and the multiple channels of data are colored differently. When taking a screenshot, we would like to make it printer-friendly, so the background is white and all data is black. I am thinking of a solution like this:
Change all colors the way I want by manipulating the pointers for the graphical objects
Grab the screenshot using QWidget::grab() to get a QPixmap
Change all the colors back to normal
This did not work at first, because the system could not change the colors in time for the screenshot to be taken. So I used a QApplication::processEvents(), and it all worked on my Mac.
However, it does not work on a Windows 7 (which is required). Any ideas what to do?
Code:
QSting fileLocation = "...";
toggleColors(false); //function to toggle the colors
QApplication::processEvents();
QPixmap shot = grab();
toggleColors(true);
shot.save(fileLocation, "png");
Again. It works on Mac, but not Windows.
Update 1. Content of toggleColors include:
if(enable)
ui->plot->setBackground(QBrush(Qt::black));
else
ui->plot->setBackground(QBrush(Qt::white));
ui->plot->repaint();
I also tried with ui->plot->update() instead.
I am not sure what is the problem on Windows specifically, but I recommend you calling QWidget::update() on the given widget. That forces the next update to re-render itself.
On the other hand, I'm not sure why toggleColors() didn't somehow cause that to happen.
Also, ensure that QWidget::setUpdatesEnabled(bool) wasn't set to "false."
It appears the problem lies with QCustomPlot. It was solved by performing a ui->plot->replot() which is specific to QCustomPlot and not QWidget.

cimg multiple window placement

I'm using CImgDisplay to show a couple of images onscreen. My problem is that they're opening on top of the Command Prompt window and each other. Is there a way to make them open at a different location? I've looked through the CImg documentation and can't find anything.
CImgDisplay::move() will probably help you, as it can move a window to a specific position.
If necessary, you can create an initially hidden windows, move it, then show it afterwards, using CImgDisplay::show().

Screen capture of MDI app with OpenGL graphics using MFC

In our MDI application - which is written in MFC - we have a function to save a screenshot of the MDI client area to file. We are currently doing a BitBlt from the screen into a bitmap, which is then saved. The problem is that some of the MDI child windows have their content rendered by OpenGL, and in the destination bitmap these areas show up as blank or garbled.
I have considered some alternatives:
- Extract the OpenGL content directly (using glReadPixels), and draw this to the relevant portions of the screen bitmap.
- Simulate an ALT+PrtScr, since doing this manually seems to get the content just fine. This will trash the clipboard content, though.
- Try working with the DWM. Appart from Vista and Win7, this also needs to work on Win2000 and XP, so this probably isn't the way to go.
Any input will be appreciated!
The best way to get a bitmap from an OpenGL window is to draw the content to a bitmap 'window'. See PFD_DRAW_TO_BITMAP for more information on how to do this.
If you want to go with the Alt+PrtScr way, you have to consider that many users have their own print screen tool installed which reacts on that very same hotkey. So you can't be sure that this hotkey will copy the content to the clipboard. It may just open the window of the installed print screen tool/utility.
Use the glReadPixels() approach. This question is asked quite often, here, on the gamedev.net forums and on other places, so google should show you code samples easily, but the glReadPixels() approach is the generally recommended approach.
Simulating keypresses is a recipe for disaster, I would stay away from that.

Black flicker while resizing translucent Qt widget (only when Aero is enabled)?

I have a top-level Qt widget with the FramelessWindowHint flag and the WA_TranslucentBackground attribute set. It has several children, each of which draws an image on it. They are not in a layout. Instead, I simply move them around when something changes (it is not user-resizable).
There are two states to the window - a big state and a small state. When I switch between them, I resize the window and reposition the children. The problem is that as the window resizes, a black box is briefly flashed on the top-level window before the images are painted over it.
The problem goes away if I disable Aero. I found brief mention of this problem being fixed in an article describing a new release of Qt (this release is long past), but it still doesn't work.
Any ideas why?
Thanks!
I don't have experience with Qt specifically, but I have worked with other windowing toolkits. Typically you see this kind of flashing when you are drawing updates directly to the screen. The fix is to instead use Double buffering, which basically means that you render your updates into an offscreen buffer (a bitmap of some sort, in the purest sense of the word), and then copy the entire updated image to screen in a single, fast operation.
The reason you only see the flickering sometimes is simply an artifact of how quickly your screen refreshes versus how quickly the updates are drawn. If you get "lucky" then all the updates occur between screen refreshes and you may not see any flicker.