Click here to Skip to main content
15,887,981 members
Everything / Graphics

Graphics

graphics

Great Reads

by honey the codewitch
GFX is a fast and full featured replacement for standard IoT drawing libraries that is optimized to reduce bus I/O
by Sergey Alexandrovich Kryukov
Addresses questions on graphics, threading with UI, form development, printing and more
by CMalcheski
Thinking outside the box can result in critical performance gains
by WebMaster
Some simple examples of how to apply affine transformations in computer graphics.

Latest Articles

by honey the codewitch
Display automated (optionally controllable) Tetris on an LCD or Neopixel panel
by honey the codewitch
Got an embedded or IoT widget with a screen but no real memory or flash space to speak of? Read this.
by honey the codewitch
Create ASCII art from common image formats and text
by Sergey Alexandrovich Kryukov
Another variant of the cross-platform replacement for all those office presentation applications in a single file, and now this file is JavaScript

All Articles

Sort by Title

Graphics 

16 Mar 2014 by Sicppy
I get "A generic error occurred in GDI+" when I try to save a bitmap(that I have opened and edited). It only happens some of the time. I have no idea why this is happening, please help. It occurs at line 162.Thanks in advance,Jordanusing System;using...
16 Mar 2014 by Abhinav S
Check the folder permissions where you are saving the file.You should have permissions to save the file.In addition, ensure that the file does not already exist and is open in another program.
3 Jan 2012 by ahmedatas
hello to all . I need to do a project about convexHull algorithms in web Service [WİTH C#]. Algorithm names here : •Gift wrapping aka Jarvis march :One of the simplest (although not the most time efficient in the worst case) planar algorithms. Discovered independently by Chand &...
3 Jan 2012 by Ganesan Senthilvel
Best reference is available at CodeProject: Convex Hull[^]
3 Jan 2012 by idle63
Maybe also a starting point (3D):http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html[^]Regards
11 Nov 2019 by Sara Noemi
I get this exception:System.ArgumentException occurred Message="Parameter is not valid." Source="System.Drawing" StackTrace: at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)...when I instantiate a new...
7 Nov 2013 by OriginalGriff
Check your values - I just tried in in my code: int width = 6614; int height = 9685; Bitmap resImage = new Bitmap(width, height); resImage.SetResolution(600, 600);And I don't get an exception.So, most likely, the values you are passing in for...
7 Nov 2013 by Mishra Laxmikant
are you trying to create bitmap from stream? if yes, please check your stream is seek-able or not.if (!strmftpdata.CanSeek){}if it is not seek-able then you need to make it seek-able.
7 Nov 2013 by Mishra Laxmikant
Yep, instantiate bitamp with stream. for example. public static void saveimage(System.IO.Stream InputFileStream, string ImageName, string ImageExtension) { Bitmap bmpBitMapImage = new Bitmap(InputFileStream, true);} I have also faced this error so many times.
2 Jan 2017 by Member 12931920
Dear friend! Did you solve this problem? I have the same problem as you. Could you tell me how to deal with this problem?Thank you!
25 Dec 2013 by kodmail
I have 512*512 16 bit raw 'Lena' data I wanna show this data 24bit or 32bit depth colored image. I use C#.I show this data 16 bit gray scale;gray scale 16bit depth Lenabut I wanna show colored image as the given link colored Lena
23 Oct 2023 by honey the codewitch
Create ASCII art from common image formats and text
10 Mar 2012 by Member 8712642
Hi, I want to make a 2D game in C# using Unity engine but I really don't have any drawing skills or graphics at all. So I was wondering if you guys can point me to a place where I can find some free 2D graphics and sprites. My game will be mario kind of game (character walking , killing...
10 Mar 2012 by Sergey Alexandrovich Kryukov
Such things never work really. All gaming software always have authors who play the roles of artists, graphics designers and the like. This work is extremely important; your program can not really became a product without it.If you borrow some graphics from the public domain, you cannot...
1 Apr 2019 by veen_rp
Smooth a 2D polyline through interpolation (Catmull-Rom) or approximation (Chaikin)
12 Feb 2010 by Hessam Jalali
Basically the method mostly used for 3D visual modeling from images is Structure from Motion.If you just need the model, there are some software can do that for you, here are some links:3D Seeinsight3dhowever if you want to develop your own, this book is a good startAn...
12 Feb 2010 by Khaniya
I have a black object something like chess piece; I put it on rotating base against camera and takes 100s of photos from different angles by rotating base.Photos background is white.Now I want to combine those all photos and make 3D object Any link, tutorial, guidance is appreciated
25 Oct 2023 by Sebastian Porstendorfer
Aside from "structure from motion" the approach is also called "photogrammetry". There are tools that will help you with the process that take the image set as an input, and will produce something that is called a point cloud as its output. You...
13 Sep 2011 by steersteer
Thank you very much for your response. I am thinking of developing a small game. will learn XNA soon.
26 Jun 2011 by DaveAuld
XNA is a effectively a Game engine XNA Wiki[^]WPF is Windows Presentation Foundation WPF Wiki[^]Check out the articles on CodeProject, for example, here is a WPF 3D Primer[^], there are plenty other ones.So, for 3D, WPF certainly is an option :)
12 Dec 2011 by ge-force
It depends on what you want to do in your game.WPF is better for small games, because you get all the controls that you can put down on your Window without having to custom-make controls.XNA, however, cna do some amazing stuff.Here are a few games by XNA:Robot Game (3rd person 3D...
7 Apr 2017 by Lucasbear123
Hi, I'm starting to work on a 3D library called Lib3D. I need help with understanding the math involved with perspective projection, and then implementing the math into the program. Any help will be appreciated!-Lucas
1 Jan 2011 by Dr.Walt Fair, PE
Have you seen this[^]?Google also brings up quite a few results, but I'm not sure exactly what you are looking for.
15 May 2012 by Amjad Kherbeck
can any one give me an example of 3d project with freeglut in c++ so i can depend in it while am working with my own project>>>thx
15 May 2012 by enhzflep
Sure thing.You have to link in two libraries - freeglut & opengl32main.c/* * GLUT Shapes Demo * * Written by Nigel Stewart November 2003 * * This program is test harness for the sphere, cone * and torus shapes in GLUT. * * Spinning wireframe and smooth shaded shapes...
10 Jul 2013 by havilove
Im trying to make a plugin for Age of Empires (AOE). I want to display a message on screen of game when im playing I think must use SetWindowsHookEx and draws overlay in response to WM_PAINT messages. But im not strong with Hook. Im searching for a simple code snippet which can help me draw a...
11 Oct 2013 by Rieth L
How i can do it ? I found NClass, but i don't understood how it work...
11 Oct 2013 by farhad Najib
Hello Dear FriendI suggest you to use BPMN Software to solve your problemYours farhad
11 Oct 2013 by Sergey Alexandrovich Kryukov
Please see my past answers for some basic ideas:Vector graphics software like CorelDraw or Inkscape in C# or VB.NET[^],Connect different controls[^],Architecture diagram tips[^].—SA
13 Mar 2016 by The Zakies
Tutorial 1 (how to create a vector graphics program)
16 Apr 2018 by Voevudko A. E., Ph.D.
Demonstrating a few approaches to generating and plotting fractals in R and offering R scripts realizing it.
21 Jun 2018 by Member 13034100
I apologize to ask a simple question by not being pro-CS. I'm a dedicated autodidactic programming learner, and I'm trying to build some GUI application but I'm still confused about the basic process to link engines ( core code ) with graphics resources which are the front end. Can you...
21 Jun 2018 by Richard MacCutchan
If you want to create an application for any platform then your best bet would be Java: The Java™ Tutorials[^]. If you just want it for Windows then Visual Studio is the best IDE, and you can learn Windows programming from EFNet #Winprog[^] and Win32 Programming - FunctionX[^].
22 Jun 2018 by Jochen Arndt
At first you have to select a GUI framework: List of platform-independent GUI libraries - Wikipedia[^]. All of those provide documention with tutorials and example code. So you might try out some of them before doing the final decision. Because you are using CodeBlocks, you should have at...
11 Jul 2018 by Member 13034100
Thanks to all for all your great suggestions but I think that finally I came across with I was looking for: SLD2, a powerful library that allows you to manage not only the all graphic features but also, mouse, keyboard, sounds...etc. Now I'going to learn it from tutorials, books...etc. Cheers!
16 Jan 2016 by Mathew_wwx
This tip will introduce a library written in C++ that wraps up a 2d polygon triangulation algorithm with time complexity of O(N*logN), the algorithm works on both self-intersected and non self-intersected polygons.
17 Oct 2016 by Mehedi Shams
Design to scale automatically to different screen resolutions
7 Feb 2021 by g96b10
Win2D provides a neat API interface, but how do you render complex sprites for your game? I provide a library and editor to make this a streamlined process.
25 Jun 2016 by Will J Miller
This article describes the implementation of a custom class called MMSCropImageView. The class gives the feature of drawing and moving a rectangle over an image to identify the crop region and return it in an UIImage. It explains the considerations and solutions for cropping a bitmap.
23 Aug 2013 by Totallyniels
Hello all,I would like to start off with stating that i'm not a professional programmer, and often work from examples I find on sites like Code Project. It might be that i'm approaching this from the wrong angle, so please comment as you see fit.BackgroundFor some analysis purpose I...
24 Aug 2013 by Totallyniels
For anyone interested..I solved this by creating a "Mask" bitmap and filling it white and the region with black. I could then iterate the mask bitmap pixels to get pixels of interest. Without filling it completely white pixels are somehow not read correctly.The solution was actually...
17 Dec 2010 by biju47
Hi all,I want to accomplish the following task, Please help me to achieve this.Active learning methods have been considered with increased interest in the statistical learning community. Initially developed within a classification framework, a lot of extensions are now being proposed to...
18 Dec 2010 by Henry Minute
If you want to know about active learning methods this is not the place to ask, unless you get really, really lucky.A better source of information would be a search engine. Now if only someone could think of a suitable search phrase.
17 Mar 2013 by supernorb
The method DrawString() gives out a very nice result, the text/string is drawn clearly as you type it into a textbox. However I tried another way (a by-way) but it showed a bad appearance. I need to do this way because I want to apply some transformations to the string first (such as rotating)....
17 Mar 2013 by Sergey Alexandrovich Kryukov
You don't really need to represent a string as a graphic path for proper transform. Transformations are done using...
8 May 2015 by DrABELL
CSS3 technique utilizes HTML5 div elements to produce compact pseudo-graphics
27 Dec 2012 by WebMaster
Some simple examples of how to apply affine transformations in computer graphics.
26 Jul 2011 by Jamal Seyedi
public enum TPosisioning{ Static = 1, Absolute = 2, Relative = 3, Fixed = 4,}public class TDrawingNode{ public string Text; public string Id; public int X, Y, W, H, ZIndex; public bool Movable, Transferable; public bool Resizable; ...
26 Jun 2010 by Conrad Kanengieter
This is a demo plot in HTML and SVG where JavaScript controls SVG.
19 Sep 2014 by FaizanMubasher
This article include steps to create simple needle in android using View and Graphics. A needle like placed in Speedometers.
23 May 2011 by Tefik Becirovic
Calculate angle between two points and the x-axis using C#
16 Jul 2020 by Christ Kennedy
Combine your own sprites with any MP4 you choose using this Animation Editor
7 Aug 2021 by VBeginner.NET
I have learnt the basics and am able to draw various kinds of things on forms with persistent graphics and colour them. Now I would like to learn more but cannot find good tutorials. Do you know of such free tutorials on the Internet? I still do...
7 Aug 2021 by Richard MacCutchan
Quote: I still do not understand classes and methods well (my background being in QBasic and VB3 and VB6). I do not understand the parameters that are passed in control event handling routines at all - sender, e, EventArgs, PaintEventArgs, etc....
7 Aug 2021 by OriginalGriff
Classes, methods, events: these are the fundamental elements of any .NET programming - so if you don;t understand them, then whatever you do is wrong, even if it appears to work at the moment! :laugh: They are all far too big a subject to go...
4 Jul 2012 by tronPro
Hi there,I'm working on a small application which scans the HDDs and calculates the total space, free available space and the usage. I would now like to show the percentages of each part in a bar chart. Just like the bar chart from the Windows resource monitor (Example)Any known librays...
5 Jul 2012 by kornakar
Check out the Microsoft Charting library[^]. It has 100% Stacked Bar Chart type: http://msdn.microsoft.com/en-us/library/dd489229.aspx[^]
24 Dec 2012 by haitrieu749
My Graphic Card: Intel (R) 82945G Express Chipset Family (256Mb) and it's not run on Hidef Profile in XNA 4.0. I want to upgrade my Graphic Card by a cheap Graphic card but do not know it is appropriate for this profile?? Can you tell me the list of Graphic cards support HiDef Profile in XNA4.0?
30 Apr 2013 by Vishvesh Roach
minimum requirement is a "DirectX 10" compatible gpu.....any gpu other than "intel" can run HiDef Profile
6 Mar 2012 by ssiidd
Hey everyone,Im trying to implement a tiling algorithm in C#. I'm having a couple of issues,my approach is to take the size of a grid m x m as input, and then draw the grid using DrawRectangles method on my graphics object. the user then selects a tile around which the grid gets tiled.My...
6 Mar 2012 by Pete O'Hanlon
As you are instantiating a rectangle and then drawing it immediately, there doesn't seem any reason for your code to be actually storing an array of rectangles. The simple way for you to draw the rectangle there is to simply replace the inner part of your loop with:g.DrawRectangle(myPen, new...
30 Sep 2012 by saniaali
How to create tiles grid background in gdi+ where i can draw shapes or do other stuff on it..it would be my application 's surface design and and use scrolling feature ??????? As I am new to GDI+ so kindly gives some guidelinei have have created this function now i want to set this design as...
30 Sep 2012 by Sergey Alexandrovich Kryukov
For a form graphics rendering, override the method OnPaint and call your rendering method in it:protected void OnPaint(PaintEventArgs e) { int row = // ??? int column = // ??? int width = // I have no idea how you calculate those, but this is something // depending...
21 Jan 2015 by Member 11393012
Hi all,I'm relatively new to C# and very new to C# graphics and am trying to produce a graphical output for some optimisation routines I'm experimenting with (I'm a bit more experienced in mathematics). Trying to work this out with Google has been frustrating - have had little success and am...
21 Jan 2015 by George Jonsson
I think you can get some good information here:Professional C# - Graphics with GDI+[^]And maybe here:http://bobpowell.net/beginnersgdi.aspx[^]
10 Jul 2015 by Zamrony P. Juhara
Get started with OpenGL ES 2.0 shader programming on Android
23 Jan 2010 by moroshko
Hi,I write a program that resize pictures like this: Image originalImage = Image.FromFile(pathToOriginalPicture); Bitmap b = new Bitmap(newWidth, newHeight); Graphics g = Graphics.FromImage(b); g.DrawImage(originalImage, 0, 0, newWidth, newHeight); ...
23 Jan 2010 by Toli Cuturicu
In the first place, why should you "resize" an image to the same size?Anyway... I understand that the image you have is a jpeg. Opening and resaving a jpeg is almost always losing quality.You should really use png instead.Secondly, ppi, dpi or whatever is not important. This is not...
23 Jan 2010 by Toli Cuturicu
And, if you really have to keep it jpeg, take a look at http://en.wikipedia.org/wiki/JPEG#Lossless_editingSo, you can rotate, crop (and similar), but sadly, it does not say anything about resizing.
23 Jan 2010 by Toli Cuturicu
By the way, if you only need a thumbnail, use GetThumbnailImage.See an example here.
23 Jan 2010 by Christian Graus
I deleted the 'answer' you posted because it was really just restating the question. Edit your post for that.moroshko wrote:I've noticed that even if the picture size decreases a little, the file size decreases very much. I just want to understand why.You were told why. JPEG is...
18 May 2010 by xspitfirexx
Is it possible in C++ builder to use a monochrome bitmap as a transparency mask? I know builder has transparency feature, but I want some places to be more transparent than others.Thank you, Daniel :)
19 May 2010 by Sauro Viti
I'm not experienced on C++ builder, however transparency features are usually implemented basing on the underlying OS support.Microsoft Windows could handle transparency in two ways:thru GDI, by setting a specific RGB color as transparent. This way each pixel of the given color is...
4 Oct 2017 by CMalcheski
Thinking outside the box can result in critical performance gains
22 May 2011 by Tarun Mangukiya
This project shows user how to create a screen saver Bubbles (Windows 7) in VB.NET.
24 Mar 2014 by Vahid Yousefzadeh
- Building a CAD program in WPF:I want to build a CAD program that will have 10000 LINE objects at a time. I'm using LineGeomery class for drawing lines that are added to a Canvas. I have implemented Zoom and Pan and the performance is great so far.Only one major disappointment:The...
1 May 2013 by Dmitriy Glushchikov
This article describes a simple way to build an oriented graph using controls.
21 Apr 2013 by Ibrahim Sefa
Hello, I am making my master degree in Computer Enginnering, My lecturer wanted me to compare the codes between jezzball and ice hockey about ball movement. I found the source codes of ice hockey but I did not found the jezzball, If anyone can help me,I'll be so pleased. The game should be in...
21 Apr 2013 by Matthew Faithfull
Look here[^] for a number of links to Jezzball clones. The Open Source ones should provide you with code to get your ice hockey comparison.
2 May 2011 by Sendian
When i create drawing on panel .. if i minimize and maximize the form, drawing will be erased how can i prevent clear drawingi test flush(), and dispose()-----------private void button1_Click(object sender, EventArgs e){ priceValue(); Diagrams f2 = new Diagrams();...
2 May 2011 by Olivier Levrey
Handle the Paint event for your panel, and put all your drawing code inside that handler.public Form1(){ InitializeComponent(); //handle the Paint event for the panel panel1.Paint += (sender, e) => { //put you drawing code here //and use...
2 May 2011 by Sergey Alexandrovich Kryukov
Addition to the answer by Olivier:If lambda cannot be used (because of v.2.0), use anonymous without lambda. It will have almost all the benefits of lambda, only parameters type should be explicitly specified:panel1.Paint += delegate(object sender, System.EventArgs eventArgs){ ...
10 Apr 2014 by FarhanShariff
I have a chart it looks like this http://imgur.com/XoeCnvOI want to change Y axis numbering and label it 1% 10% 33.% etc as shown below with out changing the plot.How do I change itRequired output graph:http://imgur.com/fJ6bQzk
15 Apr 2014 by FarhanShariff
CustomLabel label1 = new CustomLabel { FromPosition = y1,//position on axis. ToPosition = y2, Text = "Y%"//value desired };
29 Nov 2014 by Umut Comlekcioglu
Hi everyone,I'm developing new software for me. But I have a little problem. When I wanna get the String Width, already I use that code;float aa = pe.Graphics.MeasureString("PROGRAMMING", Font).Width;But this value is not correct. When I test that line with that...
29 Nov 2014 by DamithSL
try with TextRenderer.MeasureText Method[^] sample code : String text1 = "Measure this text"; Font arialBold = new Font("Arial", 12.0F); Size textSize = TextRenderer.MeasureText(text1, arialBold); TextRenderer.DrawText(e.Graphics, text1, arialBold, new...
29 Nov 2014 by BillWoodruff
Using the default 'MeasureString and 'DrawString: leading-space and trailing-space may be automatically added when the string is rendered:"The MeasureString method is designed for use with individual strings and includes a small amount of extra space before and after the string to allow for...
31 Aug 2011 by steersteer
I would like to know the C# (Code-behind) equivalent of the following XAML code. Please Help.
31 Aug 2011 by #realJSOP
Why can't you work it out yourself? You have everything required to figure it out right in front of you. Intellisense will help you, too.EDIT ======================Google helps too:MSDN - Sample that shows how to create a transform programatically[^]It should be equally easy to...
6 Nov 2010 by Member 1712314
Hi All,I need a C# graphics programming book that explains how to obtain the intersection curve between two 3D surface.Could you advise me a comprehensive book.Regards,
6 Nov 2010 by Paul Michalik
1. Obtaining an intersection curve between two 3D surfaces has nothing to do with C# and also nothing to do with graphics programming. Hence nobody will be able to recommend you a book which "explains" this because such a book has not yet been written :) 2. The perfect solution to the...
20 Nov 2013 by Sicppy
Picture boxes have the option to choose the picture mode in the properties, one of these modes is zoom mode, how do I achieve that same zoom mode effect with a graphics object?Regards,Jordan
20 Nov 2013 by Sergey Alexandrovich Kryukov
Even if you do just the zoom, or anything else beyond showing static picture in PictureBox, this is a clear indicator that you should throw off this nearly pointless control and render graphics by yourself, which would be much easier. In such cases, PictureBox could be used, but it will only eat...
20 Nov 2013 by BillWoodruff
There are hundreds of thousands of .NET programmers that use the PictureBox Control, and there is nothing wrong with it. WPF offers much more functionality for "clean" scaling of vectors, or bitmaps, than WinForms which uses the older GDI+ graphics engine.If you are working with an animated...
16 Mar 2012 by Haris
Hi everyone,I am trying to implement a graph in C#. I downloaded the ZedGraph library and tryed to figure out a way to implement the requirements but already got stuck when trying to plott a Normal Distribution (bell curve).The requirements are following:I need to be able to plott a...
16 Mar 2012 by Clifford Nelson
Maybe you should not be trying to use a general purpose library, they usually are oriented towards business grahics. You can manually do it in WinForms or WPF. Both support drawing lines. In WPF you can use the canvas, and draw lines on the canvas:...
16 Aug 2013 by Umut Comlekcioglu
Hi all,I want to make Reflection Effect on my control. I found some resource for it.1-) Basic Illumination Model in C#[^]2-) http://unitycoder.com/blog/2013/04/07/basic-illumination-model-c/[^]I want to make control on above link. I wonder, How can do this? Thanks for answer.