bitmap

C#创建不规则窗体的3种方式详解

对着背影说爱祢 提交于 2020-01-10 23:47:34
现在,C#创建不规则窗体不是一件难事,下面总结一下: 一、自定义窗体 一般为规则的图形,如圆、椭圆等。 做法: 重写Form1_Paint事件(Form1是窗体的名字),最简单的一种情况如下: System.Drawing.Drawing2D.GraphicsPath shape = new System.Drawing.Drawing2D.GraphicsPath(); shape.AddEllipse(0,0, this .Height, this .Width); this .Region = new Region(shape); 即重绘窗体的规则。 二、利用背景图片实现 1. 设置窗体的背景图片,其中背景图片是24位(不包括24)以下的位图(BMP图片),并且要设置TansparencyKey的值,一般为你背景图片的背景色,即创建不规则图片时的底色,一般设为你图片中没有的颜色。 这种做法的不好的地方就是背景图片一定要16位或者更低的,而且还要确保客户端的显示。如果监视器的颜色深度设置大于 24 位,则不管 TransparencyKey 属性是如何设置的,窗体的非透明部分都会产生显示问题。若要避免出现这种问题,请确保“显示”控制面板中的监视器颜色深度的设置小于 24 位。当开发具有这种透明功能的应用程序时,请牢记应使您的用户意识到此问题。 实现步骤 如下: 1.

Redis学习笔记(五):BitMap

时间秒杀一切 提交于 2020-01-10 01:56:56
BitMap是什么 就是通过一个 bit 位来表示某个元素对应的值或者状态,其中的 key 就是对应元素本身。我们知道8个 bit 可以组成一个 Byte ,所以 bitmap 本身会极大的节省储存空间。 Redis中的BitMap Redis 从 2.2.0 版本开始新增了 setbit , getbit , bitcount 等几个 bitmap 相关命令。虽然是新命令,但是并没有新增新的数据类型,仍然属于 String ,因为 setbit 等命令只不过是在 set 上的扩展。 BitMap 的值只有 0 和 1 . 所以,在 Springboot 中也是通过 RedisTemplate::opsForValue 来操作并且将值规定为 Boolean 类型的. API 命令 参数 实战 说明 SETBIT key,offset,[0|1] SETBIT login:2020:01:01 1 1 把 login:2020:01:01 第一个位置设置值为1 GETBIT key,office GETBIT login:2020:01:01 1 获取 login:2020:01:01 第一个位置的值 BITOP opt([ AND | OR |NOT | XOR ]),destKey,key1,key2… BITOP AND 2019Count 20190101 20191231

WPF C# 创建缩略图

只谈情不闲聊 提交于 2020-01-09 23:55:28
不太精确的方法: public bool ThumbnailCallback() { return false; } private void CreateThumb(int toWidth) { System.Drawing.Image.GetThumbnailImageAbort myCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); Bitmap myBitmap = new Bitmap("D:\\img100.jpg"); double rate = (double)((double)myBitmap.Width / myBitmap.Height ); int toHeight =(int)((double )toWidth / rate); System.Drawing.Image myThumbnail = myBitmap.GetThumbnailImage(toWidth , toHeight, myCallback, IntPtr.Zero); myThumbnail.Save("D:\\okThumb.jpg"); }    注意:由于int 和double的问题 无法精确。。。。。。。。。。。。。。。。。 来源: https://www.cnblogs

Access to raw data in ARGB_8888 Android Bitmap

◇◆丶佛笑我妖孽 提交于 2020-01-09 18:06:55
问题 I am trying to access the raw data of a Bitmap in ARGB_8888 format on Android, using the copyPixelsToBuffer and copyPixelsFromBuffer methods. However, invocation of those calls seems to always apply the alpha channel to the rgb channels. I need the raw data in a byte[] or similar (to pass through JNI; yes, I know about bitmap.h in Android 2.2, cannot use that). Here is a sample: // Create 1x1 Bitmap with alpha channel, 8 bits per channel Bitmap one = Bitmap.createBitmap(1,1,Bitmap.Config.ARGB

Access to raw data in ARGB_8888 Android Bitmap

↘锁芯ラ 提交于 2020-01-09 18:04:12
问题 I am trying to access the raw data of a Bitmap in ARGB_8888 format on Android, using the copyPixelsToBuffer and copyPixelsFromBuffer methods. However, invocation of those calls seems to always apply the alpha channel to the rgb channels. I need the raw data in a byte[] or similar (to pass through JNI; yes, I know about bitmap.h in Android 2.2, cannot use that). Here is a sample: // Create 1x1 Bitmap with alpha channel, 8 bits per channel Bitmap one = Bitmap.createBitmap(1,1,Bitmap.Config.ARGB

Access to raw data in ARGB_8888 Android Bitmap

自古美人都是妖i 提交于 2020-01-09 18:00:59
问题 I am trying to access the raw data of a Bitmap in ARGB_8888 format on Android, using the copyPixelsToBuffer and copyPixelsFromBuffer methods. However, invocation of those calls seems to always apply the alpha channel to the rgb channels. I need the raw data in a byte[] or similar (to pass through JNI; yes, I know about bitmap.h in Android 2.2, cannot use that). Here is a sample: // Create 1x1 Bitmap with alpha channel, 8 bits per channel Bitmap one = Bitmap.createBitmap(1,1,Bitmap.Config.ARGB

Android - Draw Bitmap within Canvas

别来无恙 提交于 2020-01-09 10:13:43
问题 I currently have a maze game which draws a 5 x 5 square (takes the width of screen and splits it evenly). Then for each of these boxes using x and y cordinates I user drawRect, to draw a colored background. The issue I am having is I now need to draw an image within this same location, therefore replacing the current plain background colour fill. Here is the code I am currently using to drawRect (a few example): // these are all the variation of drawRect that I use canvas.drawRect(x, y, (x +

Android - Draw Bitmap within Canvas

做~自己de王妃 提交于 2020-01-09 10:11:50
问题 I currently have a maze game which draws a 5 x 5 square (takes the width of screen and splits it evenly). Then for each of these boxes using x and y cordinates I user drawRect, to draw a colored background. The issue I am having is I now need to draw an image within this same location, therefore replacing the current plain background colour fill. Here is the code I am currently using to drawRect (a few example): // these are all the variation of drawRect that I use canvas.drawRect(x, y, (x +

Convert android.media.Image (YUV_420_888) to Bitmap

依然范特西╮ 提交于 2020-01-09 10:06:39
问题 I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. I successfully receive callbacks using onImageAvailableListener, but for future processing I need to obtain bitmap from YUV_420_888 android.media.Image. I searched for similar questions, but none of them helped. Could you please suggest me how to convert android.media.Image (YUV_420_888) to Bitmap or maybe there's a better way of

Convert android.media.Image (YUV_420_888) to Bitmap

蹲街弑〆低调 提交于 2020-01-09 10:05:15
问题 I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. I successfully receive callbacks using onImageAvailableListener, but for future processing I need to obtain bitmap from YUV_420_888 android.media.Image. I searched for similar questions, but none of them helped. Could you please suggest me how to convert android.media.Image (YUV_420_888) to Bitmap or maybe there's a better way of