简体   繁体   English

在这种情况下,仅调整图像大小(png)时,BitmapFactory真的必要吗?

[英]Is BitmapFactory really necessary when it comes to only resizing images (png) in this scenario?

I'm trying to use code from this answer(the 1st one, the highest rated one): 我正在尝试使用此答案中的代码(第一个,评分最高的一个):

Android - combine multiple images into one ImageView Android-将多个图像合并为一个ImageView

After reading extensively the code I found out that the code was using BitmapFactory extensively. 大量阅读代码后,我发现该代码广泛使用BitmapFactory。

I'm trying to integrate the code into a performance-priority project, and bitmap left me with the impression of being rather taxing on processors, which isn't really something I'm pleased with. 我正在尝试将代码集成到性能优先项目中,而位图给我留下的印象是相当费力处理器,这并不是我真正满意的事情。 I don't want this new part of the code slow everything down noticeably. 我不希望代码的这一新部分显着降低所有速度。

My code is already capable of resizing pngs, so I'm guessing either one of the following is likely be the case of the original author's application of BitmapFactory: 我的代码已经能够调整png的大小,因此我猜测以下任何一种可能是原始作者应用BitmapFactory的情况:

  1. resizing pngs uses bitmap processing by default, just because I (author of this question, not of the code IN this question) did not explicitly call relevant functions doesn't mean it hasn't gotten actively involved; 调整png的大小默认情况下使用位图处理,只是因为我(本问题的作者,而不是本问题中的代码的作者)未明确调用相关函数并不意味着未积极参与其中。

  2. The code also features capability of cutting and reshaping images so that is exclusively the part that needs BitmapFactory, BitmapFactory isn't really necessary if nothing beyond resizing is required. 该代码还具有剪切和重塑图像的功能,因此仅是需要BitmapFactory的部分,如果不需要调整大小,则不需要BitmapFactory。

  3. The code's primary function is to combine multiple images inside a single imageView so to have that, BitmapFactory is instrumental in achieve just that (I've read the code but couldn't find enough evidence to support this assumption). 该代码的主要功能是在一个imageView中合并多个图像,以使BitmapFactory能够实现这一目的(我已经阅读了代码,但找不到足够的证据来支持这一假设)。

I need expert answer - a simple yes or no followed by clear elaboration. 我需要专家的答案-简单的是或否,然后进行详细说明。 Thanks in advance. 提前致谢。 You are of course, welcome to point out my lapse of judgement when claiming that bitmap slows things down. 当然,欢迎您指出我的判断力,声称位图会使事情变慢。

To answer my own question: 要回答我自己的问题:

In this particular scenario, unfortunately I need to use bitmap to "map" (no pun intended) my target image, and then resize it and put it into the same ImageView with other images that went through the identical steps. 在这种特殊情况下,不幸的是,我需要使用位图来“映射”(没有双关语)我的目标图像,然后调整其大小并将其与经过相同步骤的其他图像放入同一ImageView中。 Because I am trying to combine several images inside a single view, this is inevitable. 因为我试图在一个视图中合并多个图像,所以这是不可避免的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM