image-rotation

Rotating Image with AffineTransform

只愿长相守 提交于 2019-11-26 12:32:36
I have got class called Airplane . Inside this class i have got variable img which is a BufferedImage type. What is more i have got class WorldMap which overrides function paintComponent(Graphics g) : @Override public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(mapa, 0, 0, getWidth(), getHeight(), null); drawAirplanes(g2d); } Function drawAirplanes() look like this: private void drawAirplane(Graphics2D g){ for(Samolot i: s){ i.rotateAirplane(); g.drawImage(i.getImg(),i.getX(),i.getY(),(int)i.getDim().getWidth(),(int)i.getDim().getHeight(), null); } } It

Rotating a bitmap using JNI & NDK

不想你离开。 提交于 2019-11-26 12:17:23
问题 Background: I\'ve decided that since bitmaps take a lot of memory which can cause out-of-memory errors easily, I will put the hard, memory consuming work on C/C++ code . The steps I use for rotating a bitmap are: read bitmap info (width,height) store bitmap pixels into an array. recycle the bitmap. create a new bitmap of opposite size. put the pixels into the new bitmap. free the pixels and return the bitmap. The problem: Even though everything seems to run without any errors, the output

AffineTransform.rotate() - how do I xlate, rotate, and scale at the same time?

吃可爱长大的小学妹 提交于 2019-11-26 11:39:47
问题 I have the following code which does (the first part of) what I want drawing a chessboard with some pieces on it. Image pieceImage = getImage(currentPiece); int pieceHeight = pieceImage.getHeight(null); double scale = (double)side/(double)pieceHeight; AffineTransform transform = new AffineTransform(); transform.setToTranslation(xPos, yPos); transform.scale(scale, scale); realGraphics.drawImage(pieceImage, transform, this); that is, it gets a chess piece\'s image and the image\'s height, it

Java 2d rotation in direction mouse point

偶尔善良 提交于 2019-11-26 08:28:30
问题 So far I have a java app where I draw a circle(player) and then draw a green rectangle on top(gun barrel). I have it so when the player moves, the barrel follows with it. I want it to find where the mouse is pointing and then rotate the barrel accordingly. For an example of what I mean look at this video I found http://www.youtube.com/watch?v=8W7WSkQq5SU See how the player image reacts when he moves the mouse around? Here\'s an image of what the game looks like so far: So how do I rotate it

How to rotate the background image in the container?

你离开我真会死。 提交于 2019-11-26 07:18:11
问题 I want to rotate the image which is placed in the button of scrollbar in Chrome. Now I have a CSS with this content: ::-webkit-scrollbar-button:vertical:decrement { background-image:url(images/arrowup.png) ; -webkit-transform:rotate(120deg); -moz-transform:rotate(120deg); background-repeat:no-repeat; background-position:center; background-color:#ECEEEF; border-color:#999; } I wish to rotate the image without rotating its content. 回答1: Very well done and answered here - http://www.sitepoint

Android: How to rotate a bitmap on a center point

让人想犯罪 __ 提交于 2019-11-26 04:06:39
问题 I\'ve been looking for over a day for a solution to this problem but nothing helps, even the answers here. Documentation doesn\'t explain anything too. I am simply trying to get a rotation in the direction of another object. The problem is that the bitmap is not rotated around a fixed point, but rather around the bitmaps (0,0). Here is the code I am having troubles with: Matrix mtx = new Matrix(); mtx.reset(); mtx.preTranslate(-centerX, -centerY); mtx.setRotate((float)direction, -centerX,