clip

HTML Canvas clip and putImageData

本秂侑毒 提交于 2019-12-03 22:33:03
问题 I have a canvas with a large image in the background and a smaller round image in front of it. I achieved this round image effect by using clip like so ctx.save(); ctx.beginPath(); ctx.arc(x,y,r,0,Math.PI*2, true); ctx.closePath(); ctx.clip(); ctx.drawImage(img,x-r,y-r,2*r,2*r); // draw the image ctx.restore(); then I want to rotate the round image, so I use a second context and rotate and redraw like so backCanvas=document.createElement('canvas'); backContext=backCanvas.getContext('2d');

Clipping a border in WPF

不羁岁月 提交于 2019-12-03 14:21:07
I need to create a round ProgressBar template. ControlTemplate : <ControlTemplate TargetType="{x:Type ProgressBar}"> <Grid x:Name="TemplateRoot" SnapsToDevicePixels="true"> <Rectangle x:Name="PART_Track" Margin="1" Fill="White" /> <Border x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="1" > <Grid x:Name="Foreground" > <Rectangle x:Name="Indicator" Fill="{TemplateBinding Background}" /> <Grid x:Name="Animation" ClipToBounds="true" > <Rectangle x:Name="PART_GlowRect" Fill="#FF86C7EB" HorizontalAlignment="Left" Margin="-100,0,0,0" Width="100"/> </Grid> </Grid> </Border> <Border x:Name=

Is there an inverse to the CSS “Clip” property; hide the clipped area?

孤人 提交于 2019-12-03 11:27:41
The CSS clip syntax gets you to define a rectangular area of a larger image that you wish to be visible. Is there a way to specify the inverse? Specify the rectangular area of the image that you wish to become invisible. Like punching a rectangular hole through the page to see what's underneath? Reason (if you have any other ideas): I want to create a 3 layer image in a CMS template. Layer 1 (at the bottom) is a background image. Layer 2 sits over a portion of layer 1 and is a rectangular screengrab image of an A4 document. Layer 3 (on the top) is a transparent PNG (in its centre and at its

Android Drag and Drop getClipData returns always null

岁酱吖の 提交于 2019-12-03 05:59:49
I am designing a drag and drop operation but I don't know how to access my data. Has anyone experience with Clip Data objects? Here is my code: Starting the drag and drop: ClipData dragData= ClipData.newPlainText("my", "test") ); v.startDrag(dragData, new MyDragShadowBuilder(v), v, 0); Listening on the events: case DragEvent.ACTION_DROP:{ if (event.getClipDescription().getLabel().equals("my")) Log.d("myLog","Data:"+event.getClipData()+" "+event.getClipData().getItemCount()); not in every drag event can get the clip data, but some of them, such as ACTION_DROP type dropableCanvas

Pythonic way to replace list values with upper and lower bound (clamping, clipping, thresholding)?

丶灬走出姿态 提交于 2019-12-03 04:44:41
I want to replace outliners from a list. Therefore I define a upper and lower bound. Now every value above upper_bound and under lower_bound is replaced with the bound value. My approach was to do this in two steps using a numpy array. Now I wonder if it's possible to do this in one step, as I guess it could improve performance and readability. Is there a shorter way to do this? import numpy as np lowerBound, upperBound = 3, 7 arr = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) arr[arr > upperBound] = upperBound arr[arr < lowerBound] = lowerBound # [3 3 3 3 4 5 6 7 7 7] print(arr) You can use numpy

Java clip not working

牧云@^-^@ 提交于 2019-12-02 23:39:30
问题 Can someone please help me understand why this code below doesn't work? I start the clip by calling method start() . This method creates a new thread for the clip to run. However, no it doesn't seem to play anything. The code is compiled without any error... public class Audio { private Clip clip; private Thread thread; public Audio (String audioFile) { AudioInputStream audioStream = null; URL audioURL = this.getClass().getClassLoader().getResource(audioFile); // Obtain audio input stream

How to clip WorldMap with polygon in R?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 18:34:37
I have imported a world map dataset from www.GADM.org using the R package raster. I would like to clip it to a polygon I create to reduce the size of the map. I can retrieve the data and I can create the polygon no problem, but when I use the 'gIntersection' command I get an obscure error message. Any suggestions on how to clip my World Map dataset? library(raster) library(rgeos) ## Download Map of the World ## WorldMap <- getData('countries') ## Create the clipping polygon clip.extent <- as(extent(-20, 40, 30, 72), "SpatialPolygons") proj4string(clip.extent) <- CRS(proj4string(WorldMap)) ##

Java clip not working

 ̄綄美尐妖づ 提交于 2019-12-02 13:37:36
Can someone please help me understand why this code below doesn't work? I start the clip by calling method start() . This method creates a new thread for the clip to run. However, no it doesn't seem to play anything. The code is compiled without any error... public class Audio { private Clip clip; private Thread thread; public Audio (String audioFile) { AudioInputStream audioStream = null; URL audioURL = this.getClass().getClassLoader().getResource(audioFile); // Obtain audio input stream from the audio file and load the information // into main memory using the URL path retrieved from above.

Audio does not play in Jar but does in eclipse

时光总嘲笑我的痴心妄想 提交于 2019-12-02 10:17:18
Sound does not play when I run the JAR, but it does when I run it in eclipse. Here is where I load the clips: public void init(){ System.out.println("grabbing Music"); String currentDir = new File("").getAbsolutePath(); name=new File(currentDir+"\\music\\").list(); clip=new Clip[name.length]; soundFile=new File[name.length]; for(int x=0;x<name.length;x++){ System.out.println(currentDir+"\\music\\"+name[x]); try { soundFile[x]= new File(currentDir+"\\music\\"+name[x]); AudioInputStream sound = AudioSystem.getAudioInputStream(soundFile[x]); DataLine.Info info= new DataLine.Info(Clip.class, sound

UWP - Prevent NavigationViewItemHeader from being clipped

我的未来我决定 提交于 2019-12-02 03:38:33
问题 I am writing a UWP app that has a NavigationView containing NavigationViewItemHeader s: <NavigationView.MenuItems> <NavigationViewItem Content="Home" Tag="home"> <NavigationViewItem.Icon> <FontIcon Glyph=""/> </NavigationViewItem.Icon> </NavigationViewItem> <NavigationViewItemSeparator/> <NavigationViewItemHeader x:Name="ThemesHeading" Content="Themes"/> <NavigationViewItem Content="Themes" Tag="themes"> <NavigationViewItem.Icon> <FontIcon Glyph=""/> </NavigationViewItem.Icon> <