我正在开发安卓系统。我需要保存位图而不丢失质量。
我尝试过使用compress()位图方法,将质量设置为 100。这对我不起作用,位图损失了太多质量。我已经用 JPEG 和 PNG 格式进行了测试。
我已经测试过将位图复制到 a ByteBuffer,然后提取byte[]并使用FileOutputStream. 在这种情况下,我无法显示使用这种方式保存的图像,我只能看到一个空白页面。
我的问题是,有什么方法可以在不压缩的情况下将位图保存在SD卡中吗?
编辑:这是我的代码的一部分
public class MainActivity extends ActionBarActivity {
[...]
@Override
protected void onActivityResult(int reqCode, int resCode, Intent handler){
super.onActivityResult(reqCode, resCode, handler);
if(reqCode == CAPTURE_IDENTIFIER && resCode == Activity.RESULT_OK){
// THis is that I have tested.
// Object o = handler.getData();
// Object o2 = handler.getExtras().getParcelable("data");
// Object o3 = handler.getExtras().get("data");
// Object o4 = handler.getParcelableExtra("data");
//
prepareCapture();
startActivityForResult(cameraHandler, CAPTURE_IDENTIFIER);
}
}
private …Run Code Online (Sandbox Code Playgroud) 当我尝试在 Windows 10 中编译 DOSBox SVN Daum 时,我遇到了 VS2015 中显然新出现的与标头相关的问题。示例:
Severity Code Description Project File Line Suppression State
Error (active) the global scope has no "int_least8_t" dosbox c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstdint 23
Error C2039 'int_least8_t': is not a member of '`global namespace'' dosbox C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstdint 23
Run Code Online (Sandbox Code Playgroud)
我的搜索告诉我,此类问题已经发生在周围的项目中,但我无法解决它。
特别是,我阅读了VisualStudio 2015 RC Issue with Includes和https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/,然后更改了 AppData\Local 的内容\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props 到:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>D:\dev\include;$(UniversalCRT_IncludePath);$(IncludePath)</IncludePath> …Run Code Online (Sandbox Code Playgroud) 在 Laravel 中,每次运行网站时,
“设置名称'utf8'整理'utf8_unicode_ci'”
正在执行。
我怎样才能避免这种情况?而不是在代码中这样做。我们已经在数据库本身中进行了配置。如何删除数据库配置中的字符集和排序规则?
> config/database.php
>
> 'database' => [
> 'driver' => 'mysql',
> 'host' => env('DB_HOST', 'localhost'),
> 'port' => env('DB_PORT'),
> 'database' => env('DATABASE'),
> 'username' => env('DB_USERNAME', 'forge'),
> 'password' => env('DB_PASSWORD', ''),
> 'charset' => 'utf8', // Need to remove or make ''
> 'collation' => 'utf8_unicode_ci', // Need to remove or make ''
> 'prefix' => env('DB_PREFIX', ''),
> 'strict' => false, ],
Run Code Online (Sandbox Code Playgroud) 考虑一个场景,在这种情况下,我们react-native使用release模式构建应用程序,同时具有如下代码:
let img;
if ( __DEV__ ) {
img = require('./debug-image.png');
} else {
img = require('./real-image.png');
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,都将debug-image.png和real-image.png获得捆绑到APK(即使debug-image.png是从未使用过其他任何地方),还是所述捆绑检测该debug-image.png文件没有使用(不包括成捆)?
考虑有一个键和值映射对象,如下所示:
export const PlaceholderVisibility = {
Always: undefined,
Never: null,
OnFocus: true,
OnBlur: false
}
Run Code Online (Sandbox Code Playgroud)
您将如何使用PropTypes仅允许现有对象中指定的值?
这是我尝试过的:
import PropTypes from 'prop-types';
export const myTypes = {
// ...
visibility: PropTypes.oneOf(PlaceholderVisibility)
}
Run Code Online (Sandbox Code Playgroud)
但我目前正在使用,PropTypes.bool因为这似乎适用于这种情况,但是当例如其中一个值是字符串类型时,这仍然不起作用。
对于Angular 8到9的更新,我是按照官方文档进行升级的。
这建议首先更新到最新版本的 Angular 8,例如:
ng update @angular/core@8 @angular/cli@8
但是,我收到三个警告(全部相同):
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.16.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN ngx-multi-window@0.3.2 requires a peer of @angular/common@^6.0.0-rc.0 || ^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-multi-window@0.3.2 requires …Run Code Online (Sandbox Code Playgroud) \n\n(正如在下面的上下文中所说,我的客户已经有一个,我还需要一个付费帐户吗?)
\n
expo build:ios并得到了You have no team associated with your Apple account, cannot proceed.世博输出:
\nreto@Retos-Mac-mini test1 % expo build:ios\n\xe2\x9c\x94 Choose the build type you would like: \xe2\x80\xba archive\n\nChecking if there …Run Code Online (Sandbox Code Playgroud) 使用 phpstan/larastan 分析代码时如何处理 Laravel 中的范围?
我收到此错误:
Call to an undefined method Illuminate\Database\Eloquent\Builder::active().
Run Code Online (Sandbox Code Playgroud)
我需要以某种方式输入提示吗?
我试图避免@phpstan-ignore-next-line
值得一提的是,仅当我在作用域内使用作用域时才会出现上述错误。在其他情况下,成功LaraStan阻止PhpStan警告。
__cplusplus包含和扩展到什么?__cplusplus即使在最旧的C++实现中,宏总是包含并扩展为数值吗?#if __cplusplus
还是我们应该使用而不是那样#ifdef __cplusplus?为什么Jest在简单的导入语句中显示“意外令牌*”失败...
Admin@Admin-PC MINGW32 /d/project (master)
$ npm run test
> MyApp@0.0.1 test D:\project
> jest
FAIL __tests__/App-test.tsx
? Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your …Run Code Online (Sandbox Code Playgroud)