Jagged edge Image on rotating with Evas map - image

I am making a watch application for Samsung Gear S2 with EFL Native application.
Problem was happened when I rotate hands of the watch.
Look at following image.
This is normal image I paste it to evas_object and it's not rotated yet.
After I rotate it, the edge of hands has changed to jagged shape like it.
Resolution of gear s2 is 360px X 360px so I make every image is fit to this size.
And I rotate image with following code.
Evas_Map *m = NULL;
m = evas_map_new(4);
//evas_map_smooth_set(m, true);
evas_map_util_points_populate_from_object(m, obj);
evas_map_util_rotate(m, degree, cx, cy);
evas_object_map_set(obj, m);
evas_object_map_enable_set(obj, EINA_TRUE);
evas_map_free(m);
I was try fix it with evas_map_smooth_set() function.
EFL document is written to this setting makes image to "SMOOTH"
and default setting is "true". but I worried tizen change it to "false".
But jagged shape is still showing Despite after I set true or false.
The Watchface that created by "Gear Watch Designer" has not jagged image on rotating there hands.
How I can rotate Image without jagged edge?

OK finally I found why jagged edge is appear on rotating.
In the emulator or my gear s2, default EFL rendering engine is not opengl backend.
So I can fix it with following codes.
elm_config_accel_preference_set("opengl");
Write this code before create window (elm_win_add) it will make anti-aliased image on rotating image.

Sorry for the very late answer, but I believe you can fix this issue in two ways:
Call evas_object_anti_alias_set() on the evas object that is mapped.
As you've mentionned in another answer, use GL acceleration but you may even want to enable MSAA on the backbuffer: elm_config_accel_preference_set("opengl:msaa");

Related

How to fix Blue Screen appearing after GameObject is removed in Unity 2d Project

