我刚刚完成了我的相机活动,它可以很好地保存数据.拍摄照片后我做了什么:
protected void savePictureData() {
try {
FileOutputStream fs = new FileOutputStream(this.photo);
fs.write(this.lastCamData);
fs.close(); //okay, wonderful! file is just written to the sdcard
//---------------------
//---------------------
//TODO in here: dont save just the file but ROTATE the image and then save it!
//---------------------
//---------------------
Intent data = new Intent(); //just a simple intent returning some data...
data.putExtra("picture_name", this.fname);
data.putExtra("byte_data", this.lastCamData);
this.setResult(SAVED_TOOK_PICTURE, data);
this.finish();
} catch (IOException e) {
e.printStackTrace();
this.IOError();
}
}
Run Code Online (Sandbox Code Playgroud)
我想要的是已经在上面的代码中给出的评论.我不希望将图像保存到文件中,但要旋转然后保存!谢谢!
// 编辑:我目前正在做什么(工作但仍会遇到大图像的内存问题)
byte[] pictureBytes;
Bitmap thePicture = …
Run Code Online (Sandbox Code Playgroud) 我正在尝试用svg创建一个纸质纹理外观,我工作得相当好,使用透明覆盖层将纹理添加到它下面的svg项目的基本颜色上.
但是,我注意到纹理与SVG一起缩放.由于图像设置为页面的宽度,因此在大型显示器上它会变得极度拉伸并且看起来不太好.
是否可以自动获得svg资产比例,并使用固定大小的模式填充?
这是一个带有完整示例的codepen:http://codepen.io/mix3d/pen/jWMPQE
编辑:用实际的svg更新了codepen,而不是理论上的
如果SVG可以从中心填充填充平铺,则可以获得奖励积分.谢谢!
<svg version="1.1" id="paper_svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="10 0 1526 407.93">
<style type="text/css">
.overlay{fill:url(#img1);fill-opacity:1;}
.circle{fill:#62B4B8;}
</style>
<defs>
<pattern id="img1" patternUnits="userSpaceOnUse" width="243" height="201">
<image xlink:href="http://i.imgur.com/grtbkje.png" x="0" y="0" width="486" height="402" />
</pattern>
<filter id="f3" x="-40%" y="0" width="180%" height="400%">
<feOffset result="offOut" in="SourceAlpha" dx="0" dy="3" />
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="3" />
<feColorMatrix in="blurOut" result="transparency" type="matrix"
values="0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 .5 0"/> …
Run Code Online (Sandbox Code Playgroud) 我遇到一种情况,为了节省内存和加载,我尝试<image>
在 SVG 中重用单个标签,而不是在多个<image>
标签中引用相同的 xlink:href 。
我的研究表明,这<use>
是引用已定义对象的标签。
然而,当我尝试引用图像时,特别是在模式内部(这就是我想要做的),我什么也得不到,而使用图像标签效果很好。
我究竟做错了什么?这可能吗?我尝试搜索,但找不到<use>
带有图像的标签的任何示例,只有矩形、路径、组等。
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" viewBox="0 0 1024 600" >
<style type="text/css">
.fillme{fill:url(#tsmall)}
</style>
<defs>
<image id="texture" xlink:href="texture.tiny.png" />
<pattern id="tsmall" patternUnits="userSpaceOnUse" width="486" height="402">
<use xlink:href="#texture" x="0" y="0" width="486" height="402" />
</pattern>
<pattern id="tlarge" patternUnits="userSpaceOnUse" width="972" height="804">
<use xlink:href="#texture" x="0" y="0" width="972" height="804" />
</pattern>
</defs>
<rect x="0" y="0" width="1024" height="600" class="fillme"/>
</svg>
Run Code Online (Sandbox Code Playgroud) 我遇到了与这个问题相反的问题:在 SASS .scss 文件中,我希望注释命令 ( ctrl/? + /
, ctrl/? + K ctrl/? + C
) 默认为//
,并且/* ... */
仅在使用块注释 ( shift+alt+A
)时才使用块注释。
我一直无法通过用户设置甚至插件找到更改此设置的方法。是否可以?我的 google-fu 不好吗?
我有一个JSON字符串:
var Str="[{ 'label': 'Month'},{ label: 'within'},{ label: 'From'},
{ label: 'Where'},]";
Run Code Online (Sandbox Code Playgroud)
我通过eval将它转换为对象:
var tagString = eval(Str);
Run Code Online (Sandbox Code Playgroud)
我想得到没有循环的月份索引.
有没有更好的方法来获取数组中的对象的索引而不使用循环?
提前致谢!
我正在开发一个新的Android项目,而Retrofit2对我来说效果很好.但是,我需要在我发送的数据之上使用两个字符串中的一个来命中一个网址.
现在它看起来像这样:
@FormUrlEncoded
@POST("token")
Call<AccessResponse> requestAccess(@Field("grant_type") String type, @Field("code") String authCode, @Field("client_id") String ApiKey);
Run Code Online (Sandbox Code Playgroud)
授权类型只是两件事之一,我想把它抽象成静态网址,如下所示:
@FormUrlEncoded
@POST("token")
@Field("grant_type","type1")
Call<AccessResponse> requestAccess( @Field("code") String authCode, @Field("client_id") String ApiKey);
@FormUrlEncoded
@POST("token")
@Field("grant_type","type2")
Call<AccessResponse> refreshAccess( @Field("code") String authCode, @Field("client_id") String ApiKey);
Run Code Online (Sandbox Code Playgroud)
有没有办法实现这个目标?我2天的google-fu没有为我工作,也没有浏览API文档和代码.我只是不想在我的代码中的各个地方跟踪正确的字符串.
我正在尝试设置新的 Google 分析,并且我想GA_TRACKING_ID
通过我的单页应用程序的 config.js 进行更改,具体取决于它是在我们的开发服务器、登台服务器还是生产服务器上。
我们已经使用此配置文件来更改我们的应用程序点击的 API,并且可以gtag('config', app.config.analyticsCode);
在运行时设置配置,但是用于获取分析 js 文件的脚本似乎对请求中的 ID 进行了硬编码。<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
我应该用JS手动编写标签吗?我是否可以获取不带跟踪 ID 的脚本并使用该gtag()
命令对其进行初始化?我在 Gtag 开发文档网站上找不到执行此操作的方法。谢谢!