transform

How can I render a square bitmap to an arbitrary four-sided polygon using GDI?

与世无争的帅哥 提交于 2019-12-29 03:38:05
问题 I need to paint a square image, mapped or transformed to an unknown-at-compile-time four-sided polygon. How can I do this? Longer explanation The specific problem is rendering a map tile with a non-rectangular map projection. Suppose I have the following tile: and I know the four corner points need to be here: Given that, I would like to get the following output: The square tile may be: Rotated; and/or Be narrower at one end than at the other. I think the second item means this requires a non

iPhone上关于相机拍照的图片的imageOrientation的问题

ぐ巨炮叔叔 提交于 2019-12-29 00:23:31
用相机拍摄出来的照片含有EXIF信息,UIImage的imageOrientation属性指的就是EXIF中的orientation信息。 如果我们忽略orientation信息,而直接对照片进行像素处理或者drawInRect等操作,得到的结果是翻转或者旋转90之后的样子。这是因为我们执行像素处理或者drawInRect等操作之后,imageOrientaion信息被删除了,imageOrientaion被重设为0,造成照片内容和imageOrientaion不匹配。 所以,在对照片进行处理之前,先将照片旋转到正确的方向,并且返回的imageOrientaion为0。 下面这个方法就是一个UIImage category中的方法,用它可以达到以上目的。 - (UIImage *)fixOrientation:(UIImage *)aImage { // No-op if the orientation is already correct if (aImage.imageOrientation == UIImageOrientationUp) return aImage; // We need to calculate the proper transformation to make the image upright. // We do it in 2 steps:

如何处理iOS中照片的方向

假装没事ソ 提交于 2019-12-29 00:22:04
使用过iPhone或者iPad的朋友在拍照时不知是否遇到过这样的问题,将设备中的照片导出到Windows上时,经常发现导出的照片方向会有问题,要么横着,要么颠倒着,需要旋转才适合观看。而如果直接在这些设备上浏览时,照片会始终显示正确的方向,在Mac上也能正确显示。最近在iOS的开发中也遇到了同样的问题,将拍摄的照片上传到服务器后,再由Windows端下载该照片,发现手机上完全正常的照片到了这里显示的横七竖八。同一张照片为什么在不同的设备上表现的不同?如何能够避免这种情况?本文将和大家一一解开这些问题。 目录 照片的存储演变 胶片时代 数码时代 方向传感器 EXIF(Exchangeable Image File Format) Orientation iPhone上的情况 验证EXIF Mac平台 Windows平台 开发时如何避免 直观的解决方案 第二种简单的方法 结尾 照片的存储演变 一切都得从相机的发展开始说起。 胶片时代 一般相机拍摄出来的画面都是长方形,在拍摄的那一瞬间,它会将取景器中的场景对应的颜色值存到对应的像素位置。相机本身并没有任何方向的概念,只是使用者想要拍摄的场景在他期望的照片中显示的方式与实际存在差异时,才有了方向一说。如下图,对一个场景 F 进行拍摄,相机的方向可能会有这样四个常见的角度: 相机是“自私”的,由于相机仅反应真实的场景,它不理解拍摄的内容

HTML5音乐播放器

半腔热情 提交于 2019-12-28 23:31:11
<!--音乐播放器--> <div style="position:absolute; top:10px; right:10px; z-index:10000;"> <audio preload="load" id="mmm" src="{:CUSTOM_TEMPLATE_PATH}Index/ColorV5/bg.mp3"></audio> <img style="width:35px;height:35px;" src="{:CUSTOM_TEMPLATE_PATH}Index/ColorV5/images/music.png" id="img" class="image" onclick="timeout ? stopAnim() : startAnim()" /> </div> <script type="text/javascript"> var timeout, rotate = 0; function startAnim() { var Media = document.getElementById("mmm"); timeout = setInterval(function () { var img = document.getElementById("img"); var rotateStyle = "rotate(" + rotate + "deg)"; img

how to transform comma separated column into multiples rows in db2

爱⌒轻易说出口 提交于 2019-12-28 18:43:41
问题 I have the following table (the number of the references is variable): Id | FK_ID| Reference | ----------------------- 1 2100 GI2, GI32 2 2344 GI56 And I need the following result: Id | FK_ID| Reference | ----------------------- 1 2100 GI2 2 2100 GI32 3 2344 GI56 Is there any short way to transform the data like this using DB2? 回答1: You really should not be storing data like this. Fortunately, there is a way to undo the damage with recursive SQL, something along these lines: WITH unpivot (lvl

自用CSS基础笔记-①入门知识

匆匆过客 提交于 2019-12-28 08:42:21
CSS优化界面 CSS选择器:(C3) ①id选择器②类选择器③标签选择器 ④通配符选择器⑤伪类选择器:(链接伪类a:link/visited/hover/active,结构伪类E:frist-child/E:last-child/E:nth-child(n),目标伪类:target) ⑥复合选择器 ⒈交集选择器[既标签又类名,连写] ⒉并集选择器[逗号] ⒊后代选择器[空格] ⒋子元素选择器[>] ⑦属性选择器 ⑴E[attr] (attr是属性值) ⑵E[attr=val](全等) ⑶E[attr^=val](属性值以val开头)⑷E[attr$=val](属性值以val结尾)⑸E[attr*=val](任意位置包含val) ⑧伪元素选择器:: E::frist-letter,E::frist-line,E::selection,E::before,E::after。(前/后添加content)类选择、伪类选择器就是选取对象,而伪元素选择器本质是插入一个行内元素(盒子)审查不到标签却能显示盒模型,要伪元素不占位要用绝对定位。 CSS简写: ①background:url(images/x.png) no-repeat fixed center -25px,url(images/x.png) no-repeat scroll center -25px #000;颜色最后加

D3.js animate rotation

…衆ロ難τιáo~ 提交于 2019-12-28 08:39:26
问题 I'm having trouble when I try to correctly execute a rotation animation using the D3.js library. The problem has to do with the point at which I want to rotate the element about. Here is a fiddle I made to show what I mean (in slow motion): http://jsfiddle.net/74mCb/ It seems like the source of the problem lies here: .attr("transform", "rotate(-60, 150,130)"); And then I rotate it like so: .attr("transform", "rotate(40 150,130)"); I would like the butt of the needle to stay in position (to be

CSS3扑克旋转

本小妞迷上赌 提交于 2019-12-28 07:21:35
用css3写的一个小demo——鼠标移动带扑克牌,扑克牌旋转铺开!图片和代码在下边 铺开的话有点小问题,感兴趣的可以自己改动一下 附上源码及图片 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>旋转扑克</title> <style> *{ margin: 0; padding: 0; } div.box{ width: 120px; height: 165px; position: relative; margin: 100px auto; /* overflow: hidden; */ } div.box div{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform-origin: 0 bottom; transition: all .4s ease-in-out; background: url('img/timg.jpg')no-repeat;

Getting Screen Positions of D3 Nodes After Transform

懵懂的女人 提交于 2019-12-28 05:05:07
问题 I'm trying to get the screen position of a node after the layout has been transformed by d3.behavior.zoom() but I'm not having much luck. How might I go about getting a node's actual position in the window after translating and scaling the layout? mouseOver = function(node) { screenX = magic(node.x); // Need a magic function to transform node screenY = magic(node.y); // positions into screen coordinates. }; Any guidance would be appreciated. EDIT: 'node' above is a force layout node, so it's

CSS transform 3D 变形

删除回忆录丶 提交于 2019-12-27 18:12:34
ife_设计师 No.4 - 3D 空间的卡片翻转动效 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> div { position : relative ; margin : 100px auto ; width : 300px ; height : 400px ; } div img { position : absolute ; left : 0 ; top : 0 ; backface-visibility : hidden ; /*定义元素在不面对屏幕时不可见。*/ transition : transform 2s ; -moz-transition : -moz-transform 2s ; /* Firefox 4 */ -webkit-transition : -webkit-transform 2s ; /* Safari 和 Chrome */ -o-transition : -o-transform 2s ; /* Opera */ } div .img2 { transform : rotateY ( -180deg ) ; -ms-transform : rotateY ( -180deg ) ; /* IE 9 */