draw

paint() method would not draw on JPanel

落花浮王杯 提交于 2019-12-04 05:49:13
问题 I tried few source codes of drawing in java and they were working fine, but when i tried to make one of my own I could not get the paint(Grahpics g) method to work! I looked again at the codes I have and checked some of the tutorials in Oracle's pages but i don't seem to be able to know why it would not work. can someone please check it and tell me what is wrong here?? main method: public class main { public static void main(String[] args) { new board(); } } board: import java.awt

Can I draw on a Form, above all controls?

﹥>﹥吖頭↗ 提交于 2019-12-04 04:31:46
Is it possible for me to draw ABOVE all controls on a form ? I have some controls ( textboxes , buttons , COM objects ) on my form, and I wish to draw ON them, overriding any pixels previously drawn by them. I am using Windows Forms on C# . NOTE: the Graphics class draws under the controls... Take a look at the code in this article: Draw Over WinForms Controls The author has created a component that (as he describes it) is like a piece of glass over your form. Your code then draws on this 'glass,' over controls, the form it overlays, etc. One serious limitation which will affect you is that it

IOS UIImage Image upside down

馋奶兔 提交于 2019-12-04 04:06:16
if i draw my image I fixed the problem use CGAffintrasform CGAffineTransform myTr = CGAffineTransformMake(1, 0, 0, -1, 0, backImage.size.height); CGContextConcatCTM(context, myTr); [backImage drawInRect:CGRectMake(cbx, -cby, backImage.size.width, backImage.size.height)]; myTr = CGAffineTransformMake(1, 0, 0, -1, 0, backImage.size.height); CGContextConcatCTM(context, myTr); when i wanna write to file i use this NSData *imageData = UIImageJPEGRepresentation(backImage, 0); then Image upside down how ? When you want to get a UIImage to save, use: UIGraphicsBeginImageContextWithOptions(size,

What is the fastest way to draw a 2D array of color triplets on screen?

陌路散爱 提交于 2019-12-04 02:35:02
The target language is C/C++ and the program has only to work on Linux, but platform independent solutions are preferred obviously. I run Xorg, XVideo and OpenGL are available. How many FPS can I expect on 1024x768 on an Intel Core 2 Duo with Intel graphics? (ONLY drawing counts, consider the arrays to be ready in RAM; no precise prognosis needed) The fastest way to draw a 2D array of color triplets: Use float ( not byte, not double) storage. Each triplet consists of 3 floats from 0.0 to 1.0 each. This is the format implemented most optimally by GPUs (but use greyscale GL_LUMINANCE storage

android, how to draw dotted line in edittext

廉价感情. 提交于 2019-12-03 18:14:12
问题 I refered to this link: How do I make a dotted/dashed line in Android?, and used DashPathEffect . But this does not work for me? why? my code: public class NoteEditText extends EditText { private Paint mPaint; public NoteEditText(Context context) { super(context); } public NoteEditText(Context context, AttributeSet attrs) { super(context, attrs); mPaint = new Paint(); mPaint.setStrokeWidth(1); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setColor(Color.DKGRAY); PathEffect effects =

How to draw a polygon from a set of unordered points

此生再无相见时 提交于 2019-12-03 16:56:47
Currently, I am using a convex hull algorithm to get the outer most points from a set of points randomly placed. What I aim to do is draw a polygon from the set of points returned by the convex hull however, when I try to draw the polygon it looks quite strange. My question, how do I order the points so the polygon draws correctly? Thanks. EDIT: Also, I have tried sorting using orderby(...).ThenBy(...) and I cant seem to get it working. user1149913 Have you tried the gift wrapping algorithm ( http://en.wikipedia.org/wiki/Gift_wrapping_algorithm )? This should return points in the correct order

Draw a straight line using OpenGL ES in iPhone?

99封情书 提交于 2019-12-03 14:11:11
问题 Finally i tried to draw a line using OpenGL ES framework in XCode 4.2 for iPhone simple game app.I studied something about GLKView and GLKViewController to draw a line in iPhone. Here is my sample code that was i tried in my project, @synthesize context = _context; @synthesize effect = _effect; - (void)viewDidLoad { [super viewDidLoad]; self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; if (!self.context) { NSLog(@"Failed to create ES context"); } GLKView *view =

How to draw to screen in c++?

限于喜欢 提交于 2019-12-03 13:34:28
问题 How would I draw something on the screen ? not the console window but the entire screen, preferably with the console minimised. Also, would it show up on a printscreen ? What I want to do is create something like a layer on top of the screen that only me and my aplication are aware of yet still be able to use aplications as usual. Here's an example: Let's say I want 2 yellow squares 5 by 5 pixels in size appearing in the center of the screen on top of all the other applications, unclickable

Redraw multiple Paths at same positions from previous layout orientation

大城市里の小女人 提交于 2019-12-03 13:10:01
Based on my previous question of " How to create a BottomBar as StickyBottomCaptureLayout in camera2 Android api? ", I created a layout with a StickyBar (SB) which is always locked above/near the system bar. I set the default positions and coordinates of the SB and the other layout in onLayout() (exactly as my answer ). The upper layout is a simple custom DrawView which has an ArrayList of Path s drew by the user. When the device rotates, it recalls onDraw() and calls several times canvas.drawPath() . However, the Path s are redrew with the same coordinates as before but on a different

Android SurfaceHolder.unlockCanvasAndPost() does not cause redraw

杀马特。学长 韩版系。学妹 提交于 2019-12-03 12:37:23
I'm implementing a fairly standard app with the Android sdk that involves drawing using the SurfaceView, SurfaceHolder, Callback setup. In my main thread (UI thread) I have no drawing or handling of the SurfaceHolder (or the canvas you retrieve with it). In a separate thread I have the following: Log.i("GAME.DrawThread", "run()"); Log.i("GAME.DrawThread", Thread.currentThread().getName()); Canvas canvas = null; try { canvas = holder.lockCanvas(); synchronized(holder) { Log.i("GAME", "draw():synchronized"); Paint paint = new Paint(); paint.setColor(R.color.draw_color); canvas.drawColor(R.color