I have been successfully building and running a Unity 2D game, but started receiving a Blue Screen during one of my operations. Specifically, when I close a popup and remove all of its child Game Objects, the entire Game Screen turns dark blue (the default background color of the main camera). The music for the game still plays and clicks are still registered if you click in the right area (I can still press the back button, just can't see it).
If I remove 1 gameobject, this problem doesn't come up. But once I have to remove 2 game objects, the entire screen turns blue.
This is my function for removing my game object in case it helps, which works perfectly when it comes to actually removing the gameObjects correctly (game objects to be removed are created from prefabs). I think the problem may be with the camera for some reason, but I have no clue as to why it happens on this function.
public void Remove(int index)
{
float toggleWidth = toggle.GetComponent<RectTransform>().sizeDelta.x;
DestroyImmediate(scrollSnap.pagination.transform.GetChild(scrollSnap.NumberOfPanels - 1).gameObject);
scrollSnap.Remove(index);
scrollSnap.pagination.transform.position += new Vector3(toggleWidth / 2f, 0, 0);
}
I don't receive any errors or warnings in the console. Just a blue screen once more than one GameObject is removed
EDIT:
Turns out my main Canvas's planeDistance was being changed from 100 to 3200. I still have no clue as to why this change occurred...but for anyone else having a similar issue with a dark blue screen appearing in the middle or start of their game, then please check the values your canvas and camera in the Inspector. Simply controlling the planeDistance did the trick for me!
Made a new scene next to the sample scene when i started my sprite learning game. Forgot all about that.
When I had to publish it, In the Build Settings, I had the wrong scene selected. So It published an empty scene instead of my game.
I solved it by putting game in 3d mode and realized that the camera is positioned very far from the sprites, just change the z-axis and again go to 2d mode.
Just Move your camera in Z-axis position, it could be too far from object or it is behind the object, you can also check it by 3D mode the check the object position and change it in positive and negative values.

Mask UI Image/RawImage

I recently encountered a problem with UI. I opened a new 2D project and created a canvas with a GameObject with a Image component. I then added a sprite by right-clicking Assets > Create > Sprites > Circle. This added a circle sprite to my Assets folder.
The problem is when I choose the Source Image for the Image component as the circle, it still displays as a rectangle.
The circle sprite is imported as Sprite for Texture Type.
This problem also happens with the other shapes, such as triangle.
I am using Unity 5.6.0b9 Personal. Build target is PC, Mac, Linux Standalone.
I am probably missing something very simple. Any help is appreciated!
It doesn't work like that. Circle and all other type of Sprites under the Assets > Create > Sprites Menu are only made to work with SpriteRenderers. This would have worked if you used SpriteRenderer from GameObject--> 2D Object--> Sprite. They do not work with the UI.
For the UI, this has to be done with the Mask component. Just get any round image then use it to cut out circle from your target square image.
Create a UI Image called "TargetSquare" which is the image you want to round.
Duplicate it then name this "MaskCircle" and then resize it to make it smaller than the "TargetSquare" until that circle shape is what you want.
Make the "MaskCircle" object to be the parent of the "TargetSquare" object then use this round Sprite I made as it's source image.
Attach the Mask component to the "MaskCircle" object.
Done. Your "TargetSquare" object will have the shape of the "MaskCircle" object.
If you get jagged edges, select the sprite you used for the "MaskCircle" image and then make sure that Mipmap is disabled.
Maybe it is bug, in unity 5.6.1f1 same story.
Just try to download new version unity 5.6.2f. I dont know, that bug is fixed or not.
Or
Use some image editor, for example photoshop.
P.S. My fail, all ok, it works on SpriteRenderer component. Unity generates white square, and in this sprite properties setting Sprite Mode to Polygon and creates some shape using vertices.

wxToolBar changing device coordinates

Using the mouse I am drawing 2D shapes on the client area of a MDIChildFrame. Recently I have added a wxToolBar to the frame and when I now draw a shape on the client area it seems that the points have shifted by the size the toolbar. Imagine that with mouse I am clicking on (100,100) and drawing a line to (150,150); however, the line appears somewhere (75,75) to (125,125). By the way, wxMouseEvent GetPosition(); reports (100,100) to me.
Removing the toolbar fixes the problem however, I want to keep the toolbar for ease of tool selection.
I use the code:
m_ToolBar=new wxToolBar(this, wxID_ANY);
m_ToolBar->AddTool() //
m_ToolBar->Realize();
this->SetToolBar(m_ToolBar);
Any ideas will be appreciated.
You can always use wxWindow::GetClientAreaOrigin() to manually offset the coordinates by the toolbar height but normally this shouldn't be necessary, and if this doesn't happen with a "normal" frame but only happens with wxMDIChildFrame it would be a bug in wxWidgets that should be reported as usual.
It's also recommended to not draw over wxFrame itself but rather put a wxWindow into it and draw on it. This should also take care of your problem.

QGraphicsView / QGraphicsScene image size

I want to display an image in a QGraphicsView with a QGraphicsScene. My code is very basic :
QGraphicsScene* scene = new QGraphicsScene(this);
scene->addPixmap(QPixmap(qApp->applicationDirPath() +"/france.gif"));
ui->myGraphicsView->setScene(scene);
ui->myGraphicsView->fitInView(scene->sceneRect());
My problem is that my picture has a wrong size. It is very small, with wrong proportions and on the center of my GraphicsView. With qDebug i kwow that my picture is load successfully and it has a size of about 100x800px. My graphicsView is smaller so i want to resize my picture to adjust it with my GraphicsView size.
The graphicsView is set in the mainwindow Form and the scene is declared in the header : "QGraphicsScene scene;"
I try everything is possible in the world (i think) but the graphicsView is alaways blank or contains the small version of the picture. When I copy/paste some codes of internet i always get this problem. I also try with this example : Qt GUI Development - Displaying a 2D grid using QGraphicsView , same problem...
Maybe i'm very very very tired but i really don't understand what is wrong. Help me please :)
sceneRect() may not be what you think it is unless you specifically set it. Also you are missing aspectRatioMode in fitInview call which can distort it image, sometimes resulting in "small" appearance.
QGraphicsScene* scene = new QGraphicsScene(this);
QGraphicsPixmapItem p = scene->addPixmap(QPixmap(qApp->applicationDirPath() +"/france.gif"));
ui->myGraphicsView->setScene(scene);
ui->myGraphicsView->fitInView(p, Qt::KeepAspectRatio);
From my experience, a shown image is very small if we try to fitInView before the scene window is displayed. Technically, the sceneRect size is not set in the way we want until it is actually shown. Therefore, we need to let the scene window shows up before we can properly use fitInView.
Well, I think the solution is available here
Qt5 C++ QGraphicsView: Images don't fit view frame

WP7 XNA + SilverLight + Touch = Wrong Coordinates?

I'm using the mixed XNA/SL programming model where the Silverlight content is rendered by UIElementRenderer. However, it appears that there is a 40 pixel offset between the screen coordinates reported by touch (GestureSample) and the actual coordinates where the contents of the page are rendering.
It appears to be space reserved for the SystemTray in Silverlight apps.
My question is: is there an API I can call to dynamically return this offset so I don't have to hard-code it?
Thanks!
I don't actually think there is any such offset. Since the GestureSample has accurate screen coordinates, your problem is probably with drawing the silverlight UI. Make sure that you don't have any view/projection transforms active on your SpriteBatch when you draw the uiRenderer texture.
If you were using a transform to draw your game scene, you might just want to end that SpriteBatch and start up a new one for screen UI.

Resources