Search Results

Search found 8498 results on 340 pages for 'integrated graphics'.

Page 69/340 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • iPhone - Drawing 2D Shapes

    - by Hawdon
    Hi guys! I have an array of 2D points which make an irregular polygon. What I want to do is draw the borders of it and then fill it with a color. I am using Cocos2d to code the game around, but I have not found a fill function in Cocos2d, only the ccDrawLine and such. Is there a simple way to draw filled shapes in Cocos2? I have also noted that Core Graphics would work beautifully for this purpose, but I am not able to integrate it with Cocos2d. I put this in to the draw function of my CCLayer: CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextClearRect(ctx, [[UIScreen mainScreen] bounds]); And every time I run it i get this error: <Error>: CGContextClearRect: invalid context I really need to get this working... Any ideas?

    Read the article

  • .NET pie chart: how to add text to slices and rotate chart

    - by Sajee
    The code below creates a 24 slice pie chart. How do I: Add text labels to each slice a la "Wheel of Fortune". Rotate the pie chart? I want it to spin like "Wheel of Fortune". private void DrawPieChart() { Graphics g = this.CreateGraphics(); g.Clear(this.BackColor); Rectangle rect = new Rectangle(0, 0, 300, 300); float angle = 0; Random random = new Random(); int sectors = 24; int sweep = 360 / sectors; for(int i=0; i&lt;24;i++) { Color clr = Color.FromArgb(random.Next(0, 255),random.Next(0, 255), random.Next(0, 255)); g.FillPie(new SolidBrush(clr), rect, angle, sweep); angle += sweep; } g.Dispose(); }

    Read the article

  • Crystal Reports and WMF image

    - by Eve
    I have a problem with inserting a vector graphics (WMF) into report (Crystal Reports v10.5 from Visual Studio 2008). The image is static, inserted by choosing "Insert Picture" during report design in VS. The problem is that it displays differently (size and aspect ratio) on machines with different operating systems and screen resolutions. Converting to bitmap isn't possible beacause loss of the quality of print isn't acceptable. I thought about dynamic loading of the image, but in this version of CR. I don't see a possibility to set dynamic graphic location in picture properties. Is there any way to solve this problem?

    Read the article

  • Direct video card access

    - by icemanind
    Guys, I am trying to write a class in C# that can be used as a direct replacement for the C# Bitmap class. What I want to do instead though is perform all graphic functions done on the bitmap using the power of the video card. From what I understand, functions such as DrawLine or DrawArc or DrawText are primitive functions that use simple cpu math algorithms to perform the job. I, instead, want to use the graphics card cpu and memory to do these and other advanced functions, such as skinning a bitmap (applying a texture) and true transparancy. My problem is, in C#, how do I access direct video functions? Is there a library or something I need?

    Read the article

  • How to create plots in multiple windows and keep them seperate in R

    - by PaulHurleyuk
    Hello SOers, I'm sure this is an easy problem, but my google / help foo has failed me, so it's up to you. I have an R script that generates several plots, and I want to view all the plots on screen at once (in seperate windows), but I can't work out how to open multiple graphics windows. I'm using ggplot2, but I feel this is a more basic problem, so I'm just using base grapics for this simple example x<-c(1:10) y<-sin(x) z<-cos(x) dev.new() plot(y=y,x=x) dev.off() dev.new() plot(x=x,y=z) But this doesn't work. I'm on Windows if this matters (Windows + Eclipse + StatEt)

    Read the article

  • The easiest way to draw an image?

    - by Benno
    Assume you want to read an image file in a common file format from the hard drive, change the color of one pixel, and display the resulting image to the screen, in C++. Which (open-source) libraries would you recommend to accomplish the above with the least amount of code? Alternatively, which libraries would do the above in the most elegant way possible? A bit of background: I have been reading a lot of computer graphics literature recently, and there are lots of relatively easy, pixel-based algorithms which I'd like to implement. However, while the algorithm itself would usually be straightforward to implement, the necessary amount of frame-work to manipulate an image on a per-pixel basis and display the result stopped me from doing it.

    Read the article

  • Does Quartz2D test intersection of rect by line before drawing it.

    - by ddnv
    I'm drawing a big scheme that consist of a lot of lines. I do it in the drawRect: method of UIView. The scheme is larger than the layer of view and I check each line and draw it only if it intersects the visible rect. But at one moment I thought, should I do this? Maybe Quartz is already doing this test? So the question is: When I use function CGContextAddLineToPoint() does the Core Graphics tests this line for intersection with layer rect or it just draw it anyway?

    Read the article

  • How do I re-set a BMP file's resolution (DPI) indicator?

    - by Joshua Fox
    I have a BMP tagged as 299 DPI resolution. I'd like to change that to 99 DPI. Importantly, the DPI marker in a BMP has no structural meaning. An image has a certain width and height in pixels. The displaying application can show the image at any width in inches. So, the DPI is just a hint. However, I am dealing with some third-party software which behaves differently depending on this marker, so I need to re-set it. I will appreciate suggestions on how to do this programmatically (especially in Java) as well as in GUI graphics tools (e.g. Gimp).

    Read the article

  • How to "flick" a UIImageView?

    - by Meltemi
    I've got some UIViews that I'd like the user to be able to "flick" across the screen. They're not scroll views. They simply contain a raster image (png). Can anyone point me to some sample code, etc to help get me started? Something a little more heavyweight than "MoveMe" out there that helps detect a "flick" (vs a "nudge" or a drag and drop) and then carries the view off in the direction of the "flick"? OpenGL probably overkill. If possible I'd like to stay w/in the realm of Core Graphics/Animation.

    Read the article

  • Java : VolatileImage slower than BufferedImage.

    - by Norswap
    I'm making a game in java and in used BufferedImages to render content to the screen. I had performance issues on low end machines where the game is supposed to run, so I switched to VolatileImage which are normally faster. Except they actually slow the whole thing down. The images are created with GraphicsConfiguration.createCompatibleVolatileImage(...) and are drawn to the screen with Graphics.drawImage(...) (follow link to see which one specifically). They are drawn upon a Canvas using double buffering. Does someone has an idea of what is going wrong here ?

    Read the article

  • Efficiently draw a grid in Windows Forms

    - by Joel
    I'm writing an implementation of Conway's Game of Life in C#. This is the code I'm using to draw the grid, it's in my panel_Paint event. g is the graphics context. for (int y = 0; y < numOfCells * cellSize; y += cellSize) { for (int x = 0; x < numOfCells * cellSize; x += cellSize) { g.DrawLine(p, x, 0, x, y + numOfCells * cellSize); g.DrawLine(p, 0, x, y + size * drawnGrid, x); } } When I run my program, it is unresponsive until it finishes drawing the grid, which takes a few seconds at numOfCells = 100 & cellSize = 10. Removing all the multiplication makes it faster, but not by very much. Is there a better/more efficient way to draw my grid? Thanks

    Read the article

  • Looking for a mobile platform to view vector data and use it like a simple map

    - by Orchestrator
    I would like to develop or use an existing platform that will allow me to view custom vector data and use it as a map on mobile phones such as Android/IPhone (Maybe even WP7). I'm hoping that there's already a good infrastructure for what I need so I would not need to develop a whole infrastructure by myself. In Conclusion - Is there any existing platform that may answer my needs? If not, how would you guys suggest I should begin? How should I save my vector data? How could I read it? Should I view it with a graphics engine like OpenGL? Is there any chance this solution could be cross-platform? I know that it's possible since it was already done with apps like Waze. And it works the same on iOS and Android. Thanks!

    Read the article

  • Java SWT - dissolve (fade) from one image to the next.

    - by carillonator
    I'm pretty new to Java and SWT, hoping to have one image dissolve into the next. I have one image now in a Label (relevant code): Device dev = shell.getDisplay(); try { Image photo = new Image(dev, "photo.jpg"); } catch(Exception e) { } Label label = new Label(shell, SWT.IMAGE_JPEG); label.setImage(photo); Now I'd like photo to fade into a different image at a speed that I specify. Is this possible as set up here, or do I need to delve more into the org.eclipse.swt.graphics api? Also, this will be a slide show that may contain hundreds of photos, only ever moving forward (never back to a previous image)---considering this, is there something I explicitly need to do in order to remove the old images from memory? Thanks!!

    Read the article

  • Why do we need normalized coordinate system? Options

    - by jcyang
    Hi, I have problem understand following sentences in my textbook Computer Graphics with OpenGL. "To make viewing process independent of the requirements of any output device,graphic system convert object descriptions to normalized coordinates and apply the clipping routines." Why normalized coordinates could make viewing process independent of the requirements of any output devices? Isn't the projection coordinates already independent of output device?We only need to first scale and then translate the projection coordinate then we will get device coordinate. So why do we need first convert the projection coordinate to normalized coordinate first? "Clipping is usually performed in normlized coordinates.This allows us to reduce computations by first concatenating the various transformation matrices" Why clipping is usually performed in normlized coordinates? What kind of transformation concatenated? thanks. jcyang.

    Read the article

  • Will the Driver Support for Intel HD Graphics be Improved in 12.10?

    - by Hiranya
    I recently installed Ubuntu 12.04 on a HP Pavilion dv4 laptop. This is a core i7 machine with Intel HD graphics and also a separate nVidia VGA card. I had a lot of issues getting Ubuntu 12.04 working on this system. First there were issues booting up the live CD for installation. I worked around that by using the 'nomodeset' option. Then I continued to have similar issues after installation has completed. So I had to permanently add the nomodeset option to my GRUB boot configuration. At the moment I have a working installation but there are many issues: Ubuntu GUI is a bit flaky at times. The mouse pointer goes on and off when hovering over certain icons. Certain things doesn't get rendered properly on the screen. I can't access any of the tty consoles. Hitting Ctrl+Alt+F[1-6] gives me a blank screen. And once that happens I can't even come back to the UI by hitting Ctrl+Alt+F7. I've realized that tty consoles are actually working. I just can't see the text. If I enter a command like 'sudo reboot' into the empty screen the machine reboots. Can't get external displays (monitors, projectors etc) working. But I think this is probably because the VGA out is wired to the nVidia card which is not being used by Linux. colord program crashes every now and then triggering a popup message. So my main question is, will the support for Intel HD graphics be improved in the next release? Or will I have to keep using the nomodeset option in the new release too? Also I appreciate if anybody can shed some light on any of the issues listed above. Thanks in advance.

    Read the article

  • What to do about "system running in low-graphics mode"?

    - by ubuntubabe
    My Dell which was 5 years old suddenly karked it and I had the "low graphics" black screen and useless dialogue box. As I believed it was a dead graphics card I went out and bought a brand new machine. I put aside the new machine and tried again in vain to open the Dell. I eventually got to the command line via Ctrl+Alt+F1. I logged into my account from there, and simply started a series of sudo apt-get remove of various softwares that I knew were installed on my PC (software without any great consequence like Google earth, tweak, Skype etc). Lo and behold after a sudo reboot my computer was fine again! So now I have 2 computers. BUT one week after buying the other one and installing 12.04 because I love Ubuntu, the SAME PROBLEM arrived! I once again deleted Google earth, Skype, and did a sudo reboot and everything worked as before. I think there is a bug or something in 12.04 as this problem has never arisen with any other versions of Ubuntu.

    Read the article

  • How to use Windows login for single-sign-on and for Active Directory entries for Desktop Java applic

    - by Touko
    I'd like to have my desktop Java application to have single sign on related to Active Directory users. In two steps, I'd like to : Be sure that the particular user has logged in to Windows with some user entry. Check out some setup information for that user from the Active Directory With http://stackoverflow.com/questions/31394/java-programatic-way-to-determine-current-windows-user I can get the name of the current Windows user but can I rely to that? I think the System.getProperty("user.name") won't be secure enough? ("user.name" seems to be got from environment variables, so I can't rely on that, I think?) Question http://stackoverflow.com/questions/390150/authenticating-against-active-directory-with-java-on-linux provides me the authentication for given name+pass but I'd like to authenticate based on the Windows logon? For the Active Directory access, the LDAP would probably be the choise? I'm not totally sure if I'm asking the right questions but hopefully somebody has some ideas to forward me on.

    Read the article

  • Configure IIS7 to server static content through ASP.NET Runtime

    - by Anton Gogolev
    I searched high an low and still cannot find a definite answer. How do I configure IIS 7.0 or a Web Application in IIS so that ASP.NET Runtime will handle all requests -- including ones to static files like *.js, *.gif, etc? What I'm trying to do is as follows. We have kind of SaaSy site, which we can "skin" for every customer. "Skinnig" means developing a custom master page and using a bunch of *.css and other images. Quite naturally, I'm using VirtualPathProvider, which operates like this: public override System.Web.Hosting.VirtualFile GetFile(string virtualPath) { if(PhysicalFileExists(virtualPath)) { var virtualFile = base.GetFile(virtualPath); return virtualFile; } if(VirtualFileExists(virtualPath)) { var brandedVirtualPath = GetBrandedVirtualPath(virtualPath); var absolutePath = HttpContext.Current.Server.MapPath(brandedVirtualPath); Trace.WriteLine(string.Format("Serving '{0}' from '{1}'", brandedVirtualPath, absolutePath), "BrandingAwareVirtualPathProvider"); var virtualFile = new VirtualFile(brandedVirtualPath, absolutePath); return virtualFile; } return null; } The basic idea is as follows: we have a branding folder inside our webapp, which in turn contains folders for each "brand", with "brand" being equal to host name. That is, requests to http://foo.example.com/ should use static files from branding/foo_example_com, whereas http://bar.example.com/ should use content from branding/bar_example_com. Now what I want IIS to do is to forward all requests to static files to StaticFileHandler, which would then use this whole "infrastructure" and serve correct files. However, try as I might, I cannot configure IIS to do this.

    Read the article

  • Problem using custom HttpHandler to process requests for both .aspx and non-extension pages in IIS7

    - by Noel
    I am trying to process both ".aspx" and non-extension page requests (i.e. both contact.aspx and /contact/) using a custom HttpHandler in IIS7. My handler works just fine in either one case or the other, but as soon as I try to process both cases, it only works for one. Please see Handlers snippet from my web.config below: If i keep only mapping to "*.aspx" then all .aspx requests are processed correctly, but obviously extensionless requests won't work: <add name="AllPages.ASPX" path="*.aspx" verb="*" type="Test.PageHandlerFactory, Test" preCondition="" /> If i change the mapping to "*" then all extensionless requests are processed correctly, but ".aspx" requests that should still be handled by this handler stop working. Note that i added the StaticFiles entry in order to process files that are on disk like images, css, js, etc. <add name="WebResource" path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" /> <add name="StaticFiles" verb="GET,HEAD" path="*.*" type="System.Web.StaticFileHandler" resourceType="File" /> <add name="AllPages" path="*" verb="*" type="Test.PageHandlerFactory, Test" preCondition="" /> The crazy thing is that when i load an ".aspx" request (with the 2nd configuration shown) IIS7 gives a 404 not found error. The error also says that the request is processed by the StaticFiles handler. But I made sure to add resourceType="File" to the StaticFileHandler in order to avoid this. According to MS this means the request is only for "physical files on disk". Am i misreading/interpreting the "on disk" part? My .aspx file isn't on disk, that's why i want to use the handler in the first place.

    Read the article

  • Bastion - Indie Humble Bundle

    - by user68008
    I have downloaded Bastion for Ubuntu and installed in the home folder normally. When executing "Games Bastion" nothing happens. Running Bastion directly from the installation folder results in the error below Unhandled Exception: System.EntryPointNotFoundException: glProgramParameteri at (wrapper managed-to-native) OpenTK.Graphics.OpenGL.GL/Core:ProgramParameteri (uint,OpenTK.Graphics.OpenGL.AssemblyProgramParameterArb,int) at OpenTK.Graphics.OpenGL.GL.ProgramParameter (Int32 program, AssemblyProgramParameterArb pname, Int32 value) [0x00000] in <filename unknown>:0 at Microsoft.Xna.Framework.Graphics.EffectPass.ApplyPass () [0x00000] in <filename unknown>:0 at Microsoft.Xna.Framework.Graphics.Effect.DefineTechnique (System.String techniqueName, System.String passName, Int32 vertexIndex, Int32 fragmentIndex) [0x00000] in <filename unknown>:0 at Microsoft.Xna.Framework.Graphics.SpriteEffect..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) [0x00000] in <filename unknown>:0 at Microsoft.Xna.Framework.Graphics.SpriteBatch..ctor (Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) [0x00000] in <filename unknown>:0 at GSGE.ExceptionGame.LoadContent () [0x00000] in <filename unknown>:0 <snip> I have tried some solutions on the internet, like adding OpenTK.dll.config the line below: <dllmap os="linux" dll="libXi" target="libXi.so.6"/> This didn't help. Also tried running as sudo and that didn't help. Some posts said that this might be a problem with Ubuntu noveau drivers. But I'm using the NVIDIA proprietary drivers. DISTRIB_ID=Ubuntu DISTRIB_RELEASE=10.04 DISTRIB_CODENAME=lucid DISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS" OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce 9400 GT/PCI/SSE2 OpenGL version string: 3.2.0 NVIDIA 195.36.24 direct rendering: Yes

    Read the article

  • Reset or clear the UIView from UILabels

    - by Nicsoft
    Hello, I have created an UIView on which I have a number of labels and I'm also drawing some lines in the same UIView. Sometimes I update the lines that I'm drawing. Now, the problem I am having is that when I update the lines, they get drawn according to my wish. But the labels are overwriting themselves. This shouldn't have been a problem if it wasn't for that the position is changed about 1 pixel and that makes the text go blurry. I don't know how to remove the labels before they are redrawn. I do remove the labels from the superview and add them back when drawRect is called, but the SetNeedDisplay doesn't clear the screen before the graphic is updated, I guess (I think I read that SetNeedsDisplay/drawRect doesn't clear the screen, just updating the content. Couldn't find the text now while searching)? What is the pattern to use here, should I create a retangle with the size of the screen (or the area where the labels are) and fill it with the background colour, or is there any other way to clear or reset the UIView (I don't want to release and create the UIView again). The view is created in IB and associated with a custom UIView. In IB I add some buttons and other static labels. The above labels and graphics is created programatically. Any comments would be helpful! Thanks in advance!

    Read the article

  • Double buffering with C# has negative effect

    - by Roland Illig
    I have written the following simple program, which draws lines on the screen every 100 milliseconds (triggered by timer1). I noticed that the drawing flickers a bit (that is, the window is not always completely blue, but some gray shines through). So my idea was to use double-buffering. But when I did that, it made things even worse. Now the screen was almost always gray, and only occasionally did the blue color come through (demonstrated by timer2, switching the DoubleBuffered property every 2000 milliseconds). What could be an explanation for this? using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = CreateGraphics(); Pen pen = new Pen(Color.Blue, 1.0f); Random rnd = new Random(); for (int i = 0; i < Height; i++) g.DrawLine(pen, 0, i, Width, i); } // every 100 ms private void timer1_Tick(object sender, EventArgs e) { Invalidate(); } // every 2000 ms private void timer2_Tick(object sender, EventArgs e) { DoubleBuffered = !DoubleBuffered; this.Text = DoubleBuffered ? "yes" : "no"; } } }

    Read the article

  • Producing CCITT compressed TIFF from CGImage

    - by Brian Postow
    I have a CGImage (core graphics, C/C++). It's grayscale. Well, originally it was B/W, but the CGImage may be RGB. That shouldn't matter. I want to create a CCITT-Group 4 TIFF. I can create an LZW TIFF (grayscale or color) via creating a destination with the correct dictionary and adding the image in. No problem. However, there doesn't seem to be an equivalent kCGImagePropertyTIFFCompression value to represent CCITT-4. It should be 4, but that produces uncompressed. I have a manual CCITT compression routine, so if I can get the binary (1 bit per pixel) data, I'm set. But I can't seem to get 1 BPP data out of a CGImage. I have code that is supposed to put the CGImage into a CGBitmapContext and then give me the data, but it seems to be giving me all black. I've asked a couple of questions today trying to get at this, but I just figured, lets ask the question I REALLY want answered and see if someone can answer it. There's GOT to be a way to do this. I've got to be missing something dumb. What is it?

    Read the article

  • Defining Light Coordinates

    - by Zachary
    I took a Computer Graphics exam a couple of days ago which had extra credit question like the following: A light can be defined in one of two ways. It can be defined in world coordinates, e.g. a street light, or in the viewer (eye coordinates), e.g., a head-lamp worn by a miner. In either case the viewpoint can freely change. Describe how the light should be transformed different in these two cases. Since I won't get to see the results of this until after spring break, I thought I would ask here. It seems like the analogies being used are misleading - could you not define a light source that is located at the viewers eye in world coordinates just as well as you could in eye coordinates? I've been doing some research on how OpenGL handles light, and it seems as though it always uses eye coordinates - the ModelView matrix would be applied to any light in world coordinates. In that case the answer may just be that you would have to transform light defined in world coordinates into eye coordinates using something like the ModelView matrix, while light defined in eye coordinates would only need to be transformed by the projection matrix. Then again I could be totally under thinking (or over thinking this). Another thought I had is that it determines which way you render shadows, but that has more to do with the location of the light and its type (point, directional, emission, etc) than what coordinates it is represented in. Any ideas?

    Read the article

  • Graphics.MeasureCharacterRanges giving wrong size calculations in C#.Net?

    - by Owen Blacker
    I'm trying to render some text into a specific part of an image in a Web Forms app. The text will be user entered, so I want to vary the font size to make sure it fits within the bounding box. I have code that was doing this fine on my proof-of-concept implementation, but I'm now trying it against the assets from the designer, which are larger, and I'm getting some odd results. I'm running the size calculation as follows: StringFormat fmt = new StringFormat(); fmt.Alignment = StringAlignment.Center; fmt.LineAlignment = StringAlignment.Near; fmt.FormatFlags = StringFormatFlags.NoClip; fmt.Trimming = StringTrimming.None; int size = __startingSize; Font font = __fonts.GetFontBySize(size); while (GetStringBounds(text, font, fmt).IsLargerThan(__textBoundingBox)) { context.Trace.Write("MyHandler.ProcessRequest", "Decrementing font size to " + size + ", as size is " + GetStringBounds(text, font, fmt).Size() + " and limit is " + __textBoundingBox.Size()); size--; if (size < __minimumSize) { break; } font = __fonts.GetFontBySize(size); } context.Trace.Write("MyHandler.ProcessRequest", "Writing " + text + " in " + font.FontFamily.Name + " at " + font.SizeInPoints + "pt, size is " + GetStringBounds(text, font, fmt).Size() + " and limit is " + __textBoundingBox.Size()); I then use the following line to render the text onto an image I'm pulling from the filesystem: g.DrawString(text, font, __brush, __textBoundingBox, fmt); where: __fonts is a PrivateFontCollection, PrivateFontCollection.GetFontBySize is an extension method that returns a FontFamily RectangleF __textBoundingBox = new RectangleF(150, 110, 212, 64); int __minimumSize = 8; int __startingSize = 48; Brush __brush = Brushes.White; int size starts out at 48 and decrements within that loop Graphics g has SmoothingMode.AntiAlias and TextRenderingHint.AntiAlias set context is a System.Web.HttpContext (this is an excerpt from the ProcessRequest method of an IHttpHandler) The other methods are: private static RectangleF GetStringBounds(string text, Font font, StringFormat fmt) { CharacterRange[] range = { new CharacterRange(0, text.Length) }; StringFormat myFormat = fmt.Clone() as StringFormat; myFormat.SetMeasurableCharacterRanges(range); using (Graphics g = Graphics.FromImage(new Bitmap( (int) __textBoundingBox.Width - 1, (int) __textBoundingBox.Height - 1))) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; Region[] regions = g.MeasureCharacterRanges(text, font, __textBoundingBox, myFormat); return regions[0].GetBounds(g); } } public static string Size(this RectangleF rect) { return rect.Width + "×" + rect.Height; } public static bool IsLargerThan(this RectangleF a, RectangleF b) { return (a.Width > b.Width) || (a.Height > b.Height); } Now I have two problems. Firstly, the text sometimes insists on wrapping by inserting a line-break within a word, when it should just fail to fit and cause the while loop to decrement again. I can't see why it is that Graphics.MeasureCharacterRanges thinks that this fits within the box when it shouldn't be word-wrapping within a word. This behaviour is exhibited irrespective of the character set used (I get it in Latin alphabet words, as well as other parts of the Unicode range, like Cyrillic, Greek, Georgian and Armenian). Is there some setting I should be using to force Graphics.MeasureCharacterRanges only to be word-wrapping at whitespace characters (or hyphens)? This first problem is the same as post 2499067. Secondly, in scaling up to the new image and font size, Graphics.MeasureCharacterRanges is giving me heights that are wildly off. The RectangleF I am drawing within corresponds to a visually apparent area of the image, so I can easily see when the text is being decremented more than is necessary. Yet when I pass it some text, the GetBounds call is giving me a height that is almost double what it's actually taking. Using trial and error to set the __minimumSize to force an exit from the while loop, I can see that 24pt text fits within the bounding box, yet Graphics.MeasureCharacterRanges is reporting that the height of that text, once rendered to the image, is 122px (when the bounding box is 64px tall and it fits within that box). Indeed, without forcing the matter, the while loop iterates to 18pt, at which point Graphics.MeasureCharacterRanges returns a value that fits. The trace log excerpt is as follows: Decrementing font size to 24, as size is 193×122 and limit is 212×64 Decrementing font size to 23, as size is 191×117 and limit is 212×64 Decrementing font size to 22, as size is 200×75 and limit is 212×64 Decrementing font size to 21, as size is 192×71 and limit is 212×64 Decrementing font size to 20, as size is 198×68 and limit is 212×64 Decrementing font size to 19, as size is 185×65 and limit is 212×64 Writing VENNEGOOR of HESSELINK in DIN-Black at 18pt, size is 178×61 and limit is 212×64 So why is Graphics.MeasureCharacterRanges giving me a wrong result? I could understand it being, say, the line height of the font if the loop stopped around 21pt (which would visually fit, if I screenshot the results and measure it in Paint.Net), but it's going far further than it should be doing because, frankly, it's returning the wrong damn results. Any and all help gratefully received. Thanks!

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >