Search Results

Search found 5806 results on 233 pages for 'graphics'.

Page 78/233 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • Pretty Pixel-level Picture Painting, Programatically

    - by dreeves
    My mac laptop has 1,024,000 pixels. What's the simplest way to turn my display completely black and go nuts with writing little programs to twiddle pixels to my heart's delight? To make it more concrete, say I wanted to implement the Chaos Game to draw a Sierpinski triangle, at the pixel level, with nothing else on the screen. What are ways to do that?

    Read the article

  • Simple question about the lunarlander example.

    - by Smills
    I am basing my game off the lunarlander example. This is the run loop I am using (very similar to what is used in lunarlander). I am getting considerable performance issues associated with my drawing, even if I draw almost nothing. I noticed the below method. Why is the canvas being created and set to null each cycle? @Override public void run() { while (mRun) { Canvas c = null; try { c = mSurfaceHolder.lockCanvas();//null synchronized (mSurfaceHolder) { updatePhysics(); doDraw(c); } } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { mSurfaceHolder.unlockCanvasAndPost(c); } } } } Most of the times I have read anything about canvases it is more along the lines of: mField = new Bitmap(...dimensions...); Canvas c = new Canvas(mField); My question is: why is Google's example done that way (null canvas), what are the benefits of this, and is there a faster way to do it?

    Read the article

  • How to draw a single point with .Net?

    - by SoMoS
    Hello, this should be pretty simple but I don't get it. How can I draw a single point in .Net? If I use g.DrawLine(Black,0,0,0,0) nothing is drawn and if I use g.DrawLine(Black,0,0,1,0) a line with 2 dots is used. The same happens with g.DrawRectangle. This has me intrigued. Thanks in advance.

    Read the article

  • Cross Platform C library for GUI Apps?

    - by Moshe
    Free of charge, simple to learn/use, Cross Platform C library for GUI Apps? Am I looking for Qt? Bonus question: Can I develop with the said library/toolkit on Mac then recompile on PC/Linux? Super Bonus Question: Link to tutorial and/or download of said library. (RE)EDIT: The truth is that I'm in the process of catching up on the C family (coming from web development - XHTML/PHP/MySQL) to learn iPhone development. I do understand that C is not C++ or ObjectiveC but I want to keep the learning curve as simple as possible. Not to get too off topic, but I am also on the lookout for good starter books and websites. I've found this so far. I'm trying to kill many birds with one stone here. I don understand that there are platform specific extensions, but I will try to avoid those for porting purposes The idea is that I want to write the code on one machine and just compile thrice. (Mac/Win/Linux) If Objective C will compile on Windows and Linux as well as OS X then that's good. If I must use C++, that's also fine. EDIT: Link to QT Please...

    Read the article

  • Sober, eye-catchy Color for Job site

    - by Knowledge Craving
    I will be creating one website related to jobs, which has almost all the features of monster & naukri. My client just asked to use any sober yet eye-catchy color(s) for that website. Can anybody please highlight as to what is / are the sober, yet eye-catchy color(s) for these type of websites?

    Read the article

  • How to -accurately- measure size in pixels of text being drawn on a canvas by drawTextOnPath()

    - by Nick
    I'm using drawTextOnPath() to display some text on a Canvas and I need to know the dimensions of the text being drawn. I know this is not feasible for paths composed of multiple segments, curves, etc. but my path is a single segment which is perfectly horizontal. I am using Paint.getTextBounds() to get a Rect with the dimensions of the text I want to draw. I use this rect to draw a bounding box around the text when I draw it at an arbitrary location. Here's some simplified code that reflects what I am currently doing: // to keep this example simple, always at origin (0,0) public drawBoundedText(Canvas canvas, String text, Paint paint) { Rect textDims = new Rect(); paint.getTextBounds(text,0, text.length(), textDims); float hOffset = 0; float vOffset = paint.getFontMetrics().descent; // vertically centers text float startX = textDims.left; / 0 float startY = textDims.bottom; float endX = textDims.right; float endY = textDims.bottom; path.moveTo(startX, startY); path.lineTo(endX, endY); path.close(); // draw the text canvas.drawTextOnPath(text, path, 0, vOffset, paint); // draw bounding box canvas.drawRect(textDims, paint); } The results are -close- but not perfect. If I replace the second to last line with: canvas.drawText(text, startX, startY - vOffset, paint); Then it works perfectly. Usually there is a gap of 1-3 pixels on the right and bottom edges. The error seems to vary with font size as well. Any ideas? It's possible I'm doing everything right and the problem is with drawTextOnPath(); the text quality very visibly degrades when drawing along paths, even if the path is horizontal, likely because of the interpolation algorithm or whatever its using behind the scenes. I wouldnt be surprised to find out that the size jitter is also coming from there.

    Read the article

  • fastest engine to convert PDF into PNG

    - by skyde
    I would like to know which of the opensource PDF engine can convert a pdf into a image the fastest. I don't care about the quality of the result (antialiasing ...) For my project it need to be very very fast. I would probably need to build my own but i dont wan't to start from scratch.

    Read the article

  • How does Photoshop (Or drawing programs) blit?

    - by user146780
    I'm getting ready to make a drawing application in Windows. I'm just wondering, do drawing programs have a memory bitmap which they lock, then set each pixel, then blit? I don't understand how Photoshop can move entire layers without lag or flicker without using hardware acceleration. Also in a program like Expression Design, I could have 200 shapes and move them around all at once with no lag. I'm really wondering how this can be done without GPU help. I don't think super efficient algorithms could justify that? Thanks

    Read the article

  • Can draw on only half of UIView

    - by ydlee777
    Hello. I am trying to draw grid on a UIView on a UIScrollView. The width of UIView is about 1000 pixels. However, I can draw lines only about first 340 pixels of the UIView. Can anyone help me on this? The drawGrid function is - (void)drawRect:(CGRect)rect { NSInteger width = 25 * 5 * 10; NSInteger height = (10 * 2 + 10) * 12; NSInteger i; //Get the CGContext from this view CGContextRef context = UIGraphicsGetCurrentContext(); // Draw rectangle with a blue stroke color and white fill color CGContextSetRGBStrokeColor(context, 0.0, 0.0, 1.0, 1.0); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0); CGContextSetLineWidth(context, 2.0); CGContextAddRect(context, CGRectMake(0.0, 0.0, width, height)); CGContextFillPath(context); // Draw grid with red color CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor); // Set the width of the pen mark CGContextSetLineWidth(context, 0.2); for (i = 0; i < height; i += 5) { if (i % 25 == 0) { CGContextSetLineWidth(context, 0.4); // Draw a line CGContextMoveToPoint(context, i, 0.0); CGContextAddLineToPoint(context, i, width); CGContextStrokePath(context); CGContextSetLineWidth(context, 0.2); } else { // Draw a line CGContextMoveToPoint(context, i, 0.0); CGContextAddLineToPoint(context, i, width); CGContextStrokePath(context); } } for (i = 0; i < width; i += 5) { if (i % 25 == 0) { CGContextSetLineWidth(context, 0.4); // Draw a line CGContextMoveToPoint(context, 0.0, i); CGContextAddLineToPoint(context, height, i); CGContextStrokePath(context); CGContextSetLineWidth(context, 0.2); } else { // Draw a line CGContextMoveToPoint(context, 0.0, i); CGContextAddLineToPoint(context, height, i); CGContextStrokePath(context); } } } I am also setting up the UIScrollView and UIView as follows: - (void)viewDidLoad { [super viewDidLoad]; CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); waveScrollView = [[WaveScrollView alloc] initWithFrame:frame]; CGRect waveframe = CGRectMake(0, 0, 25 * 5 * 10, (10 * 2 + 10) * 12); EKGWaveView *ekgWaveView = [[EKGWaveView alloc] initWithFrame:waveframe]; waveScrollView.contentSize = CGSizeMake(waveframe.size.width, waveframe.size.height); waveScrollView.maximumZoomScale = 4.0; waveScrollView.minimumZoomScale = 0.75; waveScrollView.clipsToBounds = YES; waveScrollView.aView = ekgWaveView; [waveScrollView addSubview:ekgWaveView]; waveScrollView.delegate = self; [self.view addSubview:waveScrollView]; } I appreciate any help. Thanks.

    Read the article

  • Generating a beveled edge for a 2D polygon

    - by Metaphile
    I'm trying to programmatically generate beveled edges for geometric polygons. For example, given an array of 4 vertices defining a square, I want to generate something like this. But computing the vertices of the inner shape is baffling me. Simply creating a copy of the original shape and then scaling it down will not produce the desired result most of the time. My algorithm so far involves analyzing adjacent edges (triples of vertices; e.g., the bottom-left, top-left, and top-right vertices of a square). From there, I need to find the angle between them, and then create a vertex somewhere along that angle, depending on how deep I want the bevel to be. And because I don't have much of a math background, that's where I'm stuck. How do I find that center angle? Or is there a much simpler way of attacking this problem?

    Read the article

  • Repeating animations using the Stop Selector

    - by Tiago
    I'm trying to repeat an animation until a certain condition is met. Something like this: - (void) animateUpdate { if (inUpdate) { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationDelegate: self]; [UIView setAnimationDidStopSelector: @selector(animateUpdate)]; button.transform = CGAffineTransformMakeRotation( M_PI ); [UIView commitAnimations]; } } This will run the first time, but it won't repeat. The selector will just be called until the application crashes. How should I do this? Thanks.

    Read the article

  • quartz2d translating the origin

    - by qwertyp96
    My understanding of quartz2d is that the code CGContextTranslateCTM(context, x, y); translates the coordinate system. I have a quartz2d view with lots of shapes on it, and the user needs to be able to pan around and zoom it. However, when using the CGContextScaleCTM(context, scaleX, scaleY); code, everything scales around the origin, not the center of the viewpoint the user is viewing. My solution to this was to use the following code: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 512.0+offset.x, 384.0+offset.y); //(512, 384) is the center of the iPad screen CGContextScaleCTM(context, scale, scale); You can translate around fine, but things still scale into the corner. What's wrong? EDIT: Oh. Wow. Duh. If you move the origin, the shapes move too, so you can't move it relative to the shapes. Now I know what's wrong, but how do I do that?(move the origin independently of the shapes)

    Read the article

  • Is it possible to achieve MAX(As,Ad) openGL blending?

    - by Jeff B
    I am working on a game where I want to create shadows under a series of sprites on a grid. The shadows are larger than the sprites themselves and the sprites are animated (i.e. move and rotate). I cannot simply render them into the sprite png, or the shadows will overlap adjacent sprites. I also cannot simply put shadows on a lower layer by themselves, because when they overlap, they will create dark bands at their intersection. These sprites are animated, so it is not feasible to render these en masse. Basically, I want the sprites' shadows to blend together such that they max out at a set opacity. Example: I believe this is equivalent to an openGL blending of (Rs,Gs,Bs,Max(As,Ds)), where I don't really care about R,G, and B, as it will always be the same color in src and dst. However, this is not a valid openGL blending mode. Is there an easy way to accomplish this, especially in cocos2d-iphone? I would be able to approximate this by making the shadow sprites opaque, then applying them both to a parent sprite, and making the parent sprite 40% opacity. However, the way cocos2d works, this only sets the opacity of each child to 40%, rather than the combined sprite image, which results in the same stripe.

    Read the article

  • Strange iPhone application icon view in the iTunes's Applications section

    - by Spiel
    When I drag 'My iPhone App' application's file into iTunes it has proper view. Rounded corners and transparent background. Then I close iTunes and open it again. Corners are still rounded but... What has happened with the background? http://www.freeimagehosting.net/uploads/15fee337bc.png Icon is a project's resource file named 'iTunesArtwork' with dimension 512x512, PNG format.

    Read the article

  • Which OpenGL functions are not GPU-accelerated?

    - by Xavier Ho
    I was shocked when I read this (from the OpenGL wiki): glTranslate, glRotate, glScale Are these hardware accelerated? No, there are no known GPUs that execute this. The driver computes the matrix on the CPU and uploads it to the GPU. All the other matrix operations are done on the CPU as well : glPushMatrix, glPopMatrix, glLoadIdentity, glFrustum, glOrtho. This is the reason why these functions are considered deprecated in GL 3.0. You should have your own math library, build your own matrix, upload your matrix to the shader. For a very, very long time I thought most of the OpenGL functions use the GPU to do computation. I'm not sure if this is a common misconception, but after a while of thinking, this makes sense. Old OpenGL functions (2.x and older) are really not suitable for real-world applications, due to too many state switches. This makes me realise that, possibly, many OpenGL functions do not use the GPU at all. So, the question is: Which OpenGL function calls don't use the GPU? I believe knowing the answer to the above question would help me become a better programmer with OpenGL. Please do share some of your insights.

    Read the article

  • BlackBerry - Convert EncodedImage to byte []

    - by user324884
    I am using below code where i don't want to use JPEGEncodedImage.encode because it increases the size. So I need to directly convert from EncodedImage to byte array. FileConnection fc= (FileConnection)Connector.open(name); is=fc.openInputStream(); byte[] ReimgData = IOUtilities.streamToBytes(is); EncodedImage encode_image = EncodedImage.createEncodedImage(ReimgData, 0, (int)fc.fileSize()); encode_image = sizeImage(encode_image, (int)maxWidth,(int)maxHeight); JPEGEncodedImage encoder=JPEGEncodedImage.encode(encode_image.getBitmap(),50); ReimgData=encoder.getData(); is.read(ReimgData); HttpMultipartRequest( content[0], content[1], content[2], params, "image",txtfile.getText(), "image/jpeg", ReimgData );

    Read the article

  • Can XCode draw the call graph of a program?

    - by Werner
    Hi, I am new to Mac OSX, and I wonder if Xcode can generate , for a given C++ source code, the call graph of the program in a visual way. I also wonder if for each function, and after a run, whether it can also print the %time spent on the function If so, I would thank really some links with tutorials or info, after googling I did not find anything relevant Thanks

    Read the article

  • Get Highest Res Favicon

    - by Jeremy
    I'm making a website that needs to dynamically obtain the favicon of sites upon request. I've found a few api's that can accomplish this fairly well, and so far I'm liking http://www.fvicon.com/. The final image for my website will be 64x64px, and some websites such as Google and Wordpress have nice images of this size that are easily retrieved via this api. Though, of course, most websites only have a 16x16 favicon image and scaling that image to 64x64 has very bad quality loss. Examples: (high res) http://a.fvicon.com/wordpress.com?format=png&width=64&height=64 (low res) http://a.fvicon.com/yahoo.com?format=png&width=64&height=64 Keeping this in mind, I'm planning on somehow determining whether a high-res image is available and, if so, the website will use this image. If not, I want to use a pre-made 64x64 icon with the smaller icon layered over it. What I'm having trouble with is determining if there is a high res favicon available or not. Also, I'm curious if there's a better approach to this situation. I'd rather not use smaller images (64x64 works out really well for this project). The lowest res I'm willing to drop to is 48x48 but even then there will be a significant quality loss for scaling up 16x16 favicons. Any ideas? If you need any more information I will gladly provide it. Thank you!

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >