graphics

How to do the astronomical symbol “\sun” in PyX

倖福魔咒の 提交于 2020-01-04 02:12:11
问题 I've been trying to put the astronomical symbol of the sun on a graph using PyX, but so for with no success. The code I have is the following: from pyx import * from pylab import * x=arange(1,5,0.1) y=exp(-(x-3.0)**2/(2.0*0.5**2))/sqrt(2.0*pi*0.5**2) ###################### g=graph.graphxy(width=8,y=graph.axis.linear(title=r"Fraction of DM halos"),x=graph.axis.linear(min=1,title=r"Mass ($10^{11}M_{\sun}$)")) g.plot(graph.data.values(x=x,y=y),styles=[graph.style.histogram()]) g.writeEPSfile(

How to create Bitmap object from a Graphics object?

佐手、 提交于 2020-01-04 01:05:53
问题 How to create Bitmap object from a Graphics object ? I would like to read pixels from my Graphics object. for example, like, System.Drawing.BitMap.GetPixel(). I am trying to find out empty area (all white, or of any colour) inside a pdf document, to write some graphics / image. I have tried like this, but it is not working. why the following code is not working as expected ? // // System.Drawing.Bitmap // System.Drawing.Graphics // Bitmap b = new Bitmap(width, height, graphics); // // In this

Moving Shapes along an arc path with java graphics

核能气质少年 提交于 2020-01-03 23:06:55
问题 Pardon my naivety, its my first time here and first time dealing with animation of graphics in java. I'm trying to accomplish an animation of star shapes that moves along a sort of arc(trying to simulate an orbit on a 2d wise). The orbit Action is used with a Timer to animate the stars. Simply put, I have drawn several stars at various positions in a jpanel. The translation of the stars y position depends on how far that star is away from the the x axis of decline which is initialized to 300

country-labels on spplot()

不打扰是莪最后的温柔 提交于 2020-01-03 19:33:40
问题 I'd like to add name-labels for regions on an spplot(). Example: load(url('http://gadm.org/data/rda/FRA_adm0.RData')) FR <- gadm FR <- spChFIDs(FR, paste("FR", rownames(FR), sep = "_")) load(url('http://gadm.org/data/rda/CHE_adm0.RData')) SW <- gadm SW <- spChFIDs(SW, paste("SW", rownames(SW), sep = "_")) load(url('http://gadm.org/data/rda/DEU_adm0.RData')) GE <- gadm GE <- spChFIDs(GE, paste("GE", rownames(GE), sep = "_")) df <- rbind(FR, SW, GE) ## working plot(df) text

How do I draw the outline of an object in Qt3D?

落爺英雄遲暮 提交于 2020-01-03 19:15:29
问题 How can I draw the outline of an object on top of any other object in Qt3D? For instance to highlight a selected object in a 3D editor? 回答1: If you want to draw the outline of an entity at all times, even if the entity is behind other entities, one solution is to do it in two steps: Draw everything as normal. Draw only the outline of the selected object. When drawing the outline, you need to use an outline effect, which can be implemented in two render passes: Render the geometry to a texture

Easiest way to combine several PNG8 images in .NET

江枫思渺然 提交于 2020-01-03 17:36:34
问题 I'm trying to combine a bunch of 8-bit PNG images into a larger PNG image in C#. Oddly enough, this seems to be particularly difficult. Since Graphics does not support indexed color, you can't use that, so I tried building a non-indexed Bitmap (using Graphics) and converting that to indexed color bitmap. The conversion is fine, but I can't figure out how to set the palette of the output image. It defaults to some pre-defined palette which has little to do with what I'm looking for. So: Is

Painting Japanese characters using Arial fonts with method drawString(..) (Graphics2D)

别说谁变了你拦得住时间么 提交于 2020-01-03 13:08:33
问题 A String can be painted like that: @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); try { g2d.setColor(Color.BLACK); g2d.setFont(new Font("Serif", Font.PLAIN, 12));//Japanese characters are visible //g2d.setFont(new Font("Arial", Font.PLAIN, 12));//Japanese characters are not visible (squares only) g2d.drawString("Berryz工房 『ROCKエロティック』(Berryz Kobo[Erotic ROCK]) (MV)", 10, 45); } finally { g2d.dispose(); } } The problem is

Painting Japanese characters using Arial fonts with method drawString(..) (Graphics2D)

痴心易碎 提交于 2020-01-03 13:07:14
问题 A String can be painted like that: @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); try { g2d.setColor(Color.BLACK); g2d.setFont(new Font("Serif", Font.PLAIN, 12));//Japanese characters are visible //g2d.setFont(new Font("Arial", Font.PLAIN, 12));//Japanese characters are not visible (squares only) g2d.drawString("Berryz工房 『ROCKエロティック』(Berryz Kobo[Erotic ROCK]) (MV)", 10, 45); } finally { g2d.dispose(); } } The problem is

Animate rotating SVG element on webpage

孤人 提交于 2020-01-03 11:28:13
问题 So I have an SVG file created in Inkscape embedded in a webpage, and I'd like it to rotate slowly. I've tried using Javascript and inserting animation commands directly into the SVG, but nothing works. I don't want to load in an entire JS library for this one task. This is what I have so far: <html> <body bgcolor="#333333"> <embed src="gear.svg" id="gear" width="1000" height="1000" style="position: absolute; top: -500px; left: -500px;" /> <script type="text/javascript"> var gear = document

CSG operations on implicit surfaces with marching cubes

不想你离开。 提交于 2020-01-03 08:42:28
问题 I render isosurfaces with marching cubes, (or perhaps marching squares as this is 2D) and I want to do set operations like set difference, intersection and union. I thought this was easy to implement, by simply choosing between two vertex scalars from two different implicit surfaces, but it is not. For my initial testing, I tried with two spheres circles, and the set operation difference . i.e A - B. One circle is moving and the other one is stationary. Here's the approach I tried when