Generate Staff Card

This is no problem at all using C# and GDI+ Here is the short version: Create a Bitmap of the right size and resolution Measure the coordinates of the images and text you want to have on it Pull the data from your database Use Graphics.DrawImage and Graphics.DrawString to create the graphics Save in a … Read more

Scaling/Translating a Shape to a given Rectangle using AffineTransform

Note that AffineTransform transformations are concatenated “in the most commonly useful way”, which may be regarded as last in, first-out order. The effect can be seen in this example. Given the sequence below, the resulting Shape is first rotated, then scaled and finally translated. at.translate(SIZE/2, SIZE/2); at.scale(60, 60); at.rotate(Math.PI/4); return at.createTransformedShape(…);

How can I make the xtick labels of a plot be simple drawings using matplotlib?

I would remove the tick labels and replace the text with patches. Here is a brief example of performing this task: import matplotlib.pyplot as plt import matplotlib.patches as patches # define where to put symbols vertically TICKYPOS = -.6 fig = plt.figure() ax = fig.add_subplot(111) ax.plot(range(10)) # set ticks where your images will be ax.get_xaxis().set_ticks([2,4,6,8]) … Read more

How to Change Pixel Color of an Image in C#.NET

Here is the Solution I have done with Pixels. Attaching the source code so one can try the exact and get the result. I have sample images of 128×128 (Width x Height). using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.IO; //using System.Globalization; namespace colorchange { class Program { static void Main(string[] … Read more

How to know if a line intersects a rectangle

public static bool LineIntersectsRect(Point p1, Point p2, Rectangle r) { return LineIntersectsLine(p1, p2, new Point(r.X, r.Y), new Point(r.X + r.Width, r.Y)) || LineIntersectsLine(p1, p2, new Point(r.X + r.Width, r.Y), new Point(r.X + r.Width, r.Y + r.Height)) || LineIntersectsLine(p1, p2, new Point(r.X + r.Width, r.Y + r.Height), new Point(r.X, r.Y + r.Height)) || LineIntersectsLine(p1, p2, new … Read more

Draw another image on a UIImage

You could add a subview to your UIImageView containing another image with the small filled triangle. Or you could draw inside of the first image: CGFloat width, height; UIImage *inputImage; // input image to be composited over new image as example // create a new bitmap image context at the device resolution (retina/non-retina) UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), … Read more