graphics

Canvas not drawing to JFrame

帅比萌擦擦* 提交于 2019-12-24 12:09:27
问题 I've been looking around for an answer to this, re-written my code multiple times, still nothing. Essentially I am trying to draw to a JFrame containing just a simple rectangle, yet each time nothing shows in the Frame - its just blank. package com.Graphics; import java.awt.*; import java.awt.image.*; import javax.swing.*; public class GraphicsMain { public static void main(String[] args) { GraphicsMain myGraphics = new GraphicsMain(); myGraphics.createDisplay(); } void createDisplay(){ int

Android - Accessing buttons from SurfaceView

女生的网名这么多〃 提交于 2019-12-24 12:04:10
问题 I am currently working on a simple 2d tower defense game to learn some of the basics of Android game development. To handle my graphics I have a custom object that extends SurfaceView and all of my drawing takes place on the SurfaceView's canvas object. This is all working fine. I'd like my game to have two stages. The "combat" stage and the "building stage". In the building stage, I'm trying to add a button that can be clicked to begin the next combat stage. From my research, it sounds like

The Page Turn Effect in Java Swing/AWT

て烟熏妆下的殇ゞ 提交于 2019-12-24 12:00:28
问题 I would like to implement the page turn effect in Swing/AWT. The theory is pretty much explained here. My question is that since the page is to contain text, which is the correct swing/awt component to use? Also, to get a little deeper, how should I approach this problem? I mean I have the theory laid out before me, I know the tool I need to use, but I have never done anything like this with Swing/AWT, do I need to master all the minutiae of Swing/AWT to be able to do this? 回答1: Whatever you

getting pixel position with zoom in matlab

六月ゝ 毕业季﹏ 提交于 2019-12-24 11:40:16
问题 I have some 2D points on my image/figure. I use this function im_data= rand(100,2); scatter(im_data(:,1),im_data(:,2),'r*') [x,y,button] = ginput() im_data(x,y)=[]; I want to delete [x,y] by simply zooming in / magnifying to avoid deleting correct points. Any help? 回答1: You can use a combination of data brushing and data linking to interactively mark points and remove them from you scatter plot. Example: %# random data x = rand(100,1); y = rand(100,1); %# scatter plot hFig = figure; scatter(x

C# Draw image implemention

梦想与她 提交于 2019-12-24 11:35:22
问题 Im trying to make kind of Grahpics.DrawImage implemention using unsafe code and pointers of course. In this case im trying to draw a small bitmap on a bigger width(both 32bppArgb). This is my code private static unsafe void Draw(Bitmap bmp, Bitmap bmp2, int xPoint, int yPoint) { BitmapData bmData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, bmp.PixelFormat); BitmapData bmData2 = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2

Transforming normals from worldspace to the viewspace

跟風遠走 提交于 2019-12-24 11:33:03
问题 Let's say I have my normals in worldspace and I want to transform them into viewspace. What should I do? I have already tried to multiply them by viewProjection matrix and by inversed transformed view matrix, but both didn't work. Blue channel (z axis) appears to be missing. I am confused. 回答1: on fixed pipeline do nothing it does the work for you to work properly all world/object transforms should be inside modelview matrix else some advanced things like FOG will not work properly (ie GL

keeping same Object size while zooming with same left origin in fabricJS

丶灬走出姿态 提交于 2019-12-24 11:18:05
问题 I've seen this post and tried to do my own function using only the X scaling. fabric.Object.prototype.transform = function (ctx){ var m; if (this.group && !this.group._transformDone) { m = this.calcTransformMatrix(); ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]); return; } else { m = this.calcOwnMatrix(); //code I've wrote if (this.my && this.my.ignoreZoom != undefined && this.my.ignoreZoom){ var scaleX = 1.0 / this.canvas.viewportTransform[0]; ctx.transform(scaleX, 0, 0, 1, m[4] - 0.5, 0

Two column Page layout with header and footer

自古美人都是妖i 提交于 2019-12-24 09:57:54
问题 I am trying to create two column layout with header and footer so that left bar, header and footer remains fixed and horizontal and vertical scroll should appear on main content on auto what i have achieved so for is <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <style type="text/css"> .header{width:100%;} .left_panel{float:left; width:15%; height:500px; overflow:auto;background-color:#99CCFF;} .right_panel{float:left; width:85%; height:500px; overflow

Creating full screen DirectX device causes D3DERR_INVALIDCALL

纵然是瞬间 提交于 2019-12-24 09:39:34
问题 I'm trying to create a DirectX device in full screen (up until this point in time I've been doign windowed), but the device won't get created and I get an invalid call HR fail. This is my code: md3dPP.BackBufferWidth = 1280; md3dPP.BackBufferHeight = 720; md3dPP.BackBufferFormat = D3DFMT_UNKNOWN; md3dPP.BackBufferCount = 1; md3dPP.MultiSampleType = D3DMULTISAMPLE_NONE; md3dPP.MultiSampleQuality = 0; md3dPP.SwapEffect = D3DSWAPEFFECT_DISCARD; md3dPP.hDeviceWindow = mhMainWnd; md3dPP.Windowed =

Set child Image Background when Parent Image is Zoomed

主宰稳场 提交于 2019-12-24 09:31:30
问题 I have an image control in which the image selected can be Zoomed IN and OUT. User can place some controls over the image at run-time. After placing the controls, if user Zoom-IN the image, then the controls are not Zoomed, instead they are moved relative to their position in the image. So the position of the controls remains same on the image, just the image will be Zoomed. After saying all that, the requirement is to export the complete image along with the controls added by user. I